Jump to content

external URL in array for auto redirect


whare

Recommended Posts

ok topic is a bit cryptic 

 

I am working on a small charity project for a friend he raises funds for a charity via online auctions and raffles of donated items but we want to expand it to start with affiliate schemes gaining the donation without our users dipping there hands in there own pocket 

 

anyway

 

 

some of the affiliate links can be huge so I wanted to chop them down with out own redirect using an array

 

so the user input www.yoursite.com/?afflink=thesiteyouwant  and it auto redirects to the correct place

 

here is the code I have so far

<? 

if(isset($_GET['id'])) {

$page = $_GET['id'];


$link["g"] = www.google.co.uk;
$link["b"] = www.bing.com;
$link["f"] = www.facebook.com;

$name["g"] = google;
$name["b"] = bing;
$name["f"] = facebook;
?>
<html>
<head>
<script type="text/javascript">
<!--
function delayer(){
    window.location = "<? $link[$page] ; ?>"
}
//-->
</script>
</head>

<body onLoad="setTimeout('delayer()', 5000)">
<h2>Thankyou for your help</h2>
<p>Your Awesome!!!!<br>
You will be redirected to <? echo $name[$page] ; ?> in 5 Seconds<br><br>

If the page does not redirect you please click <a href="<? $link[$page] ; ?>">Here</a></p>

</body>
</html>
<?
} else {
?>

Main Site

<? } ?>

now this part (below) works correctly

You will be redirected to <? echo $name[$page] ; ?> in 5 Seconds

but the links will not load it just shows the link you entered to get there 

 

and yes I am a newb been a while since i had a play so playing catch up again now lol

 

as soon as I can get the links to load correct I will be on my way again

 

Thanx all

Link to comment
https://forums.phpfreaks.com/topic/287154-external-url-in-array-for-auto-redirect/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.