KalashaLv 23 Report post Posted February 1, 2017 Sveiki, nāku pēc palīdzības saistībā ar login darbību! draugs nesen izveidoja man jaunus failus priekš login! Tik šodien patestēju un izet šādu rindiņu!! Fatal error: Call to a member function query() on a non-object in ../web.class.php on line 9 Kāds nevarētu pateikt kas te ir nepareizi? config fails; <?php define('SITE_NAME', 'TEST.LV'); define('SITE_URL', 'http://localhot'); define('SITE_FORUM_URL', 'http://localhost/3.xforums'); define('SITE_PATH', $_SERVER['DOCUMENT_ROOT'].'/'); $db = new mysqli('localhost', '..', '..', '..'); require '../classes/web.class.php'; $web = new Web($db); if($web->isLoggedIn()) $web->redirect(SITE_FORUM_URL); ?> web.class fails <?php class Web { private $db; public function __constuct($db) { $db = $this->db; } public function isLoggedIn() { if(isset($_COOKIE['member_id']) && isset($_COOKIE['pass_hash'])) { $kverijs = $this->db->query('SELECT * FROM `members` WHERE `member_id` = '.$_COOKIE['member_id'].' AND `member_login_key` = "'.$_COOKIE['pass_hash'].'";'); $checker = $kverijs->num_rows == 1 ? true : false; } else $checker = false; return $checker; } public function redirect($url) { return header('Location:'.$url); } } ?> izpalīdzat lūdzu Quote Share this post Link to post Share on other sites
MārisL 94 Report post Posted February 1, 2017 (edited) u wut? function __construct($db) { $this->db = $db; } 1. konstruktoram nav jēga no public. 2. Tev $db = $this->db vietām sajaukts bija. 3. iekšs __construct metodes nosaukuma kļūda. Edited February 1, 2017 by Arthur Vasilyev 3 Quote Share this post Link to post Share on other sites
KalashaLv 23 Report post Posted February 1, 2017 5 minutes ago, Arthur Vasilyev said: u wut? function __constuct($db) { $this->db = $db; } Tas pats 20 minutes ago, Arthur Vasilyev said: u wut? function __construct($db) { $this->db = $db; } 1. konstruktoram nav jēga no public. 2. Tev $db = $this->db vietām sajaukts bija. 3. iekšs __construct metodes nosaukuma kļūda. Tagad viņš strādā, bet vienalga, ielogojies vai nē, viņš vnk pārmet uz forumu Quote Share this post Link to post Share on other sites
MārisL 94 Report post Posted February 1, 2017 (edited) Pis Tevi. Pat plusu neielika.... Debugo. Pārbaudi, ko kverijs atgriež abos variantos. Nekad vairs nevienam nepalīdzēšu Edited February 1, 2017 by Arthur Vasilyev 8 Quote Share this post Link to post Share on other sites