{% else-1 %}
#FWLone * 9.56
(13 май 2016, 07:55) (0/0) [0]
Тема закрыта для обсуждения! *
#FWLone * 9.56
(13 май 2016, 07:04) (0/0) [0]
Есть код...
[code]
<?
//БД
define('DBHOST', 'localhost');
define('DBUSER', 'root');
define('DBPASS', '');
define('DBNAME', 'new');
require_once 'classes/mysqli.php';
$db = new dbMySQLi;
$db->connect();

//Авторизация
$login = $db->safe_sql(trim(strip_tags($_SESSION['login'])));
$passw = $db->safe_sql(trim(strip_tags($_SESSION['passw'])));
require 'classes/class.auth.php';
$auth = new AuthClass();
$us = $auth->auth($login, $passw);
?>
[/code]

и вот
[code]
<?
public function auth($login, $pass) {
$us_q = $db->query("SELECT `id`,`login`,`pass`,`salt` FROM `users` WHERE `lodin` = '".$login."' AND `pass` = '".$pass."' limit 1"*;
$us = $db->get_row($us_q);
if ($us['id']) {
return $us;
} else {
return false;
}
}
?>
[/code]

Выбивает ошибку:
Fatal error: Call to a member function query() on a non-object
Хорошо, меняем на
[code]
<?
public function auth($login, $pass) {
$us_q = dbMySQLi::query("SELECT `id`,`login`,`pass`,`salt` FROM `users` WHERE `lodin` = '".$login."' AND `pass` = '".$pass."' limit 1"*;
$us = dbMySQLi::get_row($us_q);
if ($us['id']) {
return $us;
} else {
return false;
}
}
?>
[/code]
Вот результат:
Strict Standards: Non-static method dbMySQLi::query() should not be called statically, assuming $this from incompatible context in E:\OpenServer\domains\fwimg.ru\classes\class.auth.php on line 24

Fatal error: Call to undefined method AuthClass::connect()


Не совсем понял, как быть?
  • 1 из 1