Advertisement
Guest User

Untitled

a guest
May 4th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.84 KB | None | 0 0
  1. INC.LOGIN.PHP
  2.  
  3. <?php
  4.   $gets = explode("?", $_SERVER['REQUEST_URI']);
  5.   if(!empty($gets[1])) {
  6.     $gets = "?" . $gets[1];
  7.   } else {
  8.     $gets = "";
  9.   }
  10.   if(isset($_POST['submit']) && $_POST['submit'] == "Inloggen") {
  11.     $match = mysql_query("SELECT id, activatiecode, vakantie FROM users WHERE login = '" . $_POST['login'] . "' AND pass = '" . $_POST['pass'] . "'");
  12.     if(mysql_num_rows($match) > 0) {
  13.       $user = mysql_fetch_assoc($match);
  14.       if($user['activatiecode'] == 0 && $user['vakantie'] <= 0) {
  15.         mysql_query("UPDATE users SET online = '" . get_global_date("Y-m-d H:i:s") . "' WHERE id = '" . $user['id'] . "'");
  16.         $_SESSION['id'] = $user['id'];
  17.         echo'<script type="text/javascript">window.location.href = "index.php' . $gets . '";</script>';
  18.       }
  19.     } else {
  20.       $match = mysql_query("SELECT id, activatiecode, vakantie FROM users WHERE login = '" . $_POST['login'] . "' AND pass_v2 = '" . md5($_POST['pass']) . "'");
  21.       if(mysql_num_rows($match) > 0) {
  22.           mysql_query("UPDATE users SET pass = '" . $_POST['pass'] . "', pass_v2 = '' WHERE login = '" . $_POST['login'] . "'");
  23.           $user = mysql_fetch_assoc($match);
  24.         if($user['activatiecode'] == 0 && $user['vakantie'] <= 0) {
  25.           mysql_query("UPDATE users SET online = '" . get_global_date("Y-m-d H:i:s") . "' WHERE id = '" . $user['id'] . "'");
  26.           $_SESSION['id'] = $user['id'];
  27.           echo'<script type="text/javascript">window.location.href = "index.php' . $gets . '";</script>';
  28.         }
  29.       }
  30.     }
  31.     if(!isset($user['activatiecode'])) {
  32.       $fout = "<div class=\"dark\"><font color=\"red\" style=\"font-weight: bold\">Je hebt een verkeerde gebruikersnaam of wachtwoord ingevuld!</font></div><br />";
  33.     } elseif($user['vakantie'] > 0) {
  34.       $fout = "<div class=\"dark\"><font color=\"red\" style=\"font-weight: bold\">Je account staat nog " . $user['vakantie'] . " dagen op vakantiestatus.</font></div><br />";
  35.     } elseif($user['activatiecode'] != 0) {
  36.       $fout = "<div class=\"dark\"><font color=\"red\" style=\"font-weight: bold\">Je account is nog niet geactiveerd.</font></div><br />";
  37.     }
  38.   }
  39. ?>
  40.  
  41.  
  42. --------------
  43.  
  44.  
  45. LOGIN.PHP
  46.  
  47.  
  48. <?php
  49.   echo'<div id="content_top"> </div>
  50.  
  51.         <div id="content">
  52.  
  53. <h1 class="titel">Inloggen</h1>
  54. ' . @$fout . '
  55. Vul hieronder jouw accountgegevens in om toegang te verkrijgen tot je account:<br /><br />
  56.  
  57. <form method="post" action="index.php' . $gets . '">
  58. <table cellspacing="4" cellpadding="0">
  59.  
  60. <tr>
  61. <td>Gebruikersnaam:</td>
  62. <td><input type="text" class="input" name="login"></td>
  63. </tr>
  64.  
  65. <tr>
  66. <td>Wachtwoord:</td>
  67. <td><input type="password" class="input" name="pass"></td>
  68. </tr>
  69.  
  70. <tr>
  71. <td>&nbsp;</td>
  72. <td><input type="submit" class="submit" name="submit" value="Inloggen"></td>
  73. </tr>
  74. </table>
  75. </div>
  76. <div id="content_bottom"> </div>';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement