Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.05 KB | None | 0 0
  1. <?php
  2. include_once("include/connection.php");
  3. $sql = 'select * from USERS where Privileges != "4"';
  4.  
  5. $rs = mysqli_query($connect, $sql) or die ("error");
  6. $op = mysqli_num_rows($rs);
  7.  
  8. while($row = mysqli_fetch_array($rs))
  9. {
  10. $id = $row['ID'];
  11. $name = $row['Name'];
  12. $priv = $row['Privileges'];
  13.  
  14. $sql = 'select * from Status where ID="$id"';
  15. $result = mysqli_query($connect, $sql) or die ("database error");
  16. $gmon = mysqli_num_rows($result);
  17.  
  18. $login = $row['Login'];
  19.  
  20. switch($login)
  21. {
  22. case "ONLINE":
  23. $login = "<font color="#84FB84"><strong>".$name."</strong></font>";
  24. break;
  25. case "OFFLINE":
  26. $login = "<font color="#46AAEB"><strong>".$name."</strong></font>";
  27. break;
  28. }
  29. $online_adms .= "<td>$login</td>";
  30. }
  31. ?>
  32. <?php echo $online_adms; ?>
  33.  
  34. $sql = 'SELECT c.Name, c.ID, c.Privileges, d.Login FROM USERS c
  35. INNER JOIN Status d
  36. ON c.ID = d.ID
  37. where Privileges != 4';
  38.  
  39. SELECT `ID`,`Name`,`Privileges`,`Login`
  40. FROM `USERS`
  41. INNER JOIN `Status`
  42. ON `USERS`.`ID` = `Status`.`ID`
  43. WHERE Privileges != 4
  44.  
  45. $sql = 'select * from USERS where Privileges != "4"';
  46.  
  47. $rs = mysqli_query($connect, $sql) or die ("error");
  48. $op = mysqli_num_rows($rs);
  49.  
  50. while($row = mysqli_fetch_array($rs))
  51. {
  52. $id = $row['ID'];
  53. $name = $row['Name'];
  54. $priv = $row['Privileges'];
  55.  
  56. $sql = 'select * from Status where ID="$id"';
  57. $result = mysqli_query($connect, $sql) or die ("database error");
  58. $gmon = mysqli_num_rows($result);
  59.  
  60. $login = $row['Login'];
  61.  
  62. switch($login)
  63. {
  64. case "ONLINE":
  65. $login = "<font color="#84FB84"><strong>".$name."</strong></font>";
  66. break;
  67. case "OFFLINE":
  68. $login = "<font color="#46AAEB"><strong>".$name."</strong></font>";
  69. break;
  70. default:
  71. $login = 'OOPS! The value of $login is '.$login.' that is why nothing is being printed. :(';
  72. }
  73. }
  74.  
  75. $result = mysqli_query($connect, $sql) or die ("database error");
  76.  
  77. $result = mysqli_query($connect, $sql) or die ("database error: ".mysql_error().'<br />query: '.$sql);
  78.  
  79. <?php
  80. include_once("include/connection.php");
  81. $sql = 'SELECT USERS.*, STATUS.* FROM USERS INNER JOIN STATUS ';
  82. $sql .= 'ON USERS.ID=STATUS.ID WHERE USERS.Privileges != "4"';
  83.  
  84. $rs = mysqli_query($connect, $sql) or die ("error");
  85. $op = mysqli_num_rows($rs);
  86.  
  87. while($row = mysqli_fetch_array($rs))
  88. {
  89. $id = $row['ID'];
  90. $name = $row['Name'];
  91. $priv = $row['Privileges'];
  92. $login = "<font color="#46AAEB"><strong>".$name."</strong></font>";
  93. $loginStatus = $row['Login'];
  94.  
  95. switch($loginStatus)
  96. {
  97. case "ONLINE":
  98. $login = "<font color="#84FB84"><strong>".$name."</strong></font>";
  99. break;
  100. case "OFFLINE":
  101. $login = "<font color="#46AAEB"><strong>".$name."</strong></font>";
  102. break;
  103. default:
  104. $login = "<font color="#999999"><strong>".$name."</strong></font>";
  105. break;
  106. }
  107. $online_adms .= "<td>$login</td>";
  108. }
  109. ?>
  110. <?php echo $online_adms; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement