How to write a php redirect which can take an imput

thesaintv12

Junior Member
Joined
Mar 9, 2010
Messages
142
Reaction score
23
Hi php Black hatters -

I use a php redirect script to hide affiliate links, at the moment I have one file per product. What I want to do is have the redirect script take an input, the product id for example and then use an if within the script to redirect to the correct page on the merchant site.

As you can probably tell I am not that hot when it comes to php, so -
1. Is this possible?
2. can you tell me how to do it or point me in the right direction?

I have done various searches for it, but I think I must not be using the correct 'terms' to describe what I am trying to do.

Cheers all.
 
Use switch ...

call /go.php?id=XXX

then in go.php

$id = $_REQUEST['id'];

switch ($id) {
case "PRODUCT1": $new_url = "target_url1.com"
break;
case "PRODUCT2": $new_url = "target_url2.com"
break;
default:
$new_url = "?!?!!";
}

if ($new_url) {
header ("Location: {$new_*****");
exit;
}
 
Thanks so much for that Niche-Digger, just what I was after!

Rep+thanks given.





Use switch ...

call /go.php?id=XXX

then in go.php

$id = $_REQUEST['id'];

switch ($id) {
case "PRODUCT1": $new_url = "target_url1.com"
break;
case "PRODUCT2": $new_url = "target_url2.com"
break;
default:
$new_url = "?!?!!";
}

if ($new_url) {
header ("Location: {$new_*****");
exit;
}
 
Back
Top