please help me in numeric captcha

Started on the old forum in January 2012 · view the original in the archive · old links redirect here

3 replies · 741 views · started 14 years ago · 1 min read

4 participants
sabin14 Newbie · 6 posts #1

How to add random numeric value captcha without images in a script. How to make it work please provide code.

Show me your ways, LORD, teach me your paths. Guide me in your truth and teach me, for you are God my Savior (Psalm 25:4)

atef Developer · 224 posts #2
<?php
function mathcaptcha()
{
$x=rand(1,9);
$y=rand(1,9);
$_SESSION['result'] = $x + $y;
$math = $x.' + '.$y.' = ';
$math .= "<input size="30" maxlength="20" type="text" name="captcha" />";
return $math; 
}

function checkcaptcha()
{
$result = false;
$check = isset($_SESSION['result']) ? $_SESSION['result'] : 'none'; 
unset($_SESSION['result']);

if(is_numeric($check) && is_numeric($_POST['captcha']) && ($check == $_POST['captcha'])) 
{
$result = true; 
} 
return $result; 
}
?>
i0nutzxp Developer · 150 posts #3

Captcha without image is === NULL. A bot can easily pass that. If you really dont want with image you can put random questions but you wont be 99% sure about the 'protection'.

<?php unlink('World/Europe/Romania.country'); ?>
manavworld Developer · 118 posts #4

especially robot access needed on web, so we can just block bot access via .htaccess, that could be better either 😛

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close