SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Steve Benjamins tnrstudios's Avatar
    Join Date
    Jun 2003
    Location
    canada
    Posts
    367
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re-Directing Difficulties

    Hi I am having some difficulties re-directing...this is my code:

    <html>
    <head>

    <?php

    $connection = mysql_connect ("localhost", "tnrstudi", "iliketeri");
    if ($connection == false) {
    echo mysql_errno().": ".mysql_error()."<BR>";
    exit;
    }

    $query = "select * from exp_dl_files where id=".$id;
    $result = mysql_db_query ("tnrstudios", $query);

    if ($result) {

    $name = mysql_result ($result, $i, "name");
    $subcat = mysql_result ($result, $i, "subcat");
    $preview_url = mysql_result ($result, $i, "preview_url");
    $counter = mysql_result ($result, $i, "counter");
    $description = mysql_result ($result, $i, "description");
    $date = mysql_result ($result, $i, "date");
    $id = mysql_result ($result, $i, "id");

    echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"5; URL=html-$dl_url\">";


    } else {
    echo mysql_errno().": ".mysql_error()."";
    }

    mysql_close ();

    ?>




    <title>Downloading..</title>


    </head>
    <body topmargin=0 leftmargin=0 bgcolor=555555>

    <h2>Redirecting...

    <?php

    $connection = mysql_connect ("localhost", "tnrstudi", "iliketeri");
    if ($connection == false) {
    echo mysql_errno().": ".mysql_error()."<BR>";
    exit;
    }

    $query = "select * from exp_dl_files where id=".$id;
    $result = mysql_db_query ("tnrstudios", $query);

    if ($result) {

    $name = mysql_result ($result, $i, "name");
    $subcat = mysql_result ($result, $i, "subcat");
    $preview_url = mysql_result ($result, $i, "preview_url");
    $counter = mysql_result ($result, $i, "counter");
    $description = mysql_result ($result, $i, "description");
    $date = mysql_result ($result, $i, "date");
    $id = mysql_result ($result, $i, "id");

    echo "to $dl_url<br><br>$name";


    } else {
    echo mysql_errno().": ".mysql_error()."";
    }

    mysql_close ();
    ?>


    </body>
    </html>
    but for some reason it never re-directs to $dl_url....its as if $dl_url is empty, and I know it isnt

  2. #2
    This is all Mumbo Jumbo Amit's Avatar
    Join Date
    Oct 2001
    Location
    New Delhi, India
    Posts
    277
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First try changing it to the following and try, whether it is working with a test page,
    Code:
    "<META HTTP-EQUIV='Refresh' CONTENT='5; URL=test.html'>";
    If it is working, try
    Code:
    echo $dl_url;
    and make sure that it is not empty, then try it
    Code:
    "<META HTTP-EQUIV='Refresh' CONTENT='5; URL=$dl_url'>";
    HTH!

  3. #3
    La la la la la bronze trophy lieut_data's Avatar
    Join Date
    Jun 2003
    Location
    Waterloo, ON
    Posts
    1,517
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You may want to consider using the header function to cause redirects:
    PHP Code:
    function redirect ($url) {
        
    header ("Status: 302 Redirect");
        
    header ("Location: " $url);
        exit;

    Just be sure to call this function before anything else is sent to the browser (including the <html><head> tags).
    My name is Steve, and I'm a super-villian.


Bookmarks

Posting Permissions

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