$5 for giving me fix - extremely annoying small error

Discussion in 'PHP' started by crazyryan, Feb 26, 2007.

  1. #1
    Basically, if you go to http://www.proxy.gd/proxies/proxy.php?id=73 it'll redirect, however when I go to http://www.proxy.gd/proxy/id/73/ it doesn't redirect, it always used to and for some reason it's just stopped. My code is below.

    
    <?
    // We need the database stuff
    require 'config.php';
    if ($_GET['id']) {
    $id = mysql_real_escape_string($_GET['id']);
    // Check ID exists
    $q = "SELECT * from links where link_id = '$id'";
    $res = mysql_query($q) or die("Error in query " . mysql_error());
    $nr = mysql_num_rows($res);
    if ($nr > 0) {
    $data = mysql_fetch_assoc($res);
    mysql_query("UPDATE links set link_visitors = (link_visitors + 1) where link_id = '$id'");
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>You are being redirected to <?php echo " " . $data['link_title'] . " "; ?> now.</title>
    <!-- Begin Publisher Code -->
    <script src='http://www.adversalservers.com/publisherJS.js'></script>
    <script type='text/javascript' language='javascript'>
    initAdversal('2c908c519fb86e4e0f9158fadddfb82c', true);
    </script>
    <!-- End Publisher Code -->
    <link href="http://www.proxy.gd/style/style.css" rel="stylesheet" type="text/css" />
    <!--[if IE]>
        <link href="http://www.proxy.gd/style/ieBugs.css" rel="stylesheet" type="text/css" />
    <![endif-->
    </head>
    
    <div id="border">
    <div id="wrapper"><?php
    echo "<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url= " . $data['link_url'] . "\">
    <p class=\"box\" align=\"center\">You are being redirected to " . $data['link_title'] . " now.<br /><br /></p>";
    exit();
    }
    else {
    echo "Invalid ID";
    }
    }
    else {
    echo "No ID specified";
    }
    ?>
    
    
    </div></div>
    <body>
    </body>
    </html>
    PHP:
    I'm not sure if this is a PHP error or mod_rewrite error, although I can't think of it being a mod_rewrite error ..

    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule proxy/(.*)/(.*)/$ /proxies/proxy.php?$1=$2

    Is my mod_rewrite code. If you can help me fix this and get the mod_rewrited url working I'll send you $5 via paypal, thanks.
     
    crazyryan, Feb 26, 2007 IP
  2. m0nkeymafia

    m0nkeymafia Well-Known Member

    Messages:
    399
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    125
    #2
    If i were you I would use print_r on your $_GET variable inside the php see what is being passed from apache

    Its probably a typo or something daft like that
    Let me know if that helps
     
    m0nkeymafia, Feb 26, 2007 IP
  3. crazyryan

    crazyryan Well-Known Member

    Messages:
    3,087
    Likes Received:
    165
    Best Answers:
    0
    Trophy Points:
    175
    #3
    How would I use print_r on the get variable, lol :(
     
    crazyryan, Feb 26, 2007 IP
  4. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #4
    
    
    print_r($_GET);
    
    
    PHP:
     
    nico_swd, Feb 26, 2007 IP
  5. crazyryan

    crazyryan Well-Known Member

    Messages:
    3,087
    Likes Received:
    165
    Best Answers:
    0
    Trophy Points:
    175
    #5
    Fixed it, I had something else in my .htaccess that must have been interfering with it.
     
    crazyryan, Feb 26, 2007 IP
  6. m0nkeymafia

    m0nkeymafia Well-Known Member

    Messages:
    399
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    125
    #6
    give urself $5 then lol :)
     
    m0nkeymafia, Feb 26, 2007 IP