Skip to content

Commit

Permalink
后台执行删除
Browse files Browse the repository at this point in the history
  • Loading branch information
iVampireSP committed Jul 8, 2020
1 parent c625cad commit f813b17
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
9 changes: 5 additions & 4 deletions php/config/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ function adminDelserver($serverid, $db_con)
echo 'System Error!';
return '*';
}
// 删除对应节点的目录(如果你希望保留服务器数据,可以注释下面两行)
$shell = "curl \"http://$ip_port/?token=$token&action=del&servername=$r_servername\" -X POST";
// 在后台执行:删除对应节点的目录(如果你希望保留服务器数据,可以注释下面两行)
$shell = "nohup curl \"http://$ip_port/?token=$token&action=del&servername=$r_servername\" -X POST >> /dev/null 2>&1";
exec($shell, $out);
// 执行删除
$sql = "DELETE FROM `servers` WHERE `id` = $serverid";
Expand Down Expand Up @@ -357,7 +357,7 @@ function adminListallserver($db_con)
$serverid = $row['id'];
if (empty($row['date'])) {
$date = '<a style="color: blue; text-decoration: none;" href="renew_server.php?serverid=' . $serverid . '">' . '永久' . '</a>';
}else {
} else {
$date = '<a style="color: blue; text-decoration: none;" href="renew_server.php?serverid=' . $serverid . '">' . $row['date'] . '</a>';
}
echo
Expand Down Expand Up @@ -401,7 +401,8 @@ function adminListallserver($db_con)
}

// 管理员:续费服务器
function adminRenewserver($serverid, $newdate, $db_con) {
function adminRenewserver($serverid, $newdate, $db_con)
{
// 自己人,别开枪
$newdate = mysqli_real_escape_string($db_con, $newdate);
$sql = "UPDATE `servers` SET `date` = '$newdate' WHERE `servers`.`id` = $serverid";
Expand Down
10 changes: 6 additions & 4 deletions php/config/functions_win.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ function checkLogin($db_con)
/* 管理员功能部分 */

// 管理员:验证管理员密码
function adminLogin($password, $admin_password) {
function adminLogin($password, $admin_password)
{
if ($password == $admin_password) {
$_SESSION['admin_login'] = 1;
echo '<script>window.location.replace("/admin/dash.php");</script>';
Expand Down Expand Up @@ -302,8 +303,8 @@ function adminDelserver($serverid, $db_con)
echo 'System Error!';
return '*';
}
// 删除对应节点的目录(如果你希望保留服务器数据,可以注释下面两行)
$shell = "curl \"http://$ip_port/?token=$token&action=del&servername=$r_servername\" -X POST";
// 在后台执行:删除对应节点的目录(如果你希望保留服务器数据,可以注释下面两行)
$shell = "start /b curl \"http://$ip_port/?token=$token&action=del&servername=$r_servername\" -X POST";
exec($shell, $out);
// 执行删除
$sql = "DELETE FROM `servers` WHERE `id` = $serverid";
Expand Down Expand Up @@ -394,7 +395,8 @@ function adminListallserver($db_con)
}

// 管理员:续费服务器
function adminRenewserver($serverid, $newdate, $db_con) {
function adminRenewserver($serverid, $newdate, $db_con)
{
// 自己人,别开枪
$newdate = mysqli_real_escape_string($db_con, $newdate);
$sql = "UPDATE `servers` SET `date` = '$newdate' WHERE `servers`.`id` = $serverid";
Expand Down

0 comments on commit f813b17

Please sign in to comment.