Closed Thread
Results 1 to 6 of 6

Thread: php next page error

  1. #1
    nahsorhseda's Avatar
    nahsorhseda is offline x10 Sophmore nahsorhseda is an unknown quantity at this point
    Join Date
    Oct 2007
    Location
    mumbai
    Posts
    116

    php next page error

    i have a php script whrein it shows all my files in the particular folder{similar to wapbuddy}

    files per page is set to 10,so when i click the next button the page just refrehes and shows me the same page where i was before

    for example: if i was in this page http;//xyz.com/abc.php?page=1
    when i click the next button i land in this page http;//xyz.com/abc.php?page=2 but the content remains the same

    i had the same problem before when i was using php basic ,but i solved it by adding a php.ini file with "register_globals = on" in the same directory

    but now i have upgraded to php intermediate and the problem appeared again now it doesnt get solved by even the php.ini file


    here the php code that i used
    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>





    <title>my personal pics</title><body>
    <?
    // SETTTINGS
    $conf["site_name"] = "NAHSORHSEDA"// the name of your site
    $conf["welcome_message"] = "hi check my pictures"// default greeting

    $conf["items_per_page"] = 10;



    ?>

    <?php
    if (!isset($page)) {$page 0;}
    $total 0;

    if(!(
    $dp opendir("./"))) die ("Cannot open ./");
    $file_array = array(); 
    while (
    $file readdir ($dp))
    {
    if(
    substr($file,0,1) != '.' and $file != "index.php" and $file != "search.php")
    {
    $file_array[] = $file;
    }
    }
    $file_count count ($file_array);
    sort ($file_array);
    ?>
    </head>
    <body bgcolor="#000000" text="#00FF00" link="#FFFFFF" vlink="#FF0000" alink="#FFFFFF">

    <img src='http://c.wen.ru/256908.wbmp?Nahsorhsed' alt='Создай сайт! Create site!'/><br/>
    <big>NAHSORHSEDA</big><br/>



    <?

    echo "<small>";

    echo 
    "<b><u>MY PERSONAL PICTURES</u></b><br/>";

    if (
    $file_count 0)
    {
    $first_record $page $conf["items_per_page"];
    $last_record $first_record $conf["items_per_page"];

    while (list(
    $fileIndexValue$file_name) = each ($file_array))
    {

    if ((
    $fileIndexValue >= $first_record) AND ($fileIndexValue $last_record))
    {

    echo 
    "<a href=\"$file_name\">$file_name</a> ("round(filesize($file_name)/1024,1) . "kb)<br/>------<br/>";
    $total $total filesize($file_name);
    }
    }

    if ((
    $file_count 0) AND ($page != 0))
    {
    // previous button
    $prev_page $page -1;
    echo 
    "<br/><a href=\"".$_SERVER["PHP_SELF"]."?page=$prev_page\">Prev Page</a><br/>";
    }


    if ((
    $file_count 0) AND ($last_record $file_count))
    {
    // next button
    $next_page $page 1;
    echo 
    "<br/><a href=\"".$_SERVER["PHP_SELF"]."?page=$next_page\">Next Page</a><br/>";
    }
    echo 
    "<br/>Total Files:<br/>$file_count ";
    if (
    $file_count == 1)
    {echo 
    "file";}
    else
    {echo 
    "files";}

    echo 
    " (" round($total/1024,1) . "kb)";
    }
    closedir($dp);
    echo 
    "</small>";
    ?>
    <br/>
    <?
    echo '<form action="process.php" method="post">'
              
    .'search file: <input name="q" title="search:" size="5" maxlength="99999999999"/><br/>'
              
    .'<input type="submit" value="go"/></form>' ?>


    <small>page:<? echo"$page"?></small><br/>
    <?
    echo '<form action="'.$_SERVER["PHP_SELF"].'" method="get">'
              
    .'Jump to Page: <input name="page" title="Jump to Page:" size="3" maxlength="3"/><br/>'
              
    .'<input type="submit" value="Jump"/></form>' ?>


    </p>
    </body>
    </html>
    and thnks in advance
    glad to resolve problems in c++ n php

  2. #2
    Bryon is offline Administrator Bryon has disabled reputation
    Join Date
    Apr 2005
    Location
    Northfield, NH
    Posts
    7,608

    Re: php next page error

    PHP has register globals turned off. You're having this problem because of this.

    More information regarding register globals: http://us.php.net/register_globals

    Instead of relying on register_globals, you will need to use the GET/POST/Cookie/Server/Environment super global variables.

    http://us.php.net/manual/en/reserved....variables.get
    http://us.php.net/manual/en/reserved...variables.post

    For example:

    If you were doing something like calling
    Code:
    site.com/script.php?page=2
    and then using $page in your script, you need to now use $_GET['page']. If you're unsure of what I mean or need further help, let us know.

  3. #3
    nahsorhseda's Avatar
    nahsorhseda is offline x10 Sophmore nahsorhseda is an unknown quantity at this point
    Join Date
    Oct 2007
    Location
    mumbai
    Posts
    116

    Re: php next page error

    i really did not understand what you meant ,coz iam just a beginner
    could you please tell me what do i have to do with my code ,i mean what changes should i bring, please make me understand in a lay mans language ,coz i really know nothing about php

    and thnks for replying
    glad to resolve problems in c++ n php

  4. #4
    Corey's Avatar
    Corey is offline VPS Migration Professional Corey is a glorious beacon of lightCorey is a glorious beacon of light
    Join Date
    Dec 2004
    Location
    Northfield, NH
    Posts
    17,151

    Re: php next page error

    Where did you get your script from?

    If you created it yourself you should start learning how to code without the need for register_globals. It is not being included in PHP6 because of the security risks that it has.
    Corey Arbogast | CEO
    █ 888-X10-9668 - corey[@]x10hosting.com
    x10Hosting - Giving Away Hosting Since 2004
    Premium Hosting | VPS Services

  5. #5
    nahsorhseda's Avatar
    nahsorhseda is offline x10 Sophmore nahsorhseda is an unknown quantity at this point
    Join Date
    Oct 2007
    Location
    mumbai
    Posts
    116

    Re: php next page error

    i did not create the script ,it was one of my friend ,it was working fine before and there fore i relied on register globals ,but since i change the php version the error started to occur.


    if you cold only tell me what should i change in my script ill highly appreciate it ,
    glad to resolve problems in c++ n php

  6. #6
    nahsorhseda's Avatar
    nahsorhseda is offline x10 Sophmore nahsorhseda is an unknown quantity at this point
    Join Date
    Oct 2007
    Location
    mumbai
    Posts
    116

    Re: php next page error

    i got the solution check the below link for solution

    http://forums.x10hosting.com/marketp...php+page+error
    glad to resolve problems in c++ n php

Closed Thread

Similar Threads

  1. Sigo con problemas con phpbb2
    By reciecho in forum Soporte
    Replies: 7
    Last Post: 10-20-2007, 06:28 PM
  2. php error
    By joosttiske in forum Free Hosting
    Replies: 3
    Last Post: 09-30-2007, 11:48 AM
  3. error page
    By darkwind2121 in forum Free Hosting
    Replies: 4
    Last Post: 09-23-2007, 10:13 AM
  4. 500 Error Page
    By profper in forum Free Hosting
    Replies: 2
    Last Post: 09-11-2007, 09:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers