Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2004
    Posts
    494

    Unanswered: 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;
    ?>
    Compare bible texts (and other tools):
    TheWheelofGod

  2. #2
    Join Date
    May 2008
    Posts
    10

    RE: redirecting page

    Okay, this is very bad for google SEO from what I hear. They don't take too kindly to unfriendly redirects for some reason(s).

    But I'll help you anyway. (meta redirects are especially frowned apon)

    Let me recap, because I kind of lost my thought looking at your code.

    I'll give you a much simpler version of what you're trying to do.

    PHP Code:
    <?php
    $time
    =3//start time
    $page=$_REQUEST['page'];
    if(
    strlen($page)>0) { //If the page redirected already
    $redNum=$page+1//Add 1
    } else {
    $redNum=1//redirected 1 time
    }
    print 
    "Time: $time<br>Redirects: $redNum";
    $url="?page=".$redNum."";
    $thisPage$_SERVER['PHP_SELF'];
    $newURL"$thisPage$url";
    echo 
    "<meta http-equiv='Refresh' content='".$time."; 

    url="
    .$newURL."' />"

    ?>
    I tested it, and it's actually pretty cool. I had to request the page number for it to work. I set the time to 3 seconds, for sake of testing. Works like a charm! Hope you like 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
  •