Guest User

Untitled

a guest
Oct 29th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.24 KB | None | 0 0
  1. <?
  2.  
  3. $msg;  
  4. if (isset($_POST['uname']))
  5.  {
  6.    
  7. $msg="";
  8. if($_POST['uname']==""){
  9. $msg.="<br />User Name cannot be left empty!<br />";}
  10. if($_POST['pass']==""){
  11. $msg.="<br />Password cannot be left empty!<br />";}
  12.  
  13. else {
  14.  
  15. $po_uname=check_input($_POST['uname']);
  16. $po_pass=md5($_POST['pass']);
  17.  
  18. $query =sprintf("select * from users where username='$po_uname' and password='$po_pass'");
  19.     $result = mysql_query($query);
  20.     if(mysql_num_rows($result) ==0) {
  21.     $msg.="Wrong login details entered!";
  22.     @mysql_close();
  23.     }
  24.    
  25. else { 
  26.     while ($row = mysql_fetch_assoc($result)) {                
  27.             $auth_id=$row['userid'];
  28.             $auth_gid=$row['usergid'];                     
  29.             $auth_name=$row['username'];
  30.             $auth_pass=$row['password'];
  31.             $auth_status=$row['status'];
  32.     }
  33.     if($auth_status == '0') {
  34.     $msg.="This account is not active, Please activate the account first!";
  35.     @mysql_close();
  36.     }
  37.    
  38.         if($auth_status == '2') {
  39.     $msg.="This account is suspended by site admin!";
  40.     @mysql_close();
  41.     }
  42.    
  43.     if($auth_status == '1') {
  44.            session_start();
  45.         $_SESSION['userid']=$auth_id;
  46.         $_SESSION['usergid']=$auth_gid;
  47.         $_SESSION['username']=$auth_name;
  48.         $_SESSION['password']=$auth_pass;
  49.         $_SESSION['status']=$auth_status;
  50.  
  51.         @mysql_close();
  52.         if(isset($_POST['remember'])){
  53.             setcookie("cookname", $auth_name, time()+60*60*24*30, "/");
  54.             setcookie("cookpass", $auth_pass, time()+60*60*24*30, "/");
  55.         }
  56.        
  57.     header("Location: myimages.php");
  58.     exit;
  59.     }
  60.  
  61.  
  62.  
  63. }  
  64.    
  65. }
  66.  
  67.  } // if post
  68.  
  69. ?>
  70.  
  71. <center>
  72. <?if(isset($msg)){?>
  73. <div id="error"><span class="error"><?=$msg?></span></div>
  74. <?}?>
  75.  
  76. <form name="config" action="<?= $_SERVER['PHP_SELF'] ?>" method="post" style="margin-top: 0px; margin-bottom: 0px;" onSubmit="return validate();">
  77. Usuario:<br />
  78. <input type="text" name="uname" id="uname" value="<?if(isset($po_uname)){echo("=".$po_uname);}?>" maxlength="20"><br />
  79. Contrase\F1a:<br />
  80. <input type="password" name="pass" value="<?if(isset($po_pass)){echo("=".$po_pass);}?>" maxlength="32"><br />
  81. <br />
  82. <input type="checkbox" name="remember">
  83. <font size="2">Recordarme<br /><br />
  84. <input type="submit" value="Entrar" type="submit">
  85. <br /><br />
  86. <a href="forgotpass.php">\BFOlvid\F3 su Contrase\F1a?</a>
  87. <br /><br /><br /><br />
  88.  
  89. </center>
  90.  
  91. </form>
Add Comment
Please, Sign In to add comment