ausers.php 899 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. Doo::loadCore('db/DooModel');
  3. Doo::loadClass('PasswordHash');
  4. /**
  5. * 用户表
  6. */
  7. class AUsers extends DooModel {
  8. public $uid;
  9. public $uemail;
  10. public $upass;
  11. public $intime;
  12. public $_table = 'jl_users';
  13. public $_primarykey = 'uid';
  14. public $_fields = array('uid', 'uemail', 'upass', 'intime');
  15. private $ph;
  16. public function __construct() {
  17. parent::setupModel(__CLASS__);
  18. $this->ph = new PasswordHash(8, FALSE);
  19. }
  20. public function createUser($email, $passwd) {
  21. $userArray = $this->getOne(array('where' => 'uemail=?', 'param' => array($email), 'asArray' => TRUE));
  22. if (isset($userArray['uid'])) {
  23. return FALSE;
  24. }
  25. $this->uemail = $email;
  26. $this->upass = $this->ph->HashPassword($passwd);
  27. $this->intime = time();
  28. return $this->insert();
  29. }
  30. public function getRowAll() {
  31. return $this->find(array('asArray' => TRUE));
  32. }
  33. }
  34. ?>