Ralph,

That's what I did on first.php code I wonder why.


-- first.php --
session_start();
session_register('new_string');

Header("Content-Type: image/png");
$new_string;
$im = ImageCreate(200, 50); 
$white = ImageColorAllocate($im, 255, 255, 255);
$black = ImageColorAllocate($im, 0, 0, 0);
srand((double)microtime()*1000000); 
$string = md5(rand(0,9999)); 
$new_string = substr($string, 17, 5);
ImageFill($im, 0, 0, $black);
ImageString($im, 4, 96, 19, $new_string, $white);
ImagePNG($im, "verify.png");
ImageDestroy($im);
-- end // first.php --


--
Thank you,
Louie


-----Original Message-----
From: Ralph [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 08, 2003 10:02 AM
To: Miranda, Joel Louie M; [EMAIL PROTECTED]
Subject: RE: [PHP] Image verification problem..


You should register session for 'new_string' after assigning a value to it.

So try placing

session_start();
session_register('new_string');

after the rest of your first.php code.

That should work.



-----Original Message-----
From: Miranda, Joel Louie M [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 07, 2003 6:45 PM
To: '[EMAIL PROTECTED]'
Subject: [PHP] Image verification problem..

Im trying the image verification thing I think everything goes well for the
generation of the image but when it comes to verifying the text when I typed
in any text it just generates and process the form, but when I leave it
blank it says the error. I think the session variables for $new_string is
not being passed I tried to echo the session variable but it doesn't show
up.

Any ideas on this?

I think this is the problem? elseif ($new_string == $verify_random) but I
don't think so..


-- first.php --
session_start();
session_register('new_string');

Header("Content-Type: image/png");
$new_string;
$im = ImageCreate(200, 50); 
$white = ImageColorAllocate($im, 255, 255, 255);
$black = ImageColorAllocate($im, 0, 0, 0);
srand((double)microtime()*1000000); 
$string = md5(rand(0,9999)); 
$new_string = substr($string, 17, 5);
ImageFill($im, 0, 0, $black);
ImageString($im, 4, 96, 19, $new_string, $white);
ImagePNG($im, "verify.png");
ImageDestroy($im);
-- end // first.php --








-- second.php --
session_start();
$random = $_POST['random'] ;
$verify_random = trim($random);

if (empty($v_name_filter) || empty($v_email_filter)) { 
echo "All fields are Required"; 
}
elseif ($new_string == $verify_random)
{
echo "Please go back and get verified.\n\n";
echo "$new_string\n\n";
echo "$verify_random\n\n";
echo "SessionID: $PHPSESSID";
} else {
echo "$new_string\n\n";
echo "$verify_random\n\n";
echo "SessionID: $PHPSESSID";
-- end // second.php --



--
Thank you,
Louie

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

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

Reply via email to