-
Notifications
You must be signed in to change notification settings - Fork 3
/
groupmanage.php
102 lines (99 loc) · 3.48 KB
/
groupmanage.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
// * the Free Software Foundation, either version 3 of the License, or
// * (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have received a copy of the GNU General Public License
// * along with this program. If not, see <http://www.gnu.org/licenses/>.
// *
// * @author Xianglong He
// * @copyright Copyright (c) 2015 Xianglong He. (http://tec.hxlxz.com)
// * @license http://www.gnu.org/licenses/ GPL v3
// * @version 1.0
// * @discribe RuiRuiQQ群设置
?>
<?php
//解决变量未定义报错
function _rowget($str,$row)
{
$val = !empty($row[$str]) ? $row[$str] : null;
return $val;
}
//屏蔽部分错误信息
error_reporting(E_ALL ^ E_DEPRECATED ^ E_NOTICE);
require 'config.php';
//连接数据库
require 'database.php';
if($_REQUEST['action']=="set")
{
if($_REQUEST['password'] != $AdminPass)
{
exit("Wrong Password");
}
$sql = "SELECT * FROM groupmanage WHERE gno = '$_REQUEST[gno]' limit 1";
$result = $mysqli->query($sql);
$row = mysqli_fetch_array($result);
if($row == "")
{
$sql = "INSERT INTO groupmanage (gno, $_REQUEST[option]) VALUES ('$_REQUEST[gno]', '$_REQUEST[value]')";
$mysqli->query($sql);
$mysqli->close();
}
else
{
$sql = "UPDATE groupmanage set $_REQUEST[option] = '$_REQUEST[value]' WHERE gno = '$_REQUEST[gno]'";
$mysqli->query($sql);
$mysqli->close();
}
echo "{";
echo "\"statu\":\"success\"";
echo "}";
}
else if($_REQUEST['action']=="get")
{
$sql = "SELECT * FROM groupmanage WHERE gno = '".$mysqli->real_escape_string($_REQUEST[gno])."' limit 1";
$result = $mysqli->query($sql);
$row = mysqli_fetch_array($result);
if($row != "")
{
echo "{";
echo "\"enable\":\"".$row['enable']."\",";
echo "\"enableWeather\":\"".$row['enableWeather']."\",";
echo "\"enableExchangeRate\":\"".$row['enableExchangeRate']."\",";
echo "\"enableStock\":\"".$row['enableStock']."\",";
echo "\"enableStudy\":\"".$row['enableStudy']."\",";
echo "\"enabletalk\":\"".$row['enabletalk']."\",";
echo "\"enablexhj\":\"".$row['enablexhj']."\",";
echo "\"enableemoje\":\"".$row['enableemoje']."\",";
echo "\"enableCityInfo\":\"".$row['enableCityInfo']."\",";
echo "\"enableWiki\":\"".$row['enableWiki']."\",";
echo "\"enableTranslate\":\"".$row['enableTranslate']."\",";
echo "\"gno\":\"".$row['gno']."\",";
echo "\"statu\":\"success\"";
echo "}";
$mysqli->close();
}
else
{
echo "{";
echo "\"gno\":\"".str_ireplace("script","script",filter_var($_REQUEST[gno], FILTER_SANITIZE_SPECIAL_CHARS))."\",";
echo "\"statu\":\"fail\",";
echo "\"error\":\"nodata\"";
echo "}";
}
}
else
{
echo "{";
echo "\"gno\":\"".str_ireplace("script","script",filter_var($_REQUEST[gno], FILTER_SANITIZE_SPECIAL_CHARS))."\",";
echo "\"statu\":\"fail\",";
echo "\"error\":\"notsupport\"";
echo "}";
}
?>