Hi,

I want to create an php system that prevents automated
registrations. 

I have come up with the script in which users come
over and need to enter a random key displayed on the
images while submitting their info. If the number
entered is correct, the post is submitted, else, the
same form is displayed with another random key. 

Now, any one doing a "View Source" gets to know the
image source as "myscript.php". What I want to do is
to save the .jpeg image on my disc with the name as
"randomnumber.jpeg" , where randomnumber is generated
randomly for that page.

Then, I would put an <IMG SRC="randomnumber.jpeg"> tag
and no one will be able to get the name of my php file
creating the image.

I use the following code:-


<?php

function get_random()
{
    srand(time());
    $max = getrandmax();
  return rand(1,$max) ;

}


$number = get_random();

$len=strlen($number)*9;
$max=120;

//resource imagecreate ( int x_size, int y_size)
$image = imagecreate(120,28);


//int imagecolorallocate ( resource image, int red,
int green, int blue) ... basically RGB values for a
color.
$coloryellow = imagecolorallocate($image, 255, 255,
0);
$colorblack = imagecolorallocate($image, 0, 0, 0);

//int imagedashedline ( resource image, int x1, int
y1, int x2, int y2, int color)
imagedashedline($image, 0, 14, 120, 14, $colorblack);

//int imagefill ( resource image, int x, int y, int
color)
imagefill($image, 0, 0, $coloryellow);

//int imagestring ( resource image, int font, int x,
int y, string s, int col)
imagestring($image, 5,($max-$len)/2 , 6, $number,
$colorblack);

imagejpeg($image);


?>

Live example is at
http://www.eliteral.com/moveditems/test1.php

How do I store the images on my server ? Is there a
better way to create random numbers embedded in
dynamic images??

Your help will be appreciated !!


Thanks !!

=====
Best Regards,
Monil Chheda(INDIA)
http://domains.eliteral.com
===========================
===========================

__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to