-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser.php
49 lines (40 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
<?php
class User{
// master revised
public function __construct(){
/*
1. new Branch
2. revise and sync to master
*/
}
public function get_user_data($account, $user_id=FALSE){
if($user_id){
$sql_user_data = "SELECT * FROM `jianda_user_administrator` WHERE `admin_id` = ? ";
$query_user_data = $this->db->query($sql_user_data, array($user_id));
return $query_user_data->result_array();
}else{
$sql_user_data = "SELECT * FROM `jianda_user_administrator` WHERE `admin_account` LIKE ? ";
$query_user_data = $this->db->query($sql_user_data, array($account));
return $query_user_data->result_array();
}
}
public function get_user_ip(){
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED'])) {
$ip = $_SERVER['HTTP_X_FORWARDED'];
} elseif (!empty($_SERVER['HTTP_X_CLUSTER_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_X_CLUSTER_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_FORWARDED_FOR'];
} elseif (!empty($_SERVER['HTTP_FORWARDED'])) {
$ip = $_SERVER['HTTP_FORWARDED'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}
}
?>