Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function _Login($username, $password=null){
- if(isset($username) && $username != null && $password == null){
- $username = $this->mysqli->escape_string($username);
- $getUser = $this->mysqli->query("SELECT * FROM user WHERE username = '".$username."' LIMIT 1");
- if($getUser->num_rows == 1){
- $this->smarty->assign('si', 'log_pw');
- $this->smarty->assign('userName', $username);
- } else {
- $this->smarty->assign('error', 'Username nicht vorhanden!');
- $this->smarty->assign('si', 'log');
- }
- } else {
- $this->smarty->assign('si', 'log_pw');
- $username = $this->mysqli->escape_string($username);
- $password = $this->mysqli->escape_string($password);
- $getUser = $this->mysqli->query("SELECT * FROM user WHERE username = '".$username."' LIMIT 1");
- if($getUser->num_rows == 1){
- $thisUser = $getUser->fetch_object();
- if($thisUser->password == md5($this->hash.$password.$this->hash)){
- $_SESSION['username'] = $thisUser->username;
- header("Location: index.php");
- exit;
- } else {
- $this->smarty->assign('error', 'Passwort falsch!');
- $this->smarty->assign('si', 'log');
- }
- } else {
- $this->smarty->assign('error', 'Username nicht vorhanden!');
- $this->smarty->assign('si', 'log');
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement