In a php script, I made this class and functions login() & setSession():
Code: Select all
class Login {
function login($user,$pass) {
$user = addslashes($user);
$pass = addslashes($pass));
$findUser = mysql_query("SELECT * FROM users WHERE userName='$user'") or die(mysql_error());
$a = mysql_fetch_array($findUser);
$realpass = $a['password'];
if(mysql_num_rows($findUser) == "0") {
nS("There is no such account.");
}
elseif (($pass == $realpass) && ($a['enabled'] != 0)) {
$this->setSession($user);
}
}
function setSession($userName) {
$_SESSION['userName'] = "$userName";
}
}Code: Select all
if (isset($_POST['user']) && ($_POST['action']=='login')) {
$log = new Login();
$u = $_POST['user'];
$p = $_POST['password'];
$log->login($u,$p);Warning: Missing argument 1 for Login::login(), called in /home/youchun/maps.chizeng.com/index.php on line 7 and defined in /home/youchun/maps.chizeng.com/core.php on line 97
Warning: Missing argument 2 for Login::login(), called in /home/youchun/maps.chizeng.com/index.php on line 7 and defined in /home/youchun/maps.chizeng.com/core.php on line 97
There is no such account.
Any help would be very useful. Thanks so much,
Chi