UserlogDao.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. class UserlogDao {
  3. public $id;
  4. public $uid;
  5. public $username;
  6. public $action;
  7. public $ip;
  8. public $time;
  9. public $_table = 'zhask_userlog';
  10. public $_primarykey = "id";
  11. public $_fields = array ('id', 'uid', 'username', 'action', 'ip', 'time' );
  12. private $USER_LOGIN_LOG;
  13. private $USER_LOGINIP_EXCEPTIONAL;
  14. private $USER_EXIT;
  15. /**
  16. * 设置登录信息
  17. */
  18. public function set_USER_LOGIN_LOG() {
  19. return $this->username . "用户在" . format_date ( $this->time ) . "时间在IP为" . $this->ip . "登录";
  20. }
  21. /**
  22. * 设置登录IP异常信息
  23. * @param unknown_type $ip
  24. */
  25. public function set_USER_LOGINIP_EXCEPTIONAL($ip = "") {
  26. return $this->username . "用户在" . format_date ( $this->time ) . "时间的IP(" . $this->ip . ")发生异常,原IP为(" . $ip . ")";
  27. }
  28. public function set_USER_EXIT(){
  29. return $this->username . "用户在" . format_date ( $this->time ) . "时间在IP为" . $this->ip . "登出";
  30. }
  31. /**
  32. * 设置用户日志
  33. * @param unknown_type $uid
  34. * @param unknown_type $username
  35. * @param unknown_type $action
  36. * @param unknown_type $ip
  37. */
  38. public function set_userlog($uid = "", $username = "", $action = "", $ip = "") {
  39. //记录日常操作
  40. $sql = "INSERT INTO " . t_userlog . "(uid,username,action,ip,time) VALUES ('" . $uid . "','" . $username . "','" . $action . "','" . $ip . "','" . get_date () . "')";
  41. $query = Doo::db ()->query ( $sql );
  42. }
  43. }
  44. ?>