Greenguy's Board

Greenguy's Board (http://www.greenguysboard.com/board/index.php)
-   Programming & Scripting (http://www.greenguysboard.com/board/forumdisplay.php?f=15)
-   -   Need some PHP help (http://www.greenguysboard.com/board/showthread.php?t=49514)

A.J. Angel 2008-10-13 08:33 PM

Need some PHP help
 
Hey there,

I need some help from someone who is good in PHP. Currently, I am using the following code to hide my affiliate links:

PHP Code:

<?php

$path 
= array(

    
"amateursgonebad"    =>    "http://www.amateursgonebad.com/t1/revs=exquisiteangelz/",
    
"glamourmodelsgonebad"    =>    "http://www.glamourmodelsgonebad.com/t1/revs=exquisiteangelz/"

    
);

if (
array_key_exists($_GET["id"], $path))
    
header("location: " $path[$_GET["id"]]);

?>

Now, considering that the files which contains the code is called "index.php" and that it is located in a subdirectory called "redirect", how may I redirect surfers that go to the file in question directly (ie. "http://www.domain.com/redirect/index.php") be redirected back to my homepage while still being able to use the code above to hide my affiliate links? Any ideas or indications would greatly appreciated. Thanks!

cd34 2008-10-13 08:57 PM

Code:

if (array_key_exists($_GET["id"], $path)) {
    header("location: " . $path[$_GET["id"]]);
} else {
  header("location: http://yoursite.com/");
}


A.J. Angel 2008-10-13 09:16 PM

Much thanks to you CD! |waves|


All times are GMT -4. The time now is 05:38 PM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc