Jestem potocznie nazywanym w Internecie "noobem"

Login.class.php
<?php class Login { public $userStatus; private function __construct() { $this -> setAnonymous(); } public function setAnonymous () { $this -> userStatus = 'anonymous'; } public function setUser () { $this -> userStatus = 'user'; } public function setAdmin () { $this -> userStatus = 'admin'; } public function checkStatus () { return $this -> userStatus; } // Singleton { { $c = __CLASS__; self::$instance = new $c; } return self::$instance; } public function __clone() { } } ?>
index.php
<?php require_once ( 'classes/MySql.class.php' ); require_once ( 'classes/Login.class.php' ); require_once ( 'classes/Templates.class.php' ); require_once ( 'functions/Configuration.php' ); require_once ( 'functions/Helpers.php' ); // Singletons $Login = Login::singleton(); // ----- end // set Configuration $Data = niceURL(); // ----- end // View Core $coreTpl = new Template(); "menu" => Menu ($Login -> checkStatus(), $MySQL), "content" => Content ($Data, $MySQL, $Login), "url_template" => __url( $MySQL ).'templates', "footer" => 'copyright' ); // ----- end ?>
funkcja Contents()
function Content ( $Data, $MySQL, $Login ) { $userStatus = $Login -> checkStatus(); { $Answer = $MySQL -> qr ("SELECT * FROM epmenu WHERE name='$Data[0]'"); if (($Answer['access'] == 'admin' || $Answer['access'] == 'user') and $userStatus == 'anonymous') { $tmp = 'Access denied'; } { $tmp = '404'; } else { switch ( $Answer['name'] ) { // ANONYMOUS case 'Login': $tmp = cnLogin ( $MySQL, $Login ); //if ( $tmp == 'Success' ) header ('Location: '.__url( $MySQL ).'index.php/Successfull/1'); //if ( $tmp == 'Error' ) header ('Location: '.__url( $MySQL ).'index.php/Error/1'); break; case 'Forgot': $tmp = '1'; break; // USER case 'Undone': $tmp = '1'; break; case 'Progress': $tmp = ''; break; case 'Done': $tmp = '1'; break; case 'Docs': $tmp = '1'; break; case 'Upload': $tmp = ''; break; case 'Profile': $tmp = '1'; break; // ADMINISTRATION case 'Administration': $tmp = '1'; break; // SYTUATIONS case 'Successfull': $Success = new Template(); switch ( $Data[1] ) { case '1': $message = 'Congratulations! You have successful log in!'; $back = __url( $MySQL ).'index.php/'; $url = __url( $MySQL ); break; } $tmp = $Success -> change ( array ( 'message' => $message, 'back' => $back, 'url' => $url ), 'Success.tpl', 'mtScreen' ); break; case 'Error': $Error = new Template(); switch ( $Data[1] ) { case '1': $message = 'Login error: username or password is wrong!'; $back = __url( $MySQL ).'index.php/Login'; $url = __url( $MySQL ); break; } $tmp = $Error -> change ( array ( 'message' => $message, 'back' => $back, 'url' => $url ), 'Error.tpl', 'mtScreen' ); break; } } return $tmp; } } // ----- end
Funkcja cnLogin
function cnLogin ( $MySQL, $Login ) { $username = $_POST['username']; $password = $_POST['password']; { $Formular = new Template(); } else { $Number = $MySQL -> nr ("SELECT * FROM epusers WHERE username='$username'"); if ( $Number > 0 ) { $Answer = $MySQL -> qr ("SELECT * FROM epusers WHERE username='$username'"); if ( $password == $Answer['password'] ) { $tmp = 'Success'; if ( $Answer['access'] == 'admin' ) $Login -> setAdmin(); else $Login -> setUser(); } else { $tmp = 'Error'; } } else { $tmp = 'Error'; } $tmp = $Login -> checkStatus(); } return $tmp; } // ----- end
No właśnie i teraz jak wywołam
$Login -> checkStatus()
To w index.php wartość jest anonymous, jednak w funkcji cnLogin warość jest user (loguje się na użytkownika z takim statusem)
2 róże wartości singletona?

Proszę oświećcie mnie

P.S. Prosiłbym o konkretne wypowiedzi, a nie w stylu "naucz się php", czy " po co używasz singletona on ssie"
Z góry dziękuje i pozdrawiam!