Admin.php
2.56 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
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminBase.php" ;?>
<?
/*
* Admin process
* add by dev.lee
* */
if(!class_exists("Admin")){
class Admin extends AdminBase {
function __construct($req)
{
parent::__construct($req);
}
function wrapParam()
{
$this->req['page'] = ($this->req['page'] == "") ? 1 : $this->req['page'] ;
}
function getAddQuery()
{
$addQuery = "" ;
$addQuery .= $this->getSearchQuery() ;
return $addQuery ;
}
function login()
{
$id = $this->req[adm_id];
$pass = MD5($this->req[adm_pw]);
$sql = "
SELECT adm.*
FROM tbl_admin adm
WHERE adm.admin_id = '{$id}' AND adm.admin_pwd = '{$pass}' AND adm.is_apply = 1
LIMIT 0, 1
";
$retVal = $this->getRow($sql);
if($retVal == null)
{
$_REQUEST[msg] = "로그인 정보가 일치하지 않습니다. 확인해주세요.";
return;
}
else
{
LoginUtil::doAdminLogin($retVal);
$_REQUEST[rurl] = bin2hex("/admin/userManage/userList.php");
}
}
//계정 정보 조회
function getAdminInfo()
{
$no = $this->admUser["no"];
$sql = "
SELECT adm.*
FROM tbl_admin adm
WHERE adm.no = '{$no}' AND adm.is_apply = 1
LIMIT 0, 1
";
$result = $this->getRow($sql);
return $result;
}
function checkLogin(){
if(LoginUtil::isAdminLogin() == false){
$rurl = bin2hex($_SERVER[REQUEST_URI]) ;
if(stristr($_SERVER[REQUEST_URI],"pop"))
echo "<script>alert('관리자로 로그인 후 이용할 수 있습니다.') ; opener.location.href = 'index.php'; self.close();</script>" ;
else
echo "<script>alert('관리자로 로그인 후 이용할 수 있습니다.') ; location.href = 'index.php' ;</script>" ;
}
}
function logout(){
LoginUtil::doAdminLogout();
$_REQUEST[rurl] = bin2hex("/admin/index.php");
}
function updateShopLocation($latitude, $longitude, $no){
$sql = "UPDATE tbl_shop
SET latitude = '{$latitude}', longitude = '{$longitude}'
WHERE no = '{$no}'";
$this->update($sql);
}
function getMinShopNo(){
$sql = "SELECT MIN(no) AS cnt FROM tbl_shop
WHERE latitude = -1 AND (addr_old != '' OR addr_new != '')
ORDER BY no";
return $this->getValue($sql, "cnt");
}
function getShopLocation($count){
$sql = "SELECT no ,addr_old, addr_new FROM tbl_shop
WHERE (latitude = -1 OR longitude = -1)
AND (addr_old != '' OR addr_new != '')
AND no > {$count}
ORDER BY no
LIMIT 0, 100";
return $this->getArray($sql);
}
}
}
?>