leta
asked on
displaying HTML page after cookie set
Here's the scenario that a user would go through when selecting a particular link on the site I'm building:
1. cgi script that determines whether the user has ever been there before. If "yes" then #4 below, else #2.
2. form for first-timers that asks for a couple pieces of info.
3. cgi script which stores the couple pieces of info in a cookie.
4. the main page of interest.
My question is how does the script in #3 manage both to write a cookie AND then give the user a complex HTML page back? I want the HTML page in its own file, i.e., I don't want to just print it out one line at a time from my Perl cgi script. The last two lines of the script currently look like this...
print "Content-type: text/html\n";
print "Set-Cookie: username=$FORM{'username'} calhost=$FORM{'calhost'};
expires=Thu, 31-Dec-98 12:00:00 PST; path=/projects/blitz\n\n";
I thought of having the next line output a server-side include for the entire HTML file, but the server I'm using (I'm not the webmaster) doesn't seem to be set up for SSIs.
Is there another way?
1. cgi script that determines whether the user has ever been there before. If "yes" then #4 below, else #2.
2. form for first-timers that asks for a couple pieces of info.
3. cgi script which stores the couple pieces of info in a cookie.
4. the main page of interest.
My question is how does the script in #3 manage both to write a cookie AND then give the user a complex HTML page back? I want the HTML page in its own file, i.e., I don't want to just print it out one line at a time from my Perl cgi script. The last two lines of the script currently look like this...
print "Content-type: text/html\n";
print "Set-Cookie: username=$FORM{'username'}
expires=Thu, 31-Dec-98 12:00:00 PST; path=/projects/blitz\n\n";
I thought of having the next line output a server-side include for the entire HTML file, but the server I'm using (I'm not the webmaster) doesn't seem to be set up for SSIs.
Is there another way?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
file be allowed to remain a separate file. But solution #1
is PERFECT! I'm rather embarrassed that I couldn't think of
this, but I was so sure that there was some cgi thing that I
didn't know about that I wasn't spending much energy on Perl
solutions. I did try one very similar thing...
system("cat myhtmlfile");
but the output from system calls evidently doesn't go to the
same place as the output from print statements. It should have
been a small mental leap from my attempt to yours, but I was
mentally blocked by that point!
THANKS!!!