Guest User

Untitled

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