Gossamer Forum
Home : Products : Links 2.0 : Customization :

How to redirect user after newsl. subscribing to index.html?

Quote Reply
How to redirect user after newsl. subscribing to index.html?
can anybody help me, how to redirect my users directly to the index.html after subscribing to my newsletter mailinglist?
thanks much for any solution,
michaelh
Quote Reply
Re: How to redirect user after newsl. subscribing to index.html? In reply to
Since the success page is basically the start page and its called from site_html_templates, the best thing for you to do would be to write a new subroutine, then point the subscribe script to that subroutine, and also make it its own template or just put this <META http-equiv="refresh" content="10; url=http://your-url.com/page.html"> in between the <HEAD></HEAD>
tags in the email.html template. But you would have to say the full url and page you want it to go to. I would recommend the new subroutine. Its a better way of giving your visitor a chance in being able to get their form submitted before they go back to your homepage. If you need help with the subroutine, just write back. Good Luck.

------------------
------------------------------------------
Lavon Russell
LookHard! Search
http://www.lh.yi.org
webmaster@lh.yi.org
Quote Reply
Re: How to redirect user after newsl. subscribing to index.html? In reply to
Why not at the end of the subscribe routine, just:

print "Location: http://www.yoursite.com";

or

print "Location: $build_root_url";

That will send them to whatever page you specify.

Quote Reply
Re: How to redirect user after newsl. subscribing to index.html? In reply to
Do you mean so that when they add and the add is successful, it'll go straight to the homepage as if the homepage was the success page? If so yeah, thats a way better idea then going through the process of making a subroutine.

------------------
------------------------------------------
Lavon Russell
LookHard! Search
http://www.lh.yi.org
webmaster@lh.yi.org
Quote Reply
Re: How to redirect user after newsl. subscribing to index.html? In reply to
thanks bmxer and pugdog,

what file i have to modify and where exactly
i have to insert the

print "Location: $build_root_url"; ?

is it the 'site_html_templates.pl' or the subscribe.cgi?

thanks again,
michael


Quote Reply
Re: How to redirect user after newsl. subscribing to index.html? In reply to
Where ever you would give the "success" message, put this instead. It should be at the end of the subscribe routine, most likely.

Quote Reply
Re: How to redirect user after newsl. subscribing to index.html? In reply to
after adding
print "Location: $build_root_url";
to the subscribe.cgi like this:

sub subscribe {
# -----------------------------------------------------------
# Adds a user into a mailing list.
#
my %in = @_;
my $list = $db_email_name;

# Make sure the email address at least looks like an email address.
my $email = $in{'email'};
my $name = $in{'name'};
($email =~ /.+@.+\..+/) or &site_html_mailing_error ("The email address: '$email' doesn't look like a real email address.") and return;
($name =~ /[A-Za-z]+/) or &site_html_mailing_error ("Please enter a name as well as an email address.") and return;

# Check that the user is not already subscribed.
my $users_r = &get_users ($list);
${$users_r}{$email} and &site_html_mailing_error ("The email address: $email is already subscribed to this list.") and return;

# Made it this far, so let's add the user in.
${$users_r}{$email} = $name;

open (LIST, ">$list") or &cgierr ("Unable to open list: $list. Reason: $!");
if ($db_use_flock) { flock (LIST, 2) or &cgierr ("Unable to get exlusive lock! Reason: $!"); }
foreach (sort keys %{$users_r}) {
print LIST "$_$db_delim${$users_r}{$_}\n";
}
close LIST;

# Go to the success page.
print "Location: $build_root_url";
}

i get an internal server error after subscribing.

whats wrong?

thanks for your patience!
Quote Reply
Re: How to redirect user after newsl. subscribing to index.html? In reply to
nevermind

------------------
------------------------------------------
Lavon Russell
LookHard! Search
www.lh.yi.org
webmaster@lh.yi.org


[This message has been edited by Bmxer (edited August 16, 1999).]
Quote Reply
Re: How to redirect user after newsl. subscribing to index.html? In reply to
What's the complete message, and what does your error.log show?

That would be a big help..

also, try

print "Location: http://www.yoursite.com";

Just in case there is a problem with the variable jump.
Quote Reply
Re: How to redirect user after newsl. subscribing to index.html? In reply to
Use this : # Go to the success page.
print "Location: $build_root_url\n\n" ;
}


------------------
------------------------------------------
Lavon Russell
LookHard! Search
http://www.lh.yi.org
webmaster@lh.yi.org
Quote Reply
Re: How to redirect user after newsl. subscribing to index.html? In reply to
yeah! at the end of the day a perfect solution! thats what i like. (23:15 in germany) thanks very much!
Quote Reply
Re: How to redirect user after newsl. subscribing to index.html? In reply to
I am trying the same thing and I get the internal server error also, did anyone ever solve this problem is so please let me know. Thanks

Quote Reply
Re: How to redirect user after newsl. subscribing to index.html? In reply to
In Reply To:
yeah! at the end of the day a perfect solution! thats what i like. (23:15 in germany) thanks very much!
I don't know about you but that seems like it was solved to me. Read the directions above but making the relocation part look like this:
print "Location: http://www.yoursite.com\n\n";