Hello Friends Ajj Me Apko Btaunga Ki Kis Prakar Ham Captcha Registration Form Create Kar Sakte Ho.Ajj Mere Is Post Ko Read Karne Ke Bad Aap Kisi Be Form Etc Me Captcha Code Verification Easily Setup Kar Sakte Ho.
Captcha Code Varification Kiu Jarruri Hai-
Dosto Apke Pass Ek Sawal A Raha Hoga Ki Captcha Code Verification Kiu Jarruri Hai.Iska Jwab Hai Ki Ye Hamare Website Ko Spam Content Se Bchati Hai Means Agar Captcha Code Verification Na Ho Kisi Form Me To User Agar Bar Bar Submit Button Par Click Karta Rehta Hai To Spam Content Hmare Database Me Store Hota Rehta Hai.Jiska Hmare Website Par Bad Effect Padta Hai.
Steps for Captcha Code verification-
• Sabse pehle aap ek captcha.php name se file create kar lijiye
captcha.php
<?php
session_start();
$code=rand(1000,9999);
$_SESSION["code"]=$code;
$im = imagecreatetruecolor(50, 24);
$bg = imagecolorallocate($im, 22, 86, 165); //background color blue
$fg = imagecolorallocate($im, 255, 255, 255);//text color white
imagefill($im, 0, 0, $bg);
imagestring($im, 5, 5, 5, $code, $fg);
header("Cache-Control: no-cache, must-revalidate");
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
?>
Is captcha code ka kam ramdom captcha code generate karna hai.
• Ab Ham Html And Javascript Ka Use Karke Ek Form Teyar Karege Validation Ke Sath Jiske Jariye User Signup Karega .
index.php
<html>
<script>
function validateForm() {
var x = document.forms["myForm"]["first_name"].value;
if (x == "") {
alert("first_name must be filled out");
return false;
}
var x = document.forms["myForm"]["last_name"].value;
if (x == "") {
alert("last_name must be filled out");
return false;
}
var x = document.forms["myForm"]["email"].value;
if (x == "") {
alert("email must be filled out");
return false;
}
var x = document.forms["myForm"]["pass"].value;
if (x == "") {
alert("password must be filled out");
return false;
}
var x = document.forms["myForm"]["phone"].value;
if (x == "") {
alert("phone must be filled out");
return false;
}
}
</script>
<body>
<center>
<form name="myForm" action="validate.php"
onsubmit="return validateForm()" method="post">
<table width="400" align="center" border="150">
<tr><td>
<center><h1>Signup </h1></center>
</td>
</tr>
<tr><td>
First_name-:<input type="text" name="first_name" size="50%" placeholder="Enter First Name" ></td>
</tr>
<tr><td>
Last_name-:
<input type="text" name="last_name" size="50%"placeholder="Enter Last Name">
</td></tr>
<tr>
<td>
Email-:
<input type="email" name="email"size="50%" placeholder="Enter Email Id">
</td></tr>
<tr>
<td>
Password-:
<input type="text" name="pass" size="50%" placeholder="Enter Password">
</td>
</tr>
<tr>
<td>
Phone-:
<input type="text" name="phone" size="50%" placeholder="Enter Phone Number">
</td>
</tr>
<tr>
<td>
Enter Image Text
<input name="captcha" type="text">
<img src="captcha.php" /><br>
</td>
</tr>
<tr>
<td>
<center><input type="submit" name="submit" value="publish now"></center><center><br> Already Have An Account<a href="#"> <h3><b>Login</b></h3></a><center></td>
</td>
</tr>
</table>
</form>
</center>
</body>
</html>
• Ab ham ek validate.php Name Ki File Create Karege Jiska Use Karke Dynamic Work Hoga Or User Ke Dwara Enter Kiya Gya Data Database Me Jayege.
validate.php
<center>
<br>
<br>
<br>
<br>
<br>
<?php
session_start();
if(isset($_POST["captcha"])&&$_POST["captcha"]!=""&&$_SESSION["code"]==$_POST["captcha"])
{
echo "<br>";
echo "Correct Code Entered";
//Do you stuff
}
else
{
die("Wrong Code Entered");
}
?>
</center>
<?php
$con=mysqli_connect("fdb6.awardspace.net","2503644_sonu","Bhupender","2503644_sonu");
if(isset($_POST['submit'])){
$first_name =$_POST['first_name'];
$last_name =$_POST['last_name'];
$email =$_POST['email'];
$pass =$_POST['pass'];
$phone=$_POST['phone'];
$query ="insert into admin2(first_name,last_name,email,pass,phone) values ('$first_name','$last_name','$email','$pass','$phone')";
if(mysqli_query($con,$query)){
echo "register";
}else
echo "registration Failed";
}
?>
Ab aap Ek Database Create Kar lijiye 2503644_sonu se wanha nich diye gye tables ko import kar lijiye.
-- phpMyAdmin SQL Dump
-- version 4.6.4
-- https://www.phpmyadmin.net/
--
-- Host: fdb6.awardspace.net
-- Generation Time: Jun 09, 2018 at 02:49 PM
-- Server version: 5.7.20-log
-- PHP Version: 5.5.38
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `2503644_sonu`
--
-- --------------------------------------------------------
--
-- Table structure for table `admin2`
--
CREATE TABLE `admin2` (
`id` int(10) NOT NULL,
`first_name` varchar(100) NOT NULL,
`last_name` varchar(100) NOT NULL,
`email` varchar(100) NOT NULL,
`pass` varchar(100) NOT NULL,
`phone` varchar(1000) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `admin2`
--
INSERT INTO `admin2` (`id`, `first_name`, `last_name`, `email`, `pass`, `phone`) VALUES
(1, 'sonu', 'Kashyap', 'bhupenderkashyap122@gmail.com', '12345', '08054782303'),
(4, 'Bhupender', 'Kashyap', 'kashyap111111bhupender122@gmail.com', '000000', '8054782303'),
(5, 'Bhupender76676767', 'Kashyap', 'ejhhjjjhjhhjr122@gmail.com', '000000887', '8054782303'),
(6, '', '', '', '', ''),
(7, 'Bhupender', 'Kashyap', 'apbhupender122@gmail.com', '0000000', '8054782303'),
(8, 'ooo', 'ooooo', 'ap122@gmail.com', 'hjhhjjh', '08054782303'),
(9, 'ugg', 'ghghfg', 'uuuuuu445@ail.com', '000000000000', '8054782303'),
(10, 'ugg', 'ghghfg', 'uuuuuu445@ail.com', '000000000000', '8054782303'),
(11, 'ugg', 'ghghfg', 'uuuuuu445@ail.com', '000000000000', '8054782303'),
(12, 'ugg', 'ghghfg', 'uuuuuu445@ail.com', '000000000000', '8054782303'),
(13, 'jkhhjjh', '', '', '', ''),
(14, 'ramq', '', '', '', ''),
(15, 'ram', '', '', '', ''),
(16, 'sonu', 'xsss', 'anumnegi21@gmail.com', '0000000000', '8054782303'),
(17, 'sonu', 'xsss', 'sahilthakurloverboy@gmail.com', '0000000000', '8054782303'),
(18, 'p', 'p', 'p@gmail.com', 'p', '0000000000'),
(19, 'Bhupender', 'Kashyap', 'bhupenderkashyap122@gmail.com', '0000000000', '8054782303'),
(20, 'ram', 'kumat', 'ram@gmail.com', 'ram', '8054782303'),
(21, 'jnjkj', 'jkjk', 'bhupend0000erkashyap122@gmail.com', '0000000000', '8054782303'),
(22, 'Bhupender', 'Kashyap', 'anuj.lpu1@gmail.com', '123', '8352034132'),
(23, 'llllhhjhh', 'lll', 'manishanegi122@gmail.com', 'lll', '9824242424'),
(24, 'Bhupender', 'KASHYAP', 'bhupenderkashi9898989889yap122@gmail.com', 'khhhj', '8352034132'),
(25, 'Bhupender', 'Kashyap', 'anuj.lpu1@gmail.com', '123', '8352034132'),
(26, 'Bhupender', 'Kashyap', 'anuj.lpu1@gmail.com', '123', '8352034132'),
(27, 'kunalkashyap462@gmail.com', 'jhjhhj', 'jhhhfsdfsd@gmail.com', 'hjhhj', '08352034132'),
(28, 'sonu', 'konu', 'sonu@gmail.com', 'sonu', '8054782305'),
(29, 'soni', 'kumar', 'kumat', 'kumat', '8054123690'),
(30, 'pop', 'kop', 'ram@fola.com', 'popf', '8456214587');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `admin2`
--
ALTER TABLE `admin2`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `admin2`
--
ALTER TABLE `admin2`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=31;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
Is Parkar Apka Registration Form With Captcha Asani Se Teyar Ho Jayega.
Kisi Be Form Me Captcha Code Varification Kaise Add Kare(Trick 100 % Working)
Sabse Pehle Aap Niche Digye Image Ki Trah Aap Apne Contact Form Ke Html Section Me Janha Be Aap Captcha Code Input Filed And Verification Code Picture Show Karwana Chahte Ho Wanha 2 Lines Of Code Add Kar Dijiye Jese Niche Image Me Ki Hai.
Image-
Ab Aapko Validate.Php File Ke Ander Sabse Niche Diye Gye Code Ki Jgah Apne Form Ka Php Code Ko Enter Karke Save Kar Dijiye Bakki Upper Ka Red Color Wala Code Same Rahega.
captcha.php File Me Kbhi Koi Change Nhi Hoga Wo Hmesha Same Rahegi.
Is Parkar Easily Ap Kisi Be Form Me Captcha Code Verification Add Kar Sakte Ho.
• Is Parkar Apka Easily Contact Form With Captcha Code Verification Ke Sath Teyar Ho Jayega
Demo- captcha verification Regisatration Form
Is Parkar Aap Easily Captcha Code Verification(Contact Form) Teyar Kar Sakte Ho.Me Ummid Karta Hu Ki Apko Post Achi Lagi Hogi Agar Apko Koi Problem A Rhe Hai Is Post Me To Aap Comment Section Me Puch Sakte Ho
Thank You
Team Gajabwap Web In Hindi
Also Read-
How To Create Visitor Counter With Php and Mysql-Full Guide In Hindi
ConversionConversion EmoticonEmoticon