A simple and secure slider captcha built with PHP + JavaScript to protect forms from bots and spam.
This captcha requires users to slide a block into place and verifies how closely it matches the target (with a percentage).
- 
A lightweight, dependency-free PHP slider captcha that enhances form security with: ✅ Match percentage feedback after verification 
 🔒 CSRF-like token protection
 ⏳ 2-minute expiry
 🕵️ Honeypot field (bot trap)
 🚫 Attempt limit per session
 ⚡ Easy drop-in integration for any PHP form
php-slider-captcha/
│── nvcaptcha/
│   ├── captcha_init.php     # Initializes captcha session & security
│   ├── captcha_view.php     # Captcha UI (slider)
│   ├── captcha_verify.php   # Backend verification (AJAX)
│── example.php              # Example usage form
│── README.md                # Documentation
- Clone the repository:
git clone https://github.com/DigitalEforce/php-slider-captcha.git 
- Place the folder in your PHP server (e.g., htdocsorwww).
- Open example.phpin your browser to test.
<?php include "nvcaptcha/captcha_view.php"; ?>if ($_SERVER['REQUEST_METHOD'] === "POST") {
    // Honeypot check
    if (!empty($_POST['nvc_trap'])) {
        die("Bot detected!");
    }
    // Captcha check
    if ($_POST['captcha_verified'] === "1") {
        echo "Form submitted successfully ✅";
    } else {
        echo "Captcha failed ❌";
    }
}<?php session_start(); ?>
<!DOCTYPE html>
<html>
<head><title>Slider Captcha Demo</title></head>
<body>
<h2>Form with Slider Captcha</h2>
<form method="post" action="">
    <input type="text" name="name" placeholder="Your Name" required><br><br>
    <?php include "nvcaptcha/captcha_view.php"; ?><br>
    <button type="submit">Submit</button>
</form>
<?php
if($_SERVER['REQUEST_METHOD'] === "POST"){
    if(!empty($_POST['nvc_trap'])){ die("Bot detected!"); }
    if($_POST['captcha_verified'] === "1"){
        echo "<p style='color:green'>Form submitted successfully ✅</p>";
    } else {
        echo "<p style='color:red'>Captcha failed ❌</p>";
    }
}
?>
</body>
</html>I am Naveed, a passionate PHP developer. I specialize in creating modern, secure, and professional web applications using PHP, MySQL, and Bootstrap.
Check my GitHub for more projects: https://github.com/DigitalEforce
MIT License
