Szczerze powiem że już nie mam pomysłów o co może chodzić...
Mam 2 klasy - każda w osobnym pliku, oba pliki w tym samym katalogu
login.php
require_once("language.php");
class login
{
public $user;
public $userId;
public $userLevel;
protected $lang;
protected $db;
public function __construct()
{
$this->lang = NEW language();
require_once(dirname(dirname(__FILE__))."/config.php");
$this->db = NEW mysqli($db['hostname'], $db['username'], $db['password'], $db['database']);
if($this->db->connect_errno > 0){
die('Nieb można połączyć się z bazą[' . $this->db->connect_error . ']');
}
}
public function loginForm($errors, $message)
{
if($errors) echo '<div class="alert error">' . $message . '</div>';
echo '
<section id="login_box">
<form class="login_form">
<h1>'.$this->lang->login_title.'</h1>
<p>
<label for="login">'.$this->lang->login.'</label>
<input type="text" name="login" placeholder="'.$this->lang->login_placeholder.'" required>
</p>
<p>
<label for="password">'.$this->lang->password.'</label>
<input type="password" name="password" placeholder="'.$this->lang->password_placeholder.'" required>
</p>
<p>
<input type="submit" name="submit" value="'.$this->lang->loginng.'">
</p>
</form>
</section>
';
}
public function login($user, $pass)
{
$pass = md5($pass);
$statement = $this->db->prepare("SELECT id, login, level FROM members WHERE login = ? AND password = ?");
$statement->bind_param('ss', $user, $pass);
$statement->execute();
if($statement->num_rows == 1)
{
$row = $statement->fetch_assoc();
$_SESSION['level'] = $row['level'];
$_SESSION['user'] = $row['login'];
$_SESSION['userId'] = $row['id'];
return true;
}
else return $this->lang->wrong_login;
}
public function logout()
{
session_destroy();
return;
}
public function check($accessLevel, $id)
{
if($accessLevel <= $_SESSION['level'] and $id == $_SESSION['userId']) return false;
else return true;
}
public function query($sql, $only_first = false)
{
$result = @mysql_query($sql, $this->connection);
}
protected function get_error_path()
{
}
}
language.php
class language {
public $language;
public $lang;
public function __construct() {
require_once(dirname(dirname(__FILE__))."/config.php");
$this->language = $settings['lang'];
require_once(dirname(dirname(__FILE__))."/lang/".$this->language.".php");
$this->lang = $lang;
}
public function __get($word)
{
return $this->lang[$word];
}
}
No i gdy w language.php dodaje pliki (config.php i lang/pl.php - jezyk ustawiony jest w tablicy) to nie ma problemu, strona jest w takiej wersji językowej jak ustawie natomiast gdy w login.php dodaje plik config.php to tak jakby go nie widziało... jakieś propozycje? co robię źle?