-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser.php
More file actions
137 lines (112 loc) · 3.13 KB
/
Copy pathuser.php
File metadata and controls
137 lines (112 loc) · 3.13 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
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<?php
class user {
public $loginUserId;
public $conn;
public $db;
public $result;
public function __construct($id = "")
{
$this->loginUserId = $id;
$this->db = new Database();
$this->conn = $this->db->conn;
}
public function select($query)
{
return $this->result = $this->db->select($query);
}
//end dabtabase connection
public function get_user_info()
{
$info = array();
$sql = "SELECT * FROM user";
$res = $this->select($sql);
while ($row = mysqli_fetch_array($res)) {
$id = $row['id'];
$sub = $this->processUserRow($row);
$info[$id] = $sub;
}
return $info;
}
private function processUserRow($row)
{
$sub = $this->db->process_mysql_array($row);
$sub['photo_original'] = $row['photo'];
$sub['phone'] = '0' . $sub['phone'];
$sub['photo'] = "upload/user_photo/" . $sub['photo'];
return $sub;
}
public function cheikh_user($uid){
$info=$this->get_user_info();
foreach ($info as $key => $value)
{
$id=$value['id'];
if($uid==$id)return 1;
}
return 0;
}
public function get_login_user(){
$info=$this->get_user_info();
return $info['id'] = $this->loginUserId;
}
public function get_browser($browser){
if(strpos($browser, 'MSIE') !== FALSE)
$browser='Internet explorer';
elseif(strpos($browser, 'Trident') !== FALSE)
$browser='Internet explorer';
elseif(strpos($browser, 'Firefox') !== FALSE)
$browser='Mozilla Firefox';
elseif(strpos($browser, 'Chrome') !== FALSE)
$browser='Google Chrome';
elseif(strpos($browser, 'Opera Mini') !== FALSE)
$browser="Opera Mini";
elseif(strpos($browser, 'Opera') !== FALSE)
$browser="Opera";
elseif(strpos($browser, 'Safari') !== FALSE)
$browser="Safari";
else
$browser='Something else';
return $browser;
}
public function get_user_permission_list($permit){
$sql="";
if($permit=="deactive")$sql="where status=0";
if($permit=="active")$sql="where status=1";
if($permit=="institute")$sql="where permit>5";
if($permit=="techserm")$sql="where permit <=5";
$sql=($sql!="")?"$sql and permit <8":"where permit<8";
$sql="select id from user $sql";
$info=$this->db->get_sql_array($sql);
return $info;
}
public function user_permission_list(){
$per=array();
$sort_name=$this->db->sort_name;
$per[1]="TechSerm Super Admin";
$per[2]="TechSerm Admin";
$per[3]="TechSerm Manager";
$per[4]="TechSerm Engineer";
$per[6]="$sort_name Admin";
$per[7]="$sort_name Accountant";
$per[8]="$sort_name Teacher";
return $per;
}
public function get_user_can_update_option($user_role,$login_user_role){
$list=$this->user_permission_list();
$option_list="<option value='-1'>Select User Role</option>";
foreach ($list as $key => $value) {
$role=$key;
$select="";
if($user_role<$login_user_role)continue;
if($login_user_role>=$role)continue;
if($role==$user_role)$select="selected";
$option_list.="<option value='$role' $select>$value</option>";
}
echo "$option_list";
return $option_list;
}
public function get_user_permission($permission){
$get_per=$this->user_permission_list();
return $get_per[$permission];
}
}
?>