Jestem nowy na tym forum więc witam wszystkich.
Teraz do sedna postanowiłem rozpocząć przygodę z programowaniem obiektowym i mam pytanie czy ten kod poniżej na sens programowania obiektowego ? Proszę o wyrozumiałość to początki, ale uwagi mile widziane.
class User
{
private $mysql;
private $host = "localhost";
private $uzytkownik = "user";
private $baza = "baza";
private $haslo = "haslo";
private $prefiks = "prefiks_";
function __construct() {
$this -> spr_stan();
$this -> mysql = new mysqli
($this -> host, $this -> user, $this -> pass, $this -> db);
}
function __set ($nazwa, $wartosc) {
$this -> $nazwa = $wartosc;
}
function __get ($nazwa) {
return $this -> $nazwa;
}
function zaloguj($login, $haslo) {
$sql = "SELECT * FROM ".$this -> prefiks."account WHERE login = $login AND password = $haslo ;";
$sqlQry = $this -> mysql -> query($sql); $ile = $sqlQry -> num_rows;
if ($ile == '1') $_SESSION['stan'] = '1';;
}
function wyloguj() {
$_SESSION['stan'] = '0';
header('Location: index.php');
}
function zmien_haslo($email, $haslo) {
}
function spr_stan() {
if($_SESSION['stan'] == '1')
echo '<script>powiadomienie(\'Zalogowano\', \'accept\');</script>'; else
{
echo '<script>powiadomienie("Aby przeglądać Panel Admina musisz się <button onClick=\"show_login();\">", "information");</script>'; }
}
}