Thread: PHP: vraagje
-
26-03-2005, 20:04 #1
PHP: vraagje
Ik zoek een php script dat redirect naar de echte link. bv: links.php?id=1 gaat naar www.site1.be id=2 gaat naar www...... enz. Kan iemand mij helpen? :o
Last edited by NoFear; 26-03-2005 at 20:13.
no votes
-
-
26-03-2005, 20:11 #2
use google...
gewoon uwen querystring opvragen, en dan if $_GET['id] == 1 redirect naar www.site1.be door header, of meta refresh tag... toch zo moeilijk nieno votes
-
26-03-2005, 20:21 #3
Niet getest, maar zal wel werken. Eerste rij in je array is de default-url (bij onbestaande/ongeldige id), rest is numeriek oplopend (id=1, id=2,...).
Code:<? $redirects = array( 'http://games.telenet.be', // default 'http://www.telenet.be', // id 1 'http://telemeter.telenet.be', // id 2 ); $getid = floor($_GET['id']); if ($getid < 0 || $getid >= count($redirects)) { $getid = 0; } header ($GLOBALS["SERVER_PROTOCOL"].' 301 Moved permanently'); header ('Location: '.$redirects[$getid]); header ('Connection: close'); ?>no votes
-
26-03-2005, 20:41 #4
Bedankt, het werkt
no votes
