nahsorhseda
Member
- Messages
- 116
- Reaction score
- 0
- Points
- 16
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:
<!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