Making page redirect

Discussion in 'PHP' started by choice, Feb 9, 2008.

  1. #1
    I run a website www.clipbook.us and need to know if something is poss

    when people click on a link to stumble or digg they get taken to my out.php page which looks like this

    what i want to know is what could could i add to the out.php file to make it redirect automatically to the link to be pasted

    here is the entire out.php file

    <?php
     include("vars.php");
     include("dbconnect.php");
     extract($_GET);
     $eredm = mysql_query("SELECT * FROM diggs WHERE did=$id") or die(mysql_error());
     extract(mysql_fetch_array($eredm));
     print("<font face=\"arial\" size=2>Please copy and paste this url to your browser<br /></font>");
     print("<input type=\"text\" size=\"100\" value=\"$dlink\"></input>");
    
    ?>
    Code (markup):

     
    choice, Feb 9, 2008 IP
  2. mvl

    mvl Peon

    Messages:
    147
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Send a Location header instead of printing the url:
    <?php
     include("vars.php");
     include("dbconnect.php");
     extract($_GET);
     $eredm = mysql_query("SELECT * FROM diggs WHERE did=$id") or die(mysql_error());
     extract(mysql_fetch_array($eredm));
    
     header("Location: $dlink");
    ?>
    PHP:
     
    mvl, Feb 9, 2008 IP
    choice likes this.
  3. choice

    choice Prominent Member

    Messages:
    5,444
    Likes Received:
    490
    Best Answers:
    0
    Trophy Points:
    350
    Digital Goods:
    2
    #3
    works perfectly rep added
     
    choice, Feb 9, 2008 IP
  4. mab

    mab Active Member

    Messages:
    563
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    80
    #4
    but don't you think that you have to hide the refer ? because i think digg and the others could ban you and the users ..


    
    
    
    <?php
     include("vars.php");
     include("dbconnect.php");
     extract($_GET);
     $eredm = mysql_query("SELECT * FROM diggs WHERE did=$id") or die(mysql_error());
     extract(mysql_fetch_array($eredm));
    
     header("Location: https://passkeeping.com/redir-x.php?r=$dlink");
    ?>
    
    
    PHP:
    This site help you to hide the refer .. https://passkeeping.com/redir-x.php?r=
    See ya .
    Amin .
    Regards .
     
    mab, Feb 10, 2008 IP
    choice likes this.
  5. choice

    choice Prominent Member

    Messages:
    5,444
    Likes Received:
    490
    Best Answers:
    0
    Trophy Points:
    350
    Digital Goods:
    2
    #5
    good point i have amended my code

    thanks rep added
     
    choice, Feb 10, 2008 IP
  6. paradoxist1

    paradoxist1 Peon

    Messages:
    68
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    another method is to edit your htaccess, so you can have a link like

    yoursite.com/go/digg/
     
    paradoxist1, Feb 10, 2008 IP