Redirect

They have: 61 posts

Joined: Aug 2000

PHP Redirect based on refering page.

like if refring page= http://mydomain.com/me.html then go to page http://yourdomain.com/my.html

thanx.

Alex

[Edited by exbabylon on Dec. 22, 2000 at 04:18 PM]

[=1]Blamestorming: Sitting around in a group discussing why a deadline was missed or a project failed and who was responsible.[/=1]

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

I wrote a PHP script similar (Cheating Subdomains - PHP)
you could have it to do what you want fairly easy (if you know PHP)

If you have trouble, let me know and I'll write it for you

Good Luck,

Mark Hensler
If there is no answer on Google, then there is no question.

They have: 61 posts

Joined: Aug 2000

What I'm trying to do is make it so that if the person did NOT come from a a certain page to this page then it automaticly sends them back to that page, if they did then it just does nothing.

I already tried to run this script as well as several variations. But it's not working for me. Probably my coding. But it gives me know error! Mabey I just have the "$REFER" variables wrong.

<?php
if ($REFER == "www.domain.com/thispage.html") {header("Location: ");}

if (
$REFER == "domain.com/thispage.html") {header("Location: ");}

else (
"Location: [url]http://www.domain.com/thispage.html");}[/url]
?>

If you could please tell me what I'm doing wrong it would be very appreciated. Thanx!

Alex

[Edited by exbabylon on Dec. 23, 2000 at 02:06 PM]

[=1]Blamestorming: Sitting around in a group discussing why a deadline was missed or a project failed and who was responsible.[/=1]

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

it's you environmenal variable... it should be $HTTP_REFERER

also, your 'else' needs 'header' before the ("Location: "), but you probably know that

you may want to use =~ ..... just depends how specific you want to be about the referer.

Good Luck,

Mark Hensler
If there is no answer on Google, then there is no question.

They have: 61 posts

Joined: Aug 2000

thank you. I will plead ignorance in one area. What exactly does the =~ do that the == does not? What does that mean?

Thank You for your help.

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

=~ is for perl. sorry. eregi is for PHP.
it's the equiv of perl regular expresions

syntax: if eregi($look_for_this, $in_here) { do_this(); }

helpfule links:
http://php.net/manual/function.eregi.php
http://php.net/manual/function.ereg.php

Mark Hensler
If there is no answer on Google, then there is no question.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.