Guest User

Untitled

a guest
Jan 23rd, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.38 KB | None | 0 0
  1. <?php
  2. session_start();
  3. error_reporting(-1);
  4. include 'connect.php';
  5.  
  6. if (!isset($_SESSION['username'])) {
  7. die( '                                                                            <form action="login.php" method="post">
  8.                                                                                <label for="username">username: </label>
  9.                                                                                <input type="text"  name="username" maxlength="255" value="">
  10.                                                                                <label for="password">password: </label>
  11.                                                                                <input type="password"  name="password" maxlength="255" value="">
  12.                                                                                <input type="submit" value="login">
  13.                                                                            </form>'); }
  14.                                                                             else {
  15.                                                                            
  16. if($_SESSION['signed_in'] == false | $_SESSION['user_level'] != 1 )
  17. {
  18.     //the user is not an admin
  19.     die ('Sorry, you do not have sufficient rights to access this page.');
  20.  }
  21. else
  22. {
  23. $sql = "select * from users where users.id = " . $_GET['user_id'];
  24. $result = mysqli_query($link,$sql);
  25. if(!$result)
  26. {
  27.     die ('The applicant profile could not be displayed, please try again later.') . mysqli_error($link);
  28. }
  29. else
  30. {
  31.     if(mysqli_num_rows($result) == 0)
  32.     {
  33.         die ('This applicant profile does not exist.');
  34.     }
  35.     else
  36.     {
  37. while($row = mysqli_fetch_assoc($result)) {
  38. if ($row['user_level'] == -1) { echo ('Well, what can i say? this user has aleady been banned, you need to take pills old man'); }
  39.  
  40. if ($row['user_level'] == 2 || $_SESSION['user_level'] == 3) { $regsql = "UPDATE `dead_echo`.`users` SET `user_level` = '-1' WHERE `users`.`id` =".$_GET['user_id'];
  41. mysqli_query($link,$regsql); }
  42.  
  43. if ($row['user_level'] == 3) { die ('Nice try pal, but this user is god! oh and by the way, he will be notified that you tried to ban him :)'); }
  44.  
  45. if ($row['user_level'] == 2) { die ('Nice try pal, but this user is an admin :)'); }
  46.  
  47.  
  48. if ($row['user_level'] == 0) {  
  49. $regsql = "UPDATE `dead_echo`.`users` SET `user_level` = '-1' WHERE `users`.`id` =".$_GET['user_id'];
  50. mysqli_query($link,$regsql); }
  51.        
  52.        
  53. } } } } }
  54.  
  55. die ('Put down yo guns penguins, all went according to plan!');
  56. ?>
Add Comment
Please, Sign In to add comment