Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- /**
- * Session.php
- *
- * A simple class to help manage sessions conviniently and leave all the
- * complex code wrapped up in one class.
- *
- * Author: techwizrd <theninja@bluedevs.net>
- * Last updated: June 01, 2009 at 01:29:04
- */
- require('database.php');
- class Session {
- var $username; //username
- var $email; //user's email
- var $time; //time user last logged in
- var $logged_in; //boolean representing login state
- var $userlevel; //level of user
- var $userinfo = array();//miscellaneous userinfo
- //Constructor
- function Session() {
- $this->time = time();
- $this->startSession();
- }
- // performs all the neccesary work in starting a session
- function startSession() {
- //global $database;
- session_start();
- this->$username = "guest";
- this->$logged_in = false;
- this->$userlevel = 0;
- }
- /**
- * login - logins in a user and handles all the busy work updating
- * variables to match that of the current user
- * @params
- * $username - the unmodified username
- * $password - the unmodified, unsalted, unhashed password
- * @return
- * true - logged in succesfully
- * false - login failed
- */
- function login($username, $password) {
- //check the login credentials
- }
- /**
- * logout - logs out a user and resets all the variables to the guest
- * values from first initialization
- */
- function logout(){
- this->$username = "guest";
- this->$email = "";
- this->$logged_in = false;
- this->$userlevel = 0;
- this->$userinfo = array();
- }
- }
- ?>
Add Comment
Please, Sign In to add comment