Jump to content

Archived

This topic is now archived and is closed to further replies.

onlyican

Image Verifcation

Recommended Posts

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
[code]
<?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);
?>
}
[/code]

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

[code]
<?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

?>
[/code]

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

Share this post


Link to post
Share on other sites
[quote author=AndyB link=topic=104243.msg415703#msg415703 date=1155583233]

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

Credit@AndyB

Orio.

Share this post


Link to post
Share on other sites
So you may follow the link in the menu bar?
--> http://www.digitalmidget.com/php_noob/captcha.php

Share this post


Link to post
Share on other sites
[quote author=onlyican link=topic=107554.msg431705#msg431705 date=1157909392]
that link is coming up as a 404
[/quote]

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 :)

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
No, it uses sessions therefore it cant know what's written.

Orio.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.