Closed Thread
Results 1 to 7 of 7

Thread: earn easy 100 points for helping me (topic-php)

  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

    earn easy 100 points for helping me (topic-php)

    this topic was posted before in free hosting but no one is intrested in helping me thats why iam posting it here .

    credits:100


    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>
    i know this error is caused because the register global is turned off
    if you know how to solve it just copy the code and edit it and post it here
    if you get it right ill pay you 100 credits


    and if you explain/teach me how this php code works {coz this code is edited by my friend} ill pay you extra 50 credits

    .............do it fast before someone else gets it right
    glad to resolve problems in c++ n php

  2. #2
    Thewinator is offline x10 Lieutenant Thewinator is an unknown quantity at this point
    Join Date
    Oct 2007
    Location
    [NL]
    Posts
    256

    Re: earn easy 100 points for helping me (topic-php)

    PHP Code:
    if (!isset($page)) {$page 0;} 
    Since the ?page=* is a get variable you need to set it.
    PHP Code:
    if(!isset($_GET['page'])){$page 0;}else{$page $_GET['page'];} 
    As for telling you how it works, I'll add you on msn or xfire.
    Pm me with your email/username.
    Last edited by Thewinator; 11-23-2007 at 04:09 AM.



  3. #3
    Slothie's Avatar
    Slothie is offline Lord Of The Keys Slothie is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Singapore
    Posts
    1,432

    Re: earn easy 100 points for helping me (topic-php)

    Or an even easier way to 'fix' all your pages is just to add the following code on top.

    PHP Code:
    extract($_REQUEST); 
    That way you do not have to modify existing code and potentially miss out anything

    Easiest 70 points you'll make on x10

    Feel free to add my reputation by clicking on the if you found my post helpful to you :P


    If I am not responding to your PMs, that means I am ignoring you. Take a hint.



    09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0


  4. #4
    Thewinator is offline x10 Lieutenant Thewinator is an unknown quantity at this point
    Join Date
    Oct 2007
    Location
    [NL]
    Posts
    256

    Re: earn easy 100 points for helping me (topic-php)

    Believe me my method works with the code above.
    Also you might want to add one more argument to that.
    For instance if I linked to the page and use ?conf=nowai
    It would resolve in a blank welcome, broken links and no files will be show.

    If you do want to use that I would change that to
    PHP Code:
    extract($_REQUESTEXTR_SKIP); 
    Becouse we know it wont need to overide values this will work without further editing your code.
    Last edited by Thewinator; 11-23-2007 at 05:36 AM.



  5. #5
    Slothie's Avatar
    Slothie is offline Lord Of The Keys Slothie is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Singapore
    Posts
    1,432

    Re: earn easy 100 points for helping me (topic-php)

    I didn't bother reading much except that he needs globals on.

    That line of code I gave him gave him exactly that. Giving him an extra prefix somewhere might screw things up somewhere later if the author of the script had something that relied on it.




    Then again, let the OP chooses what he want

    Easiest 70 points you'll make on x10

    Feel free to add my reputation by clicking on the if you found my post helpful to you :P


    If I am not responding to your PMs, that means I am ignoring you. Take a hint.



    09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0


  6. #6
    Thewinator is offline x10 Lieutenant Thewinator is an unknown quantity at this point
    Join Date
    Oct 2007
    Location
    [NL]
    Posts
    256

    Re: earn easy 100 points for helping me (topic-php)

    Well I read the rest of the script and it needs just the $_GET['page'].
    So all three methods would work except for the not prefixed or skipped one can corrupt the variables needed.



  7. #7
    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: earn easy 100 points for helping me (topic-php)

    hey thanks guys .....all the methods worked but i cant give 100 credits to all


    iam givin my 100 credits to slothie because i need not have to change my coding and it worked perfectly fine

    well for you thewinator ill be sending you 50 credits coz u were the first one to help me ,i really appreciate it , (no need of explaining the code to me ,my friend helped me out)


    thats all......hey and also tell me how do i close this topic .............
    glad to resolve problems in c++ n php

Closed Thread

Similar Threads

  1. [PHP] Variables in PHP
    By Bryon in forum Tutorials
    Replies: 15
    Last Post: 01-29-2009, 09:46 AM
  2. tons of PHP Resources
    By Chris S in forum Scripts & 3rd Party Apps
    Replies: 10
    Last Post: 01-16-2009, 10:07 AM
  3. [PHP] PHP For Starters
    By Complex in forum Tutorials
    Replies: 24
    Last Post: 06-14-2008, 11:40 PM
  4. Unstand PHP?
    By o0slowpaul0o in forum Tutorials
    Replies: 8
    Last Post: 01-07-2008, 09:16 PM
  5. PHP Coding For Points
    By [TX]-Ghost in forum The Marketplace
    Replies: 3
    Last Post: 11-26-2007, 09:22 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