Forum Moderators: coopster

Message Too Old, No Replies

Basic PHP 4 / PHP5 Question

         

monkeyman41

11:25 pm on Jan 9, 2008 (gmt 0)

10+ Year Member



I use a simple script I found online to manage my links on my web sites. Some time Sunday my host upgraded the box I was on from PHP4 to 5 and my ads stopped working for about 18 hours until I noticed. It cost me some money.

It seems my script won't work on PHP4. Any help and guidance would be much appreciated as I don't like to have my links hard coded into each piece of creative as it makes mgmt a night mare.

I employed the following code:

For any link I used simply:

http://www.example.com/myLinks.php?o=l1

and my myLinks.php page looks like this


<?PHP

if ($o == "l1") {$link = "http://www.example.com/fsljdfljkksdfls1";} // Ad 1
if ($o == "l2") {$link = "http://www.example.com/fsljdfljkksdfls2";} // Ad 2
if ($o == "l3") {$link = "http://www.example.com/fsljdfljkksdfls3";} // Ad 2

header("Location: $link"); // Jump to the hiddden URL above
exit();
?>

Everything worked like peaches until Sunday.

I am not a programmer obviously but I am able to figure and coopt basic things.

Is this script adaptable with my rudimentary knowledge, like some simple syntax changes, or is this a pretty complicated thing.

Any help would much appreciated!

[edited by: dreamcatcher at 1:48 pm (utc) on Jan. 10, 2008]
[edit reason] Use example.com, thanks. [/edit]

mooger35

11:35 pm on Jan 9, 2008 (gmt 0)

10+ Year Member



Looks like you need to define $o as $_GET['o'] or you could just check for the value of $_GET['o']

<?PHP

if ($_GET['o'] == "l1") {$link = "http://www.example.com/fsljdfljkksdfls1";} // Ad 1
if ($_GET['o'] == "l2") {$link = "http://www.example.com/fsljdfljkksdfls2";} // Ad 2
if ($_GET['o'] == "l3") {$link = "http://www.example.com/fsljdfljkksdfls3";} // Ad 2

header("Location: $link"); // Jump to the hiddden URL above
exit();
?>

[edited by: dreamcatcher at 1:49 pm (utc) on Jan. 10, 2008]
[edit reason] Use example.com, thanks. [/edit]

monkeyman41

6:41 am on Jan 11, 2008 (gmt 0)

10+ Year Member



Thank you Mooger, works like a charm!