CQuery('select count(id) from admin where name = '.$db->sqlsafe($user).' '); $getPassword = $db->CQuery('select count(id) from admin where passwd = '.$db->sqlsafe($pass).' '); if($getUser != 1){ header('Location: login.php?error=1&user='.$user.''); exit; }elseif($getPassword != 1){ header('Location: login.php?error=2'); exit; }else{ $getInfo = $db->select('select id ,name , email from admin where passwd = '.$db->sqlsafe($pass).' AND name = '.$db->sqlsafe($user).' limit 0 , 1'); $_SESSION['login']['name'] = $getInfo[0]['name']; $_SESSION['login']['email'] = $getInfo[0]['email']; $_SESSION['login']['id'] = $getInfo[0]['id']; $_SESSION['login']['pass'] = $pass; if(!empty($_POST['redir'])){ header('Location: '.$_POST['redir'].''); exit; }else{ header('Location: index.php'); exit; } } } ?>