Reply to Sessions are driving me to insanity

Your name:

Reply:


Posted by Peter Jay Salzman on 12/17/05 19:07

I'm writing a blogging app that uses an image file of a short string that
users need to type in to comment. I've heard it called a "captcha" system.

The problem is that the file that creates string and the image of the string
can't access $_SESSION, and so has no way of passing the string to the
receiving form.



view_by_permalink.php (Smarty template, actually):

Verification String:
<img src="captcha2.php?{$sessionName}={$sessionId}" />

Enter the string in the image:
<form action="add.comment.php" method="post">
<input type="text" name="userCaptchaInput" />
</form>



captcha2.php:

// Create the string.
(snip)

// Define colors and create the image.
(snip)

imagestring ($image, 5, 1, 1, $cmntPass, $colorBlue);
ImagePNG( $image );
ImageDestroy( $image );

session_id( $_REQUEST['PHPSESSID'] );
start_session();
$_SESSION['captcha'] = $cmntPass;



add_comment.php:

echo '<pre>'; print_r($_SESSION); echo '</pre>';
echo '<pre>'; print_r($_POST); echo '</pre>';
exit;




The problem is that I haven't found a way to send the random string from
captcha2.php to add_comment.php.

I've tried and tried, but I can't seem to access $_SESSION variables in
captcha2.php. I think sending the image somehow interfers with setting the
session.

How can I start a session and set up a session variable from captcha2.php?

Thanks!
Pete

[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

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