I'm prepared for any downvoting for a request like this but at this point
What kind of community places views asking for an example of something as negative?
Can someone show me a very basic snippet for checking to see if a cookie exists, if it doesn't print a form and use whatever data they present from the form as the cookie?
Certainly, assuming you know how to print out HTML documents, Using CGI.pm you would do the following:
use CGI; my $q = new CGI; my $cookie = $q->cookie(-name=>'form_info') || ''; if ($cookie) { # you have the cookie, validate the info or whatever now } elsif ($q->param('form_info')) { # you've received the form info # now set the cookie my $cookie_to_send = $q->cookie(-name=>'form_info'); # print out header print $q->header(-cookie=>$cookie); # print out HTML header, then html document } else { # no cookie or form params received # print out HTML form }
Hope that helps :)
In reply to Re: A rotten cookie
by Anonymous Monk
in thread A rotten cookie
by sulfericacid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |