GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Help me, I want to set up a PHP redirect file, Thanks (https://gfy.com/showthread.php?t=97233)

AkiraSS 01-01-2003 07:08 PM

Help me, I want to set up a PHP redirect file, Thanks
 
Hi I have a problem,
I want a simple PHP file that only does redirect,
I have something made up but doesn't work:

<?php
switch($id) {
case 0: $url = "http://www.yahoo.com"; break;
case 1: $url = "http://www.altavista.com"; break;
}
header("Location: $url");
?>

I named it redirect.php

and if I make query http://www.mysite.com/redirect.php?id=0
it takes me to yahoo.com

but if I make query http://www.mysite.com/redirect.php?id=1
it takes me to yahoo.com again instead of altavista.com

help?

dacash 01-01-2003 07:20 PM

try this

switch($HTTP_GET_VARS["id"]){
case 0: $url = "http://www.yahoo.com"; break;
case 1: $url = "http://www.altavista.com"; break;
}
header("Location: $url");
?>

Triple 6 01-01-2003 07:28 PM

Quote:

Originally posted by dacash
try this

switch($HTTP_GET_VARS["id"]){
case 0: $url = "http://www.yahoo.com"; break;
case 1: $url = "http://www.altavista.com"; break;
}
header("Location: $url");
?>

That will do it.

AkiraSS 01-01-2003 07:30 PM

Many thanks dacash !!! Works fine now!
Thanks again 10x !

dacash 01-01-2003 07:32 PM

no problem, always try to help people out, because someday maybe i'll need some help :)


All times are GMT -7. The time now is 09:53 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123