Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Mar 2005
    Posts
    735
    Thanks
    4
    Thanked 1 Time in 1 Post

    redirecting page

    My intention for redirecting is to insert data within an online server. Because if the time exceeds 60 seconds everything comes to a pause.

    So instead I decided to add an extension ?page=1 and make the page redirect to ?page=2 and so on.

    And as I test it the very first page it's doing it's job: inserting to the db table. But the next pages directed is not doing at all because it's going too fast.

    I've set the redirecting $time at 480 seconds. But I don't think it's obeying.
    PHP Code:
    <?php
    $time 
    set_time_limit(480);
    /*
    $totalPages=722;
    $url_page= $_GET['page'];
    $num_pages = 100;
    for($thisPage = 1; $thisPage <= $totalPages; $thisPage = $thisPage+$num_pages ){
        $startpage = $thisPage;
    }
    */
    $num_pages 100;
    $totalPages=722;
    $end_url_pageceil($totalPages/$num_pages);
    if (!isset(
    $_GET["page"])) {
      
    $url_page 1;
    } else {
      
    $url_page $_GET["page"];
    }
    //$startpage = (($url_page - 1 ) * $num_pages) + 1;
    $startpage = (isset($_GET['page'])) ? (((int) $_GET['page']) - 1) * $num_pages 1;
    $booklink "be_wise_as_serpents";
    $acronym "bwas2";
    $bookTitle "Be Wise As Serpents";
    $link 'www.iusedtoloveher.com/img/other';
    if (!isset(
    $_GET["page"])) {
        
    $next_url_page 2;
    }else{
        
    $next_url_page $url_page 1;
    }
    $goto "insertindb.php?page=".$next_url_page;
    $gotoIndex "index.php?page_num=1";
    $totaldivs 59;
    include(
    "files/dbconnection.php");
    ?>
    <!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>
    <?
    if($url_page<$end_url_page){
        echo 
    "<meta http-equiv='Refresh' content='".$time."; url=".$goto."' />";
    }else{
        echo 
    "<meta http-equiv='Refresh' content='".$time."; url=".$gotoIndex."' />";
    }
    //echo $time;
    ?>
    Last edited by gilgalbiblewhee; 07-17-2008 at 07:38 PM.

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    I think you are mistaking the purpose of set_time_limit - or at least its implementation. Setting the time limit allows you to bypass the timout for the PHP engine which is why you are using it, but using set_time_limit is a void function - it returns no result. Essentially, $time is a null valued variable that you are using further as a meta refresh value. Instead, use $time instead of assigning to it:
    PHP Code:
    $time 480;
    set_time_limit($time);
    ... 
    Later use $time in youre refreshes
    Hope that helps you to get it working!
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #3
    Regular Coder
    Join Date
    Mar 2005
    Posts
    735
    Thanks
    4
    Thanked 1 Time in 1 Post
    Quote Originally Posted by Fou-Lu View Post
    I think you are mistaking the purpose of set_time_limit - or at least its implementation. Setting the time limit allows you to bypass the timout for the PHP engine which is why you are using it, but using set_time_limit is a void function - it returns no result. Essentially, $time is a null valued variable that you are using further as a meta refresh value. Instead, use $time instead of assigning to it:
    PHP Code:
    $time 480;
    set_time_limit($time);
    ... 
    Later use $time in youre refreshes
    Hope that helps you to get it working!
    Let me get this straight. Like this?
    PHP Code:
    $time 480;
    //set_time_limit($time);
    ...
    if(
    $url_page<$end_url_page){
        echo 
    "<meta http-equiv='Refresh' content='".$time."; url=".$goto."' />";
    }else{
        echo 
    "<meta http-equiv='Refresh' content='".$time."; url=".$gotoIndex."' />";


  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Thats right. You could use a timeout, but I suppose that depends on what you're php is doing in that time. 480 seconds seems like a long time for an actual process, so if you need to see you're timeout that high I would expect a more optimized way could be done. If you have timeout problems by all means change the timeout, but don't leave it infinite so use an actual number (like the 480 seconds).
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)


  •  

    Posting Permissions

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