redirecting page

Discussion in 'PHP' started by gilgalbiblewheel, Jul 17, 2008.

  1. #1
    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
    $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_page= ceil($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 : 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;
    ?>
    PHP:
     
    gilgalbiblewheel, Jul 17, 2008 IP
  2. tehgamecat

    tehgamecat Peon

    Messages:
    64
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Can you not use a cron job or run it locally on a server you can control.
     
    tehgamecat, Jul 17, 2008 IP
  3. gilgalbiblewheel

    gilgalbiblewheel Well-Known Member

    Messages:
    435
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #3
    Say that again? In different words.
    How can I control?
     
    gilgalbiblewheel, Jul 17, 2008 IP