Guest User

Untitled

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