-
Notifications
You must be signed in to change notification settings - Fork 0
/
user.php
86 lines (52 loc) · 1.29 KB
/
user.php
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
class User extends Database{
public function __construct(){
Database::__construct();
$this->table('users');
}
public function getUserByUsername($user_name, $is_die=false){
//SELECT * FROM users WHERE email='".$user_name."';
//SELECT fields FROM table
//JOIN statement
//WHERE clause
//GROUP BY clause
//ORDER BY clause
//LIMIT start ,count
$args=array(
//"fields"=>['id','email','full_name','password','status'],
/*'where'=>"email='".$user_name."'"*/
'where'=>array(/*"or"=>array('email'=>$user_name,
'user_name'=>$user_name),*/
"and"=>array('email'=>$user_name)
)
);
//debugger($args,true);
$data=$this->select($args, $is_die);
return $data;
}
public function updateUser($data, $id, $is_die = false){
$args = array(
'where' => array(
'and' => array('id' => $id)
)
);
return $this->update($data, $args, $is_die);
}
public function getUserByToken($token, $is_die =false){
$args = array(
'where' => array(
'and' => array('session_token' => $token)
)
);
return $this->select($args, $is_die);
}
public function getUser($args=array(), $is_die=false){
$args=array(
'where'=>array(
'and'=>$args
)
);
return $this->select($args, $is_die);
}
}
?>