user_class.php
1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/**
* Tiny - A PHP Framework For Web Artisans
* @author Tiny <tinylofty@gmail.com>
* @copyright Copyright(c) 2010-2014 http://www.tinyrise.com All rights reserved
* @version 1.0
*/
/**
* 用户类
*
* @author Tiny
* @class User
*/
class User extends Object
{
private $status;
/**
* 构造方法
* @access public
* @param mixed $name
* @param mixed $password
* @return mixed
*/
public function __construct($name,$password)
{
if(Session::get('user')===null)
{
$model = new Model('');
$user = $model->getObjs('*','name="'.$name.'" and password="'.md5($password).'"');
if(isset($user[0]))
{
$this->properties=$user[0];
$this->status='online';
Session::set('user',$this->properties);
}
else
{
$this->status='offline';
$this->properties=null;
}
}
else
{
$this->status='online';
$this->properties=Session::get('user');
}
}
/**
* 得到用的状态
*
* @access public
* @return mixed
*/
public function getStatus()
{
return $this->status;
}
}
?>