I continually work to refine my skills. As I didn't major in computer science and do not have a background in OOP, sometimes it's difficult, but I think for the most part, I'm getting the gist.
I wrote an authentication class, and although it works, I'm wondering if it ought to rethink my development paradigm:
Here's the calls to methods (I'll spare you all the backend code):
Code: Select all
if($authent->checkCredentials($username, $password)) { //checkCredentials returns 1 if the un:pw combo are a match
$authent->destroyCurrentSession($username);
$authent->generateNewSession($username); //Generates SID, puts in a database, along with login time
}
else { //Bad Login
$authent->badLogin();
}Code: Select all
if(!$authent->stillLoggedIn($sid)) { //Checks database for how long user has been logged in. Also checks if SID exists
$authent->noLongerLoggedIn();
}
else { //User is still logged in
$authent->displayPage($_SERVER['PHP_SELF']);
}