Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Join Date
    Sep 2006
    Location
    Evanston, Illinois.
    Posts
    2,361
    Tokens
    0

    Latest Awards:

    Default Cant view 2nd page of users [PHP]

    heres my code the error is when I try to click users page 2 nothing happens
    PHP Code:
    <?php
    include ("includes/header.php");
    session_start();
    //check if the user is logged in in the 1st place
    if(isset($_SESSION['isadmin']))
    {
     
    $ID $_GET['ID'];
     
    $act $_GET['act'];
     if(isset (
    $ID))
     {
      if (
    $act == "delete")
      {
             
    $command2 "Delete from ext_users where ID='$ID'";
             
    mysql_query($command2)
        or die(
    $db_error);
       print 
    "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>Success!</b></font></center><p align=\"center\">User deleted!</p>";
       print 
    "<p align=\"center\"><a href=\"usercp.php\">Continue</a></p>";
      }
      else if (
    $act == "ban")
      {
       
    $command "update ext_users set banned='1' where ID='$ID'";
       
    mysql_query($command)
        or die(
    $db_error);
       print 
    "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>Success!</b></font></center><p align=\"center\">User has been banned!</p>";
       print 
    "<p align=\"center\"><a href=\"usercp.php\">Continue</a></p>";
      }
      else if (
    $act == "unban")
      {
       
    $command "update ext_users set banned='0' where ID='$ID'";
       
    mysql_query($command)
        or die(
    $db_error);
       print 
    "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>Success!</b></font></center><p align=\"center\">User has been unbanned!</p>";
       print 
    "<p align=\"center\"><a href=\"usercp.php\">Continue</a></p>";
      }
      else if(
    $act == "makemod")
      {
       
    $command "update ext_users set ismod='1' where ID='$ID'";
       
    mysql_query($command)
        or die(
    $db_error);
       print 
    "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>Success!</b></font></center><p align=\"center\">User added as a game mod!</p>";
       print 
    "<p align=\"center\"><a href=\"usercp.php\">Continue</a></p>";
      }
      else if(
    $act == "delmod")
      {
       
    $command "update ext_users set ismod='0' where ID='$ID'";
       
    mysql_query($command)
        or die(
    $db_error);
       print 
    "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>Success!</b></font></center><p align=\"center\">User removed as a game mod!</p>";
       print 
    "<p align=\"center\"><a href=\"usercp.php\">Continue</a></p>";
      }
      else
      {
       print 
    "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>Error!</b></font></center><p align=\"center\">Please follow the links in the control panel</p>";
       print 
    "<p align=\"center\"><a href=\"usercp.php\">Continue</a></p>";
      }
     }   
     else
     {
      print 
    "<table width=\"100%\" cellpadding=\"5px\" align=\"center\" border=\"1\" style=\"border-style:dashed; border-width:thin; border-collapse:collapse;\" cellspacing=\"0px\">";
      print 
    "<caption style=\"font-family:Arial, Helvetica, sans-serif; font-weight:bold; font-size:12px\">Users</caption>";
            print 
    "<center>All users listed in ABC order</center>";
            global 
    $start;
            if(!isset(
    $start))
            {
               
    $start=0;
            }
            
    $command1 "SELECT * from ext_users order by playername ASC limit $start, 10 ";
            
    $query1 mysql_query($command1)
       or die(
    $db_error);
            print 
    "<tr><td>Username</td><td>E-mail</td><td>Level</td><td>Honor</td><td>Gold</td><td>Last Online</td><td>Last IP</td><td>Action</td></tr>";
            while(
    $playerinfo mysql_fetch_array($query1))
            {
              
    $time getdate($playerinfo['ontime']);
       if (
    $playerinfo['ismod'])
       {
        
    $lastlink "<a href=\"usercp.php?ID=".$playerinfo['ID']."&act=delmod\">Remove Mod</a>";
       }
       else if (
    $playerinfo['admin'])
       {
        
    $lastlink "<s>Make Mod</s>";
       }
       else
       {
        
    $lastlink "<a href=\"usercp.php?ID=".$playerinfo['ID']."&act=makemod\">Make Mod</a>";
       }
       if (
    $playerinfo['banned'])
       {
        
    $link "<a href=\"usercp.php?ID=".$playerinfo['ID']."&act=unban\">UnBan</a>";
       }
       else if (
    $playerinfo['admin'])
       {
        
    $link "<s>Ban</s>";
       }
       else
       {
        
    $link "<a href=\"usercp.php?ID=".$playerinfo['ID']."&act=ban\">Ban</a>";
       }
       print 
    "<tr><td>".$playerinfo['playername']."</td><td>".$playerinfo['email']."</td><td>".$playerinfo['lvl']."</td><td>".$playerinfo['honor']."</td><td>".$playerinfo['gold']."</td><td>".$time['mday']." ".$time['month']." ".$time['year']."</td><td>".$playerinfo['lastip']."</td><td><a href=\"usercp.php?ID=".$playerinfo['ID']."&act=delete\">Delete</a> | ".$link." | ".$lastlink."</td></tr>";
            }
            print 
    "</table>";  
      
    $command1 "SELECT * from ext_users";
      
    $query1 mysql_query($command1);
      
    $d=0;
      
    $f=0;
      
    $g=1;
      print 
    "Page: ";
      while(
    $result1 mysql_fetch_array($query1))
      {
       if(
    $f%10 == 0)
       {
           print 
    "[<a href=\"usercp.php?start=$d\">$g</a>] ";
           
    $g++;
       }
       
    $d=$d+1;
       
    $f++;
      }  
      
    $count mysql_num_rows($query1);
      print 
    "<br /><br />No. of users:".$count;   
     }
    }
    //if user is not logged in
    else
    {
     print 
    "<script language=\"Javascript\">alert(\"You are not logged in!\");</script>";
     print 
    "<meta http-equiv=\"refresh\" content=\"0; url=$path/index.php\" />";
     print 
    "<center><a href=\"index.php\">Continue to homepage if browser doesn't redirect you</a></center>";
     
    }
    include (
    "includes/footer.php");
    ?>
    How could this hapen to meeeeeeeeeeeeeee?lol.

  2. #2
    Join Date
    Jan 2007
    Location
    Canada eh?
    Posts
    766
    Tokens
    75

    Default

    Ugh.... it's hideous!!! Your SQL is just plain wrong!!! Below is an example of a properly formatted query....

    Code:
    $result = mysql_query(SELECT * FROM * WHERE * = '*' ORDER BY *) or die(mysql_error());
    Notice how firstly I have an or die statement at the end which basically says if there's an error tell me what and where (always good for development phase) and how my query is in CAPS!!

    And as for the problem... I have no idea... but I just couldn't let the query format go.. its just so wrong!!

  3. #3
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    He didnt code it, so..yeah.

  4. #4
    Join Date
    Sep 2006
    Location
    Evanston, Illinois.
    Posts
    2,361
    Tokens
    0

    Latest Awards:

    Default

    lol i did Invent, i recoded the entire thing thats why alot of things arn't eally working, i hadtocuz everyone flamed me if i didn't.. kkill change sql queries
    How could this hapen to meeeeeeeeeeeeeee?lol.

  5. #5
    Join Date
    Oct 2006
    Location
    Peterborough, UK
    Posts
    3,855
    Tokens
    216

    Latest Awards:

    Default

    Quote Originally Posted by Scriptz View Post
    Ugh.... it's hideous!!! Your SQL is just plain wrong!!! Below is an example of a properly formatted query....

    Code:
    $result = mysql_query(SELECT * FROM * WHERE * = '*' ORDER BY *) or die(mysql_error());
    Both yours and his are correctly formatted, here's how I do mine:
    PHP Code:
    $sql mysql_query("SELECT `blah` FROM `noodles` WHERE `waffles` = 'bagels' AND `bagels` = 'nice' ORDER BY `sugar` DESC"); 
    Quote Originally Posted by Scriptz View Post
    Notice how firstly I have an or die statement at the end which basically says if there's an error tell me what and where (always good for development phase) and how my query is in CAPS!!
    Again, both yours and his queries are correct

    Quote Originally Posted by Scriptz View Post
    And as for the problem... I have no idea... but I just couldn't let the query format go.. its just so wrong!!
    The problem is this:
    You aren't setting $start properly, you have this:

    PHP Code:
    if(!isset($start))
            {
               
    $start=0;
            } 
    Yet you never specify what to do when it's set
    try this:
    PHP Code:
    if(!isset($_GET["start"]) || !is_numerical($_GET["start"]))
    {
        
    $start "0";
    }
    else
    {
        
    $start $_GET["start"];

    That should do ya for.


    visit my internet web site on the internet
    http://dong.engineer/
    it is just videos by bill wurtz videos you have been warned

  6. #6
    Join Date
    Sep 2006
    Location
    Evanston, Illinois.
    Posts
    2,361
    Tokens
    0

    Latest Awards:

    Default

    Lolcoptrs good code +rep
    I use a and or die statement test for errors then delete it all, but there were no sql errors, only wierd errors ;P
    Also, im looking at some, css etc but i don't want to change every aspect is there any program that ill look through load of files and findand replac certain lines, because you can only go so far without changing html within the php
    How could this hapen to meeeeeeeeeeeeeee?lol.

  7. #7
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default

    Heres a SQL query to select records 10-20 for example..

    SELECT * FROM table WHERE something='something' LIMIT 9,10

  8. #8
    Join Date
    Sep 2006
    Location
    Evanston, Illinois.
    Posts
    2,361
    Tokens
    0

    Latest Awards:

    Default

    argh i thought is_numerical would make it work, it gave it a fatal error. as said apparently is_numerical isn't a defined function..?
    How could this hapen to meeeeeeeeeeeeeee?lol.

  9. #9
    Join Date
    Sep 2006
    Location
    Evanston, Illinois.
    Posts
    2,361
    Tokens
    0

    Latest Awards:

    Default

    erm.. help? been 15 mod + dont -rep me it hs been 15.
    How could this hapen to meeeeeeeeeeeeeee?lol.

  10. #10
    Join Date
    Sep 2006
    Location
    Evanston, Illinois.
    Posts
    2,361
    Tokens
    0

    Latest Awards:

    Default

    been another 15 minutes //
    How could this hapen to meeeeeeeeeeeeeee?lol.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •