Advertisement
Guest User

Untitled

a guest
Jul 5th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.49 KB | None | 0 0
  1. <?php ob_start();
  2. session_start();
  3. include("core/head.php");
  4.  
  5. ?>
  6.  
  7.  
  8.  
  9. <div class="container">
  10. <h1>
  11. <a href="/"><i class="icon-arrow-left-3 fg-darker smaller"></i></a> Login<small class="on-right"></small>
  12. </h1>
  13.  
  14. <div class="span7 offset3">
  15. <?php
  16. $form = "
  17. <form action=\"login.php\" method=\"post\">
  18. <p>Name</p>
  19. <div class=\"input-control text\">
  20. <input type=\"text\" value=\"\" placeholder=\"officer id\" name=\"name\"/>
  21. <button class=\"btn-clear\"></button>
  22. </div>
  23.  
  24. </p>Password</p>
  25. <div class=\"input-control password\">
  26. <input type=\"password\" value=\"\" placeholder=\"officer password\" name=\"password\"/>
  27. <button class=\"btn-reveal\"></button>
  28. </div>
  29.  
  30. <input type=\"submit\" name=\"loginbutton\" value=\"Authorize\">
  31. </form>";
  32.  
  33.  
  34. if (isset($_SESSION['name'])){
  35. echo "Hi $name , you're already logged in! You might also be seeing this page if you don't have the sufficient permission to access a page!";
  36. }
  37. else{
  38.  
  39. if(isSet($_POST['loginbutton'])){
  40. $user = $_POST['name'];
  41. $password = $_POST['password'];
  42.  
  43. if($user){
  44. if($password){
  45. include 'functions/connect.php';
  46. $password = md5($password);
  47.  
  48. $query = mysqli_query($con,"SELECT * FROM users WHERE name='$user'");
  49. $numrows = mysqli_num_rows($query);
  50.  
  51. if ($numrows == 1){
  52.  
  53. $row = mysqli_fetch_assoc($query);
  54. $dbpass = $row['password'];
  55. $dbuser = $row['name'];
  56. $dbrank = $row['rank'];
  57. $dbrankid = $row['rankid'];
  58. $dbclan = $row['code'];
  59.  
  60. if ($password == $dbpass){
  61.  
  62. $_SESSION['name'] = $dbuser;
  63. $_SESSION['rank'] = $dbrank;
  64. $_SESSION['rankid'] = $dbrankid;
  65. $_SESSION['code'] = $dbclan;
  66.  
  67. echo "You have been logged in as <b>$dbuser</b>. Your rank is <b>$dbrank</b>. Click <a href='dashboard.php'>HERE</a> to go to the panel.";
  68.  
  69. }
  70. else
  71. echo "Incorrect password. $form";
  72.  
  73. }
  74. else
  75. echo "Name not found. $form";
  76.  
  77.  
  78. }
  79. else
  80. echo "You must enter your password. $form";
  81.  
  82. }
  83. else
  84. echo "Please enter your name. $form";
  85.  
  86. }
  87. else
  88. echo $form;
  89. }
  90. ?>
  91.  
  92.  
  93. </div>
  94.  
  95. </div> <!-- End of container -->
  96.  
  97. <?php include("core/foot.php"); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement