Thread: PHP: vraagje

  1. #1

    Registered
    12/10/03
    Location
    Leuven
    Posts
    256
    iTrader
    0
    Mentioned
    0 Post(s)
    Reputation
    0/0

    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  

  2. #2
    orez's Avatar
    Registered
    17/07/02
    Location
    Meulebeke
    Posts
    4,346
    iTrader
    7 (89%)
    Mentioned
    0 Post(s)
    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 nie
    Accent - jobs for people : Junior Marketing Manager / Web & Graphical Design Trends
    DJ orez - HipHop / R&B / Reggaeton / Dancehall / Crunk
    no votes  

  3. #3
    JEy's Avatar
    Registered
    13/03/05
    Posts
    19
    iTrader
    0
    Mentioned
    0 Post(s)
    Reputation
    0/0
    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  

  4. #4

    Registered
    12/10/03
    Location
    Leuven
    Posts
    256
    iTrader
    0
    Mentioned
    0 Post(s)
    Reputation
    0/0
    Bedankt, het werkt
    no votes  

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Log in

Log in