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 ;-)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); }
In reply to Set Cookie & Redirect from IFRAME by meetn2veg
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |