How Put Simple Redirector

Discussion in 'PHP' started by Sk8TeR, Oct 1, 2008.

  1. #1
    Hello,

    I need some script

    Whit this function

    For example i whant to redirect my user to google

    i use this url

    www.mysite.com/redirector.php?=http://google.com

    But before redirect show a page for example


    You will be redirected now to ....
    and below some ads XD

    Grettings
     
    Sk8TeR, Oct 1, 2008 IP
  2. ads2help

    ads2help Peon

    Messages:
    2,142
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    0
    #2
    The link is: www.mysite.com/redirector.php?url=http://google.com

    
    // at your redirector.php
    ob_start(); // put this on the top just below <?php
    
    if ( $_GET['url'] != '') {
    $delay = 3; // in seconds
    header("Refresh: $delay; URL=".$_GET['url']);
    print 'You will be redirected now to '.$_GET['url'];
    
    // your ads here XD
    print '';
    
    }
    
    
    PHP:
    But take note that people can access your website's pages too, like:

    when user type : www.mysite.com/redirector.php?=admin/, they can access your admin pages.
    to prevent this, use regex to check the $_GET['url'] first before allowing them to redirect
     
    ads2help, Oct 2, 2008 IP
  3. Sk8TeR

    Sk8TeR Peon

    Messages:
    39
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks alot buddy!!
     
    Sk8TeR, Oct 8, 2008 IP
  4. Nooz

    Nooz Guest

    Best Answers:
    0
    #4
    Beware of hack.
    Add exit; after redirect; !
     
    Nooz, Oct 8, 2008 IP
    webrickco likes this.