Guest User

Untitled

a guest
Jun 21st, 2018
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. <?
  2.  
  3. /**
  4. * Session.php
  5. *
  6. * A simple class to help manage sessions conviniently and leave all the
  7. * complex code wrapped up in one class.
  8. *
  9. * Author: techwizrd <theninja@bluedevs.net>
  10. * Last updated: June 01, 2009 at 01:29:04
  11. */
  12.  
  13. require('database.php');
  14.  
  15. class Session {
  16. var $username; //username
  17. var $email; //user's email
  18. var $time; //time user last logged in
  19. var $logged_in; //boolean representing login state
  20. var $userlevel; //level of user
  21. var $userinfo = array();//miscellaneous userinfo
  22.  
  23. //Constructor
  24. function Session() {
  25. $this->time = time();
  26. $this->startSession();
  27. }
  28.  
  29. // performs all the neccesary work in starting a session
  30. function startSession() {
  31. //global $database;
  32. session_start();
  33. this->$username = "guest";
  34. this->$logged_in = false;
  35. this->$userlevel = 0;
  36. }
  37.  
  38. /**
  39. * login - logins in a user and handles all the busy work updating
  40. * variables to match that of the current user
  41. * @params
  42. * $username - the unmodified username
  43. * $password - the unmodified, unsalted, unhashed password
  44. * @return
  45. * true - logged in succesfully
  46. * false - login failed
  47. */
  48. function login($username, $password) {
  49. //check the login credentials
  50. }
  51.  
  52. /**
  53. * logout - logs out a user and resets all the variables to the guest
  54. * values from first initialization
  55. */
  56. function logout(){
  57. this->$username = "guest";
  58. this->$email = "";
  59. this->$logged_in = false;
  60. this->$userlevel = 0;
  61. this->$userinfo = array();
  62. }
  63. }
  64.  
  65. ?>
Add Comment
Please, Sign In to add comment