Advertisement
kains

Login

Feb 27th, 2012
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.04 KB | None | 0 0
  1. <?php
  2. class User_Full Extends Conectar
  3. {
  4.     protected $_nick;
  5.     protected $_pass;
  6.    
  7.     public  function __construct($name, $pass)
  8.     {
  9.         $this->_nick = $name;
  10.         $this->_pass = $pass;
  11.     }
  12.     public function Login()
  13.     {
  14.         if(empty($this->_nick or empty ($this->_pass))
  15.         {
  16.             header("Locantion: ".Conectar::ruta()."?acc=index&v=1");
  17.             exit;
  18.         }else{
  19.             $pass_end = sha1($this->_pass, true);
  20.             $pass_encript = base64_encode($pass_end);
  21.             parent::Conect_LS();
  22.        
  23.             $sql_qry = sprintf
  24.             (
  25.                 "SELECT name,password FROM account_data WHERE name=%s AND password=%s",
  26.                 parent::Anti_Sql($this->_nick),
  27.                 parent::Anti_Sql($pass_encript)
  28.             );
  29.             $res = mysql_query($sql_qry);
  30.            
  31.             if(mysql_num_rows($res == 0)
  32.             {
  33.                 header("Locantion: ".Conectar::ruta()."?acc=index&v=2");
  34.                 exit;
  35.             }else{
  36.                 if($reg = mysql_fetch_array($res))
  37.                 {
  38.                     $_SESSION["ses_nick"] = $reg[$this->_nick];
  39.                     $_SESSION["ses_pass"] = $reg[$pass_encript];
  40.                     header("Location: ".Conectar::ruta()."?acc=profile");
  41.                     exit;
  42.                 }
  43.             }
  44.         }
  45.     }
  46. }
  47. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement