Have searched already and found replies! Most dating back to 2002 and some to 2001! I'm NOT on IIS, and everything works fine all except the 'redirect' part!!! Basically this code comes from an IFRAME where I'm calling &authenticate sub. If a user times-out if working within the IFRAME, I would like to redirect the '_top' frame to the login.cgi script. Here's my code:
my $query = new CGI; my $USER_COOKIE = $query->cookie('LOGGEDIN'); ##### COOKIEDATA FORMAT ##### sid : time : user : user_lang : user_perm my ( $CSID, $CTIMEIN, $USER, $USER_NAME, $USER_LANG, $USER_PERM, ) + = split (/\:/, $USER_COOKIE ); ##### DO TIMEOUT STUFF my $now = time(); if((( $now - $CTIMEIN ) < $timeout ) && ($CSID eq "$FORM{'sid'}")) + { ##### COOKIEDATA FORMAT ##### sid : time : user : user_name : user_lang : user_perm my $cookie_data = qq¿$CSID:$now:$USER:$USER_NAME:$USER_LANG:$U +SER_PERM¿; $expires = $now + $timeout ; ##### Set cookie : No need to redirect as session still valid my $user_loggedin = new CGI::Cookie( -name=>'LOGGEDIN', -value=>$cookie_data, -expires=>$expires, ); print "Set-Cookie: $user_loggedin\n"; } else{ ##### Redirect user to login.cgi my $user_loggedin = new CGI::Cookie( -name=>'LOGGEDIN', -value=>'', -expires=>'-1d', ); my $redirect = qq¿$SITE_BASE_URL/login.cgi?timeout=y¿; print $query->redirect( -cookie=>$user_loggedin, -uri=>$redirect, -target=>'_top', ); exit(0); }
From what I've read both here and http://search.cpan.org/~lds/CGI.pm-3.08/CGI.pm the $query->redirect does not support the -target=> arg and those that do support -target=> arg, I can't really work out how to use them with what I've already got. Can anyone help? Any takers? Many thianks as usual to those who take the time to reply ;-)

In reply to Set Cookie & Redirect from IFRAME by meetn2veg

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.