Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Re: Widgetz Modify mod

Quote Reply
Re: Widgetz Modify mod In reply to
Hi manu

The redirection works in 4 Steps

1. The user clicks on the link /add.cgi?ID=12
( add.cgi is called with the param ID=12 )

add.cgi checks if the user is logged in.
If not it will redirect the user to user.cgi passing
the parameter 'to' with the value 'add.cgi?ID=12'
( user.cgi?to=$ENV{'SCRIPT_NAME'} )

my $s = $in->param('s') || $in->cookie('s');
$USER = &authenticate ($s);
if (! defined $USER) {
my $id=$in->param('ID');
if ($id){
my $para='?ID='.$id;
print $in->redirect("$LINKS{db_cgi_url}/user.cgi?to=$ENV{'SCRIPT_NAME'}$para") and return;
}
else {
print $in->redirect("$LINKS{db_cgi_url}/user.cgi?to=$ENV{'SCRIPT_NAME'}") and return;
}
}

2. User.cgi is being called with the param To=add.cgi?ID=12

It will now display the loginscreen. It checks if the param 'to' is given and passes it to the sub site_html_login_form.

my $to =$in->param('to');
&site_html_login_form ( { Username => $username, to => $to }, $dynamic);

You have to insert the Tag <%To%> in the template login.html in the form.
with the code:

<%if to%>
<input type="hidden" name="to" value="<%to%>">
<%endif%>

The User submits the loginform (with the field 'to')

3. User.cgi is called from the loginform
It calls the sub login_user. In this subroutine the param 'to' is evaluated with the code:

my $to =$in->param('to');

after the user is checked an logged in this sub displays the loginsuccess page passing the 'to' tag

&site_html_login_success ( {to=>$to}, $in );


4. I inserted a refresh with the value 'to'
in the <head> section of the template login_success.html

<%if to%>
<meta http-equiv="refresh" content="3;URL=<%to%>">
<%endif%>

this refresh will send the user to the page he intended to go.
( in this case to add.cgi?ID=12 )because he is logged in he will be able to ad a link.

regards, alexander

Subject Author Views Date
Thread Widgetz Modify mod manureva 1321 May 25, 2000, 2:48 AM
Post Re: Widgetz Modify mod
Alex404 1241 May 25, 2000, 4:46 AM