Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<html>
<head>
prove that you are not a bot.type the word you see in the screen
</head>
<body>
<?php
session_start();
if(!isset($_SESSION["random"]) || !isset($_POST['user']) )
{
$random = str_shuffle("dgds235");
$_SESSION["random"] = $random;
$im = imagecreate(300, 30);
$bg = imagecolorallocate($im, 255, 255, 255);
$textcolor = imagecolorallocate($im, 0, 0, 255);
// Write the string at the top left
imagestring($im, 5, 0, 0, $random , $textcolor);
// Output the image
imagepng($im, "file.png");
echo "<img src=\"file.png\"/>";
imagedestroy($im);
}
?>
<br>
type the words in the above picture
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
<input type="text" name="user">
<input type="submit" name="submit">
</form>
<?php
if (isset($_POST['user']) and isset($_SESSION["random"]))
{
$rand = $_POST['user'];
if ($rand == $_SESSION["random"])
{
echo "<br>you are not a bot";
}
else{
echo $_POST['user'];
echo $_SESSION["random"];
echo "<br>you are a bot";
}
session_unset();
session_destroy();
}
?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment