March 28th, 2000, 03:20 PM
Join Date: Mar 2000
Location: Pennsylvania, USA
Time spent in forums: 24 m 15 sec
Reputation Power: 14
I am executing a cgi-script using a username and password sent via hidden
fields from another location. This cgi-script simply creates database
records (if the first time this user has visited), then needs to pass
control to a static html page. By the time I get to the html page, I need to
have a cookie set, but we don't want any screens to show up in between -
basically the whole cgi-script processing is invisible. Once finished with
the update, I send the username via a hidden field in an autosubmitted form
to a php script in order to get the cookie set.
Now, in order to get the cookie set, I execute a 'self-check' routine in php
(this routine is right out of the Professional PHP Programming Book, by Wrox
Press). This scripts sets the cookie then redirects to itself. The second
time through this script, it checks to see if the cookie exists - if it
doesn't, it gives a message "...Please enable cookies". If it does - it
redirects to the static html page. The code is below.
My problem is that the first time through this whole process (cgi-script to
php script - in a new browser session), I get the error "...Please enable
cookies" (which I DO have enabled). If I then send through a second username
and password and go through the whole process (same browser session) - this
time it works, and sets the cookie with the second username.
Can someone help a newbie and tell me what I'm doing wrong?
The php script (test.php3; passname is the hidden field from the
$page = "test.php3?check=1";
header ("Location: $page");
echo "Could not set cookie. Please enable cookies.";
Thanks in advance!