Jump to content


Photo

Image Verifcation


  • Please log in to reply
7 replies to this topic

#1 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 10 September 2006 - 04:13 PM

Hey

I have a website, where certain pages, i allow people to add comments, Call me stupid, but I never had an image verification on there. I approve all comments before they go online, using my Admin Control which I built

But recently I am receivin 10 posts a day from some company for sex, and drugs. Which tells me that I need image verification

I am due in hospital tomorrow, (need to be there at 8am) so i have to do this quickly,

I created a basic function
<?php
if($_GET["id"]){

$im = imagecreate(100, 30);
$id = $_GET["id"];

$bg = imagecolorallocate($im, 0, 0, 0);
$textcolor = imagecolorallocate($im, 255, 255, 255);

imagestring($im, 5, 25, 5, $id, $textcolor);

header("Content-type: image/png");
imagepng($im);
?>
}

Ok I didn't create it, I used the one on php.net for showing a string, I am short on time

then on the page I am calling the image, I was thinking of doing something like

<?php
$options = "ABCDEFGHJKLMNPRSTUVWXYZ23456789";
$id = "";
for($i = 0; $i < 5; $i++){
$id .= $options{rand(1, 31)};
}

echo "<form method='post' action=''>\n"
//rest of form here
."<input type='hidden' name='id' value='".$id."' />\n"
."<img src='sec_img.php?id=".$id."' /><br />\n"
."Please enter the text from the image into this box<br />\n"
."<input type='text' name='validate' value=''>\n"
//end form bla bla bla

?>

I just want to know as I am calling the image with the GET method, and adding a value in the form, if a bot can read this yet.

Many Thanx
Tell me the problem, I will try tell you the solution

#2 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 10 September 2006 - 05:05 PM


with GD, my captcha script is at www.digitalmidget.com/php_noob2006/captcha.php


Credit@AndyB

Orio.
Think you're smarty?

(Gone until 20 to November)

#3 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 10 September 2006 - 05:29 PM

that link is coming up as a 404
Tell me the problem, I will try tell you the solution

#4 °°Ben³

°°Ben³
  • Members
  • PipPip
  • Member
  • 17 posts
  • LocationGermany / Remagen

Posted 10 September 2006 - 06:26 PM

So you may follow the link in the menu bar?
--> http://www.digitalmi...oob/captcha.php
desktop and web development ;)
---
English is not my native language. Please excuse if I made some errors in expression.

#5 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 10 September 2006 - 06:29 PM

that link is coming up as a 404


Not exactly. It's a '404' page complete with a menu that links to the scripts.  I relocated the php_noob2006 to 'live' status and re-directed with .htaccess :)
Legend has it that reading the manual never killed anyone.
My site

#6 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 10 September 2006 - 06:40 PM

but my question is Can a bot read the source code to get the image id
The one I am using works just the way I want it, easy to read
Tell me the problem, I will try tell you the solution

#7 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 10 September 2006 - 07:15 PM

No, it uses sessions therefore it cant know what's written.

Orio.
Think you're smarty?

(Gone until 20 to November)

#8 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 10 September 2006 - 07:47 PM

By CODE:
So ur saying I should use sessions on my code
Tell me the problem, I will try tell you the solution




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users