TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 10-21-2008, 10:17 PM   #1 (permalink)
Super Moderator
Inquisitive 
 
codefreek's Avatar
 
Join Date: Sep 2007
Location: Near you.
Posts: 791
Thanks: 241
codefreek is on a distinguished road
Help why do i get error on this ?

PHP Code:
<?php session_start(); 
//imagecreatefrompng :: create a new image 
//from file or URL
$img imagecreatefrompng('black.png'); 
//displaying the random text on the captcha 
$numero rand(100999); 
$_SESSION['check'] = $numero
//The function imagecolorallocate creates a 
//color using RGB (red,green,blue) format.
$white imagecolorallocate($img255255255); 
imagestring($img1083$numero$white);
header ("Content-type: image/png"); 
imagepng($img); 
?>


and then in the reg page
you do this
session_start();
PHP Code:
if(($_POST['check']) == $_SESSION['check']) { 
echo 
'Input OK';
}else{ 
echo 
'Input Wrong';        

but i get..
echo 'Input Wrong';
codefreek is offline  
Reply With Quote
Old 10-21-2008, 10:31 PM   #2 (permalink)
The Addict
 
CoryMathews's Avatar
 
Join Date: Nov 2007
Location: USA
Posts: 256
Thanks: 7
CoryMathews is on a distinguished road
Default

on $_SESSION['check'] = ($numero);

whats with the () around $numero?
Not sure if thats an error but I could see it as one. What is the actualy error statement.
CoryMathews is offline  
Reply With Quote
Old 10-21-2008, 10:34 PM   #3 (permalink)
Super Moderator
Inquisitive 
 
codefreek's Avatar
 
Join Date: Sep 2007
Location: Near you.
Posts: 791
Thanks: 241
codefreek is on a distinguished road
Default

the form
Code:
<form method="POST" action="register.php"> 
<img src="captchas.php"> <br>
<input type="text" size="10" name="check">  
<input type="submit" name="submit" value="submit"> 
</form>
codefreek is offline  
Reply With Quote
Old 10-21-2008, 10:36 PM   #4 (permalink)
Super Moderator
Inquisitive 
 
codefreek's Avatar
 
Join Date: Sep 2007
Location: Near you.
Posts: 791
Thanks: 241
codefreek is on a distinguished road
Default

it wont, accept it, if it did it would not turn in to echo 'Input Wrong';..
codefreek is offline  
Reply With Quote
Old 10-21-2008, 11:48 PM   #5 (permalink)
Super Moderator
Inquisitive 
 
codefreek's Avatar
 
Join Date: Sep 2007
Location: Near you.
Posts: 791
Thanks: 241
codefreek is on a distinguished road
Default

is there anyone that knows a better way to create.
a CAPTCHA with PHP ?
codefreek is offline  
Reply With Quote
Old 10-22-2008, 07:07 AM   #6 (permalink)
The Contributor
 
awuehr's Avatar
 
Join Date: Oct 2008
Location: Nuremberg, Germany
Posts: 26
Thanks: 3
awuehr is on a distinguished road
Default

Just try the PEAR package Text_CAPTCHA.

Greetings,

Alex
Send a message via ICQ to awuehr Send a message via Skype™ to awuehr
awuehr is offline  
Reply With Quote
The Following User Says Thank You to awuehr For This Useful Post:
codefreek (10-22-2008)
Old 10-22-2008, 07:21 AM   #7 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

Hehe persistant are we?
__________________
Tanax is offline  
Reply With Quote
Old 10-22-2008, 05:04 PM   #8 (permalink)
Super Moderator
Inquisitive 
 
codefreek's Avatar
 
Join Date: Sep 2007
Location: Near you.
Posts: 791
Thanks: 241
codefreek is on a distinguished road
Default

"persistent"
codefreek is offline  
Reply With Quote
Old 10-22-2008, 07:30 PM   #9 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

Don't make me get all particular with spellings, syntaxes, punctuation, et cetera...!
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 10-22-2008, 07:37 PM   #10 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

Don't make Wildhoney get all particular with spelling, syntax, punctuation, et cetera!
Salathe is offline  
Reply With Quote
Old 10-22-2008, 09:01 PM   #11 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

Touché! Touché!
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 10-23-2008, 12:00 AM   #12 (permalink)
Super Moderator
Inquisitive 
 
codefreek's Avatar
 
Join Date: Sep 2007
Location: Near you.
Posts: 791
Thanks: 241
codefreek is on a distinguished road
Default

i made a test / for bot users /

i did like this, simple.

$bottest = $_POST['leave_blank'];


if(strlen($bottest)>1)
{



echo "Nice try!";

}


"<div style='display:none;visibility:hidden;'>",
"<input type='text' name='leave_blank' id='leave_blank'>",
"</div>",


Don't know if that works out to be a good thing for this..
what do you think ?
codefreek is offline  
Reply With Quote
Old 10-23-2008, 12:44 AM   #13 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

Yes, that's one of the simplest ways to do it. Although being simple, it is quite easy to identify. Nonetheless, I would say it'll prevent a good portion of them.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 10-23-2008, 12:49 AM   #14 (permalink)
Super Moderator
Inquisitive 
 
codefreek's Avatar
 
Join Date: Sep 2007
Location: Near you.
Posts: 791
Thanks: 241
codefreek is on a distinguished road
Default

so i did something good :P
yeah awesome xD
codefreek is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 10:09 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design