Zoofu Posted August 28, 2009 Share Posted August 28, 2009 <?php $id = mss($_GET['id']); $page = (!$_GET['page'] || $_GET['page'] < 0) ? "1" : $_GET['page']; $page = ceil($page); $limit = 15; $start = $limit; $end = $page*$limit-($limit); if($id){ $sql = "SELECT * FROM `users` WHERE `id`='".$id."'"; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) == 0){ echo "Invalid Path!"; }else { $row = mysql_fetch_assoc($res); $sql2 = "SELECT * FROM `users` WHERE `id`='".$row['id']."'"; $res2 = mysql_query($sql2) or die(mysql_error()); $row2 = mysql_fetch_assoc($res2); if($row2['admin'] == 1 && $admin_user_level == 0){ echo "You do not have permission!"; }else { $amount_check = "SELECT * FROM `users` WHERE `id`='".$id."'"; $amount_check_res = mysql_query($amount_check) or die(mysql_error()); $amount_count = mysql_num_rows($amount_check_res); $pages = ceil($amount_count/$limit); $previous = ($page-1 <= 0) ? "« Prev" : "<a href=\"./index.php?act=browse&page=".($page-1)."\">« Prev</a>"; $nextpage = ($page+1 > $pages) ? "Next »" : "<a href=\"./index.php?act=browse&page=".($page+1)."\">Next »</a>"; echo "<tr><td align=\"right\" colspan=\"2\">\n"; echo "Pages: "; echo $previous; for($i=1;$i<=$pages;$i++){ $href = ($page == $i) ? " ".$i." " : " <a href=\"./index.php?act=browse&page=".$i."\">".$i."</a> "; echo $href; } echo $nextpage; echo "</td></tr>\n"; $select_sql = "SELECT * FROM `users` WHERE `id`='".$id."' ORDER BY id ASC LIMIT ".$end.",".$start.""; $select_res = mysql_query($select_sql) or die(mysql_error()); while($rowr = mysql_fetch_assoc($select_res)){ echo "<tr><td class =\"forum_header\">".$rowr['username']."</td></tr>\n"; } } } }else{ echo "Invalid Path!"; } ?> It just keeps returning Invalid Path! :/ Quote Link to comment Share on other sites More sharing options...
AviNahum Posted August 28, 2009 Share Posted August 28, 2009 i'm not sure, but try this: <?php $id = mss($_GET['id']); $page = (!$_GET['page'] || $_GET['page'] < 0) ? "1" : $_GET['page']; $page = ceil($page); $limit = 15; $start = $limit; $end = $page*$limit-($limit); if(isset($_GET['id'])){ $sql = "SELECT * FROM users WHERE id=".$id.""; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) == 0){ echo "Invalid Path!"; }else { $row = mysql_fetch_assoc($res); $sql2 = "SELECT * FROM `users` WHERE `id`='".$row['id']."'"; $res2 = mysql_query($sql2) or die(mysql_error()); $row2 = mysql_fetch_assoc($res2); if($row2['admin'] == 1 && $admin_user_level == 0){ echo "You do not have permission!"; }else { $amount_check = "SELECT * FROM `users` WHERE `id`='".$id."'"; $amount_check_res = mysql_query($amount_check) or die(mysql_error()); $amount_count = mysql_num_rows($amount_check_res); $pages = ceil($amount_count/$limit); $previous = ($page-1 <= 0) ? "« Prev" : "<a href="./index.php?act=browse&page=".($page-1)."">« Prev</a>"; $nextpage = ($page+1 > $pages) ? "Next »" : "<a href="./index.php?act=browse&page=".($page+1)."">Next »</a>"; echo "<tr><td align="right" colspan="2"> "; echo "Pages: "; echo $previous; for($i=1;$i<=$pages;$i++){ $href = ($page == $i) ? " ".$i." " : " <a href="./index.php?act=browse&page=".$i."">".$i."</a> "; echo $href; } echo $nextpage; echo "</td></tr> "; $select_sql = "SELECT * FROM `users` WHERE `id`='".$id."' ORDER BY id ASC LIMIT ".$end.",".$start.""; $select_res = mysql_query($select_sql) or die(mysql_error()); while($rowr = mysql_fetch_assoc($select_res)){ echo "<tr><td class ="forum_header">".$rowr['username']."</td></tr> "; } } } }else{ echo "Invalid Path!"; } ?> if it's not work, explain what the function mss does Quote Link to comment Share on other sites More sharing options...
Zoofu Posted August 28, 2009 Author Share Posted August 28, 2009 It was the admin_user_level section. <?php $id = mss($_GET['id']); $page = (!$_GET['page'] || $_GET['page'] < 0) ? "1" : $_GET['page']; $page = ceil($page); $limit = 15; $start = $limit; $end = $page*$limit-($limit); if(isset($_GET['id'])){ $sql = "SELECT * FROM users WHERE id=".$id.""; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) == 0){ echo "Invalid Path!"; }else { $row = mysql_fetch_assoc($res); $sql2 = "SELECT * FROM `users` WHERE `id`='".$row['id']."'"; $res2 = mysql_query($sql2) or die(mysql_error()); $row2 = mysql_fetch_assoc($res2); if($row2['admin'] == 1 && $admin_user_level == 0){ echo "You do not have permission!"; }else { $amount_check = "SELECT * FROM `users` WHERE `id`='".$id."'"; $amount_check_res = mysql_query($amount_check) or die(mysql_error()); $amount_count = mysql_num_rows($amount_check_res); $pages = ceil($amount_count/$limit); $previous = ($page-1 <= 0) ? "« Prev" : "<a href=\"./index.php?act=browse&page=".($page-1)."\">« Prev</a>"; $nextpage = ($page+1 > $pages) ? "Next »" : "<a href=\"./index.php?act=browse&page=".($page+1)."\">Next »</a>"; echo "<tr><td align=\"right\" colspan=\"2\">\n"; echo "Pages: "; echo $previous; for($i=1;$i<=$pages;$i++){ $href = ($page == $i) ? " ".$i." " : " <a href=\"./index.php?act=browse&page=".$i."\">".$i."</a> "; echo $href; } echo $nextpage; echo "</td></tr>\n"; $select_sql = "SELECT * FROM `users` WHERE `id`='".$id."' ORDER BY id ASC LIMIT ".$end.",".$start.""; $select_res = mysql_query($select_sql) or die(mysql_error()); while($rowr = mysql_fetch_assoc($select_res)){ echo "<tr><td class =\"forum_header\">".$rowr['username']."</td></tr>\n"; } } } }else{ echo "Invalid Path!"; } ?> Erm.. So.. How come it still won't show anything up? Quote Link to comment Share on other sites More sharing options...
AviNahum Posted August 28, 2009 Share Posted August 28, 2009 i can't see any problems here... umm are you sure you got rows on your users tables? if yes, try this and post here the output: <?php $id = mss($_GET['id']); $page = (!$_GET['page'] || $_GET['page'] < 0) ? "1" : $_GET['page']; $page = ceil($page); $limit = 15; $start = $limit; $end = $page*$limit-($limit); if(isset($_GET['id'])){ $sql = "SELECT * FROM users WHERE id=".$id.""; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) == 0){ echo "Invalid Path!"; echo "<br> no rows"; }else { $row = mysql_fetch_assoc($res); $sql2 = "SELECT * FROM `users` WHERE `id`='".$row['id']."'"; $res2 = mysql_query($sql2) or die(mysql_error()); $row2 = mysql_fetch_assoc($res2); if($row2['admin'] == 1 && $admin_user_level == 0){ echo "You do not have permission!"; }else { $amount_check = "SELECT * FROM `users` WHERE `id`='".$id."'"; $amount_check_res = mysql_query($amount_check) or die(mysql_error()); $amount_count = mysql_num_rows($amount_check_res); $pages = ceil($amount_count/$limit); $previous = ($page-1 <= 0) ? "« Prev" : "<a href=\"./index.php?act=browse&page=".($page-1)."\">« Prev</a>"; $nextpage = ($page+1 > $pages) ? "Next »" : "<a href=\"./index.php?act=browse&page=".($page+1)."\">Next »</a>"; echo "<tr><td align=\"right\" colspan=\"2\">\n"; echo "Pages: "; echo $previous; for($i=1;$i<=$pages;$i++){ $href = ($page == $i) ? " ".$i." " : " <a href=\"./index.php?act=browse&page=".$i."\">".$i."</a> "; echo $href; } echo $nextpage; echo "</td></tr>\n"; $select_sql = "SELECT * FROM `users` WHERE `id`='".$id."' ORDER BY id ASC LIMIT ".$end.",".$start.""; $select_res = mysql_query($select_sql) or die(mysql_error()); while($rowr = mysql_fetch_assoc($select_res)){ echo "<tr><td class =\"forum_header\">".$rowr['username']."</td></tr>\n"; } } } }else{ echo "Invalid Path!"; echo "<br> no id"; } ?> if the ouput will be "Invalid Path! no rows" so you dont have rows in your DB, if it will be "Invalid Path! no id" so i think the problem is in mss function Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.