Hi all, I have a problem with Perl-CGI script. I tried logout for my web page. It is working fine, but i cant able to pass cookies. I have login page in test.cgi.... how to pass user name('$user') to show.cgi page... or is there any way to retrive it in show.cgi page...any one please give me a way..

Below is the test.cgi script,

#!/usr/bin/perl use CGI; use CGI::Carp qw/fatalsToBrowser warningsToBrowser/; use CGI::Session ( '-ip_match' ); my $q=new CGI; my $user = $q->param('usr'); my $pwd = $q->param('pwd'); if($user ne '' and $pwd ne '') { if($user eq "monk" and $pwd eq "hi") { $session = new CGI::Session(); print $session->header(-location=>'show.cgi'); } else { print $q->header(-type=>"text/html",-location=>"test.cgi"); } } elsif($q->param('action') eq 'logout') { $session = CGI::Session->load() or die CGI::Session->errstr; $session->delete(); print $session->header(-location=>'test.cgi'); } else { print $q->header; print start_html; print <&#8804;EndHTML; ---------loginpage--------- EndHTML print end_html; }

In reply to Help on cookies by daynite

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.