Advertisement
Guest User

Untitled

a guest
Aug 20th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.09 KB | None | 0 0
  1. <?
  2.  
  3. if (isset($_POST['submit'])) :
  4.  
  5.     $user = $_POST['aname'];
  6.     $pword = $_POST['apass'];
  7.     $pass = md5($pword);
  8.    
  9.     $usr = "select * from users where uname = '$user' and upass = '$pass'";
  10.     $usr_result = mysql_query($usr) or die (mysql_error());
  11.     $usr_row = mysql_fetch_assoc($usr_result) or die (mysql_error());
  12.    
  13.     if ($usr_result) :
  14.    
  15.         if (mysql_num_rows($usr_result) > 0) :
  16.        
  17.             if ($user && $pword == true) :
  18.        
  19.                 session_regenerate_id();
  20.                 $_SESSION['USR_ID'] = $usr_row['uid'];
  21.                 session_write_close();
  22.                 header("location:/admin/index.php");
  23.                 exit;
  24.            
  25.             endif;
  26.        
  27.         endif;
  28.        
  29.     endif;
  30.  
  31. endif;
  32.  
  33. ?>
  34.     <form name="login" id="login" action="<?$_SERVER['PHP_SELF']?>" method="post" onload="setFocus">
  35.         <label class="left cboth">Användarnamn</label>
  36.         <input class="left cboth" type="text" name="aname" id="aname" onfocus="formInUse" />
  37.         <label class="left cboth">Lösenord</label>
  38.         <input class="left cboth" type="password" name="apass" id="apass" onfocus="formInUse" />
  39.         <input class="left cboth" type="submit" name="submit" id="submit" value="Logga in" />
  40.     </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement