Guest User

Untitled

a guest
Oct 12th, 2018
481
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.88 KB | None | 0 0
  1. <?php
  2.         $user = $_POST['users'];
  3.         $pass = $_POST['pass'];
  4.         $prefix = '';
  5.         if(!isset($_SESSION['user'])){
  6.             if ($_SERVER['REQUEST_METHOD'] == 'POST') {
  7.                 if (empty($user) || empty($pass)) {
  8.                     echo "<center><b>You have left one or more fields blank.</b><br>";
  9.                     echo "<b>Please <a href='javascript:history.go(-1);'>Go Back</a> and try again.</b></center>";
  10.                 } else {
  11.                     $return = mysql_query('SELECT * FROM '. $prefix .'users WHERE username=\'' . realEscape($_POST['users']) . '\' AND password=\'' . $_POST['pass'] . '\'') ;     
  12.                      if(mysql_num_rows($return) > 0) {
  13.                          while($n = mysql_fetch_array($return)) {
  14.                              $_SESSION['user'] = $n['username'];
  15.                              $_SESSION['user_id'] = $n['userid'];
  16.                              echo "<b>Not being redirected? Click <a href='index.php'>Here!</b></a>";
  17.                              echo "<meta http-equiv=Refresh content=3;url='index.php'>";
  18.                          }
  19.                      } else {
  20.                          echo 'Invalid username and or password.';
  21.                          echo "<b>Please <a href='javascript:history.go(-1);'>Go Back</a> and try again.</b></center>";
  22.                      }
  23.                 }
  24.             }
  25.     ?>
  26.     <div id="login">
  27.         <center>
  28.            <form id="login_form" action="index.php" method"post">
  29.              <table style="-moz-opacity: 1.0; opacity: 1.0; filter: alpha(opacity = 100);">
  30.                 <tr>
  31.                     <td>Username:</td>
  32.                         <td><input size="20" type="text" name="users" maxlength="12" /></td>
  33.                 </tr>
  34.                 <tr>
  35.                     <td>Password:</td>
  36.                     <td><input size="20" type="password" name="pass" maxlength="20" /></td>
  37.                 </tr>
  38.                 <tr>
  39.                     <td></td>
  40.                     <td align="center"><input type="submit" name="loginButton" value="Secure Login" /></td>
  41.                 </tr>
  42.               </table>
  43.             </form>
  44.         </center>
  45.     </div>
Add Comment
Please, Sign In to add comment