Guest User

Untitled

a guest
Aug 15th, 2017
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. <title>Login - <?php echo Config::$_SITE_NAME; ?></title>
  2.  
  3.  
  4. <section class="content">
  5. <center>
  6.  
  7. <h3>Warden Login</h2>
  8.  
  9. <form method="post" action="">
  10.  
  11. <br />
  12.  
  13. Username:<br>
  14.  
  15. <input type="text" name="username_"/><br/>
  16.  
  17. <br>Password:<br>
  18.  
  19. <input type="password" name="password_"/><br/>
  20.  
  21. <br>
  22.  
  23. <input type="submit" name="submit" value="login" class="btn btn-inverse">
  24.  
  25. </form>
  26.  
  27. <br/>
  28. </center>
  29.  
  30. <br/><br/>
  31. </section>
  32.  
  33. <?php
  34.  
  35. if(!defined('panel'))
  36.  
  37. die('Nope.');
  38.  
  39. if(isset($_SESSION['user'])) echo '<script> location.replace("'.Config::$_PAGE_URL.'"); </script>';
  40.  
  41. if(isset($_POST['submit'])) {
  42.  
  43. if(!$_POST['username_'] || !$_POST['password_']) {
  44.  
  45. echo '<div class="alert alert-block alert-danger"><button type="button" class="close" data-dismiss="alert"><i class="ace-icon fa fa-times"></i></button>Complete all fields.</div>';
  46.  
  47. } else {
  48.  
  49. $q = Config::$g_con->prepare('SELECT * FROM `users` WHERE `name` = ? AND `password` = ?');
  50.  
  51. $q->execute(array($_POST['username_'],$_POST['password_']));
  52.  
  53. if($q->rowCount()) {
  54.  
  55. $d = Config::$g_con->prepare('SELECT * FROM `panel_restrict` WHERE `PlayerName` = ?');
  56.  
  57. $d->execute(array($_POST['username_']));
  58.  
  59. $row1 = $d->fetch(PDO::FETCH_OBJ);
  60.  
  61. if($d->rowCount() && date("Y-m-d H:i:s") <= gmdate("Y-m-d H:i:s", $row1->Time)) {
  62.  
  63.  
  64.  
  65. if($row1->Permanent == 1) {
  66.  
  67. $expira = "<b>permanent</b>";
  68.  
  69. } else {
  70.  
  71. $expira = "pana la data de <b>". gmdate("Y-m-d H:i:s", $row1->Time) ."</b>";
  72.  
  73. }
  74.  
  75. echo '<div class="alert alert-block alert-danger">
  76.  
  77. Your account has been banned.'.$expira.'.<br />
  78.  
  79. Reason: <b>'.$row1->Reason.'</b><br />
  80.  
  81. Banned on: <b>'.$row1->BanTimeDate.'</b></div>';
  82.  
  83. } else {
  84.  
  85.  
  86.  
  87. $dele = Config::$g_con->prepare("DELETE FROM panel_restrict WHERE PlayerName = ?");
  88.  
  89. $dele->execute(array($_POST['username_']));
  90.  
  91.  
  92.  
  93. $row = $q->fetch(PDO::FETCH_OBJ);
  94.  
  95. $_SESSION['user'] = $row->id;
  96.  
  97.  
  98.  
  99. echo '<script> location.replace("'.Config::$_PAGE_URL.'"); </script>';
  100.  
  101. //setcookie ("user",$_POST['username_'],time()+3600*24*60);
  102.  
  103. //setcookie ("password",$_POST['password_'],time()+3600*24*60);
  104.  
  105. //header ('Location: ' . $_PAGE_URL);
  106.  
  107. }
  108.  
  109.  
  110.  
  111. }
  112.  
  113. else echo '<div class="alert alert-block alert-danger"><button type="button" class="close" data-dismiss="alert"><i class="ace-icon fa fa-times"></i></button>Invalid username or password.</div>';
  114.  
  115. }
  116.  
  117. }
  118.  
  119. ?>
Add Comment
Please, Sign In to add comment