witam,
mam taki konstruktor jak ponizej, dlaczego wyzuca mi blad:
Missing argument 1 for authentication::__construct(),
Missing argument 2 for authentication::__construct(),
<?php
class authentication {
var $mysql = 'dsadsad';
var $session;
function __construct($mysql, $session) {
$this->mysql = $mysql;
$this->session = $session;
}
function authentication() {
$session_var['authentication'] = $this->session->_read('authentication');
if (empty($session_var)) { $smarty->display('inc_login.tpl');
if (!empty($_POST) and
empty($_POST['user_username'])) { $smarty->assign('error', $l['username_field_left_empty']);
} else if (!empty($_POST) and
empty($_POST['user_password'])) { $smarty->assign('error', $l['password_field_left_empty']);
} else if (!empty($_POST)) { $result = $this->mysql->query_one_result("SELECT COUNT(*) FROM `user`
WHERE `login`='".$this->mysql->escape($_POST['AuthenticationLogin'])."'
AND `password`='".$this->mysql->escape($this->secure($_POST['AuthenticationPassword']))."';");
$smarty->assign('error', $l['username_or_password_is_incorrect']);
} else {
$result = $this->mysql->query_one_result("SELECT `user_id` FROM `user`
WHERE `login`='".$this->mysql->escape($_POST['AuthenticationLogin'])."'
AND `password`='".$this->mysql->escape($this->secure($_POST['AuthenticationPassword']))."';");
$this->session->_write('authentication', $result);
header('Location: index.php'); }
}
} else if (!empty($session_var['authentication']) and
isset($_GET['logout'])) { $this->logout();
}
}
function check_authentication() {
$session_var['authentication'] = $this->session->_read('authentication');
return (!empty($session_var['authentication'])) ?
$session_var['authentication'] : FALSE; }
function logout() {
$this->session->_destroy('authentication');
header('Location: '.BASE_URL
); }
// Used so that it would be easier later to change encode method.
function secure($data) {
}
}
?>
Ten post edytował spandor 16.02.2009, 00:56:01