Reply to a silly question on sessions

Your name:

Reply:


Posted by Swann on 04/17/07 13:15

i'm trying to write a very simple CAPTCHA script. following some examples
and working a bit on the code to suit my needs, i managed to generate the
random image as desired. i have a php file with the form to be filled
(called "form.php"), and another one with the code needed to generate the
CAPTCHA image (called "captcha.php"). int the former i have a simple IMG tag
in the former file to call the latter, like this:

<img src="captcha.php">


before writing the code needed to process the entered password against the
value of the one displayed in the image, i wanted to make sure that the
script was getting the correct value. "captcha.php", after randomly
generating the password, puts its value into a session var using the
following instruction:

$_SESSION["passcheck"] = $pass;

i put the following line at the end of "form.php", to check if the value was
passed correctly:


print "VAR VALUE: ".$_SESSION["passcheck"];

here comes the problem: the script always displays the *former* value of the
variable, not the current one. for example, if the first time i run the
script the image displays, say, "AAAAA", the bottom line displays "VAR
VALUE: " with an empty string after it.
i have to reload the page to see "VAR VALUE: AAAAA", but of course in the
meantime the image has changed to, say "BBBBB". i am sure it's a very silly
thing, but right now i just can't manage to untie the knot. anybody wants to
point out how stupid i am by giving me some advice? :)

thanks a lot.

swann

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация