Jump to content

Fjorko

New Members
  • Posts

    3
  • Joined

  • Last visited

Fjorko's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. LOL ! No Way !!!!!! Hahahahahahahahaha - What a plonker am I !!!!! So sorry to have wasted your time ! PS : It's working just fine now ! Thanks so much !
  2. Members.php : <?php include("includes/init.php"); //check authorisation if($Auth->checkLoginStatus() == FALSE) { $Template->setAlert("Unauthorised!","error"); $Template->redirect("login.php"); } else { $Template->load("views/v_members.php"); } ?> m_auth.php <?php /* Authorisation Class Deals with Authentication Tasks *******************************/ class Auth { private $salt = "4JHGBF5"; /* Constructor */ function __Construct() { } /* Functions ***********/ function validateLogin($user, $pass) { global $Database; //allows this function to have access to the $Database variable defined in database.php //create query if($stmt = $Database->prepare("SELECT * FROM users WHERE username = ? AND password = ?")) { $stmt->bind_param("ss",$user,md5($pass.$this->salt)); $stmt->execute(); $stmt->store_result(); //check num rows returned if($stmt->num_rows > 0) { //success $stmt->close(); return TRUE; } else { //fail $stmt->close(); return FALSE; } } else { die("ERROR: Could not prepare MYSQLi statement"); } function checkLoginStatus() { if(isset($_SESSION["loggedin"])) { return TRUE; } else { return FALSE; } } function logout() { session_destroy(); session_start(); } } } ?> Note - I use a slightly different SALT than yours, so my value will differ !
  3. I followed the CMS Tutorial to the "T", and have everything exactly as Ben explained. At the end of Video 14, where the login system part of the tutorial comes to an end, and where you log in as admin to test everything, I have an error that comes up and I cannot understand why. I compared my Code to Ben's and it all looks exactly the same. I even checked the source code files and it's the same there too.... I'm running that lastest version of WAMP, so that's OK. The login form and everything works fine except I get this message when I try to log in as admin : Fatal error: Call to undefined method Auth::checkLoginStatus() in D:\wamp\www\LOGIN\members.php on line 6 I checked and the new Auth() object is defined in the init.php file. The class is created in m-auth.php ( and I double checked everything in there ), the method ( checkLoginStatus) is correct, and the same method is called correctly in the login.php file if($Auth->checkLoginStstus() == FALSE) So I'm at a lost as to what the issue is...I'm sure it's something very simple... Ben can you guide me here please ? I cannot continue with the series if i cannot get this fixed.... Thanks !
×
×
  • Create New...