I am trying to make a simple captcha in PHP just for learning purpose, not converting the string into image as of now, I can’t figure what I am doing wrong? I am not even able to verify the code, it’s giving string didn’t match every time
Here’s the code
<?php
$var = 'abcdefghijklmnopqrstuywxyz1234567890';
$random = str_shuffle($var);
$captcha = substr($random,0,10);
echo $captcha;
if(isset($_POST['captcha'])){
$check = $_POST['captcha'];
if ($captcha==$check){
echo 'Verified.';
}else{echo 'string didn\'t match';}
}
?>
<form action="random.php" method="POST">
<input type="text" name="captcha"><br>
<input type="submit" value="Submit">
</form>
I don’t recommend this to use for captcha.
But i am correcting your code only for your
learning purpose.