login.inc.php 832 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * Login (what a description !)
  4. *
  5. * @package siteadm
  6. */
  7. class login extends account
  8. {
  9. /**
  10. *
  11. * Enter description here ...
  12. * @param string $username
  13. * @param string $password
  14. * @return boolean
  15. */
  16. function connect($username, $password)
  17. {
  18. if (!is_string($username) || !is_string($password))
  19. return false;
  20. $query_string = "SELECT * FROM `account` WHERE `name`='".mysql_real_escape_string($username)."' AND `password`='".mysql_real_escape_string($password)."' AND `actif`='1'";
  21. $query = mysql_query($query_string);
  22. if ($infos=mysql_fetch_assoc($query))
  23. {
  24. foreach($infos as $name=>$value)
  25. {
  26. $this->{$name} = $value;
  27. }
  28. }
  29. }
  30. /**
  31. * Disconnect the logged in user
  32. */
  33. function disconnect()
  34. {
  35. $this->id = null;
  36. $this->name = null;
  37. $this->manager_id = null;
  38. $this->type = null;
  39. $this->offre_id = null;
  40. }
  41. }
  42. ?>