mirror of
https://github.com/LyLme/lylme_spage.git
synced 2024-11-17 14:34:08 +08:00
fix bugs
This commit is contained in:
parent
2ee2c30306
commit
6bbc820e11
@ -1,54 +1,55 @@
|
||||
<?php
|
||||
|
||||
include_once("../include/common.php");
|
||||
if(isset($islogin)==1) {
|
||||
} else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
if(isset($islogin) == 1) {
|
||||
} else {
|
||||
exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
}
|
||||
header('Content-Type:application/json');
|
||||
|
||||
$set= isset($_GET['set']) ? $_GET['set'] : null;
|
||||
$set = isset($_GET['set']) ? $_GET['set'] : null;
|
||||
switch($set) {
|
||||
//修改分组
|
||||
case 'status':
|
||||
//修改分组
|
||||
case 'status':
|
||||
$id = $_POST['id'];
|
||||
$sw = $_POST['status'];
|
||||
$sql = "UPDATE `lylme_apply` SET `apply_status` = '".$sw."' WHERE `lylme_apply`.`apply_id` = ".$id.";";
|
||||
if($sw==1) {
|
||||
if ($DB->query($sql)) {
|
||||
$applyres = $DB->get_row("SELECT * FROM `lylme_apply` WHERE `apply_id` = ".$id);
|
||||
$name=strip_tags(daddslashes($applyres['apply_name']));
|
||||
$url=strip_tags(daddslashes($applyres['apply_url']));
|
||||
$icon=daddslashes($applyres['apply_icon']);
|
||||
$group_id=strip_tags(daddslashes($applyres['apply_group']));
|
||||
$mail=strip_tags(daddslashes($applyres['apply_mail']));
|
||||
$link_order = $DB->count('select MAX(id) from `lylme_links`')+1;
|
||||
$sql1 = "INSERT INTO `lylme_links` (`id`, `name`, `group_id`, `url`, `icon`, `PS`,`link_order`) VALUES (NULL, '" . $name . "', '" . $group_id . "', '" . $url . "', '" . $icon . "', '" . $mail . "的提交 ', '" . $link_order . "');";
|
||||
if($DB->query($sql1)) {
|
||||
exit('{"code": "200","msg":"成功!网站已成功收录!"}');
|
||||
} else {
|
||||
exit('{"code": "-1","操作失败!原因:\n'.$DB->error().'"}');
|
||||
}
|
||||
}
|
||||
} else if($sw==2){
|
||||
if ($DB->query($sql)) {
|
||||
exit('{"code": "200","msg":"操作成功!"}');
|
||||
}
|
||||
else{
|
||||
exit('{"code": "-1","操作失败!原因:\n'.$DB->error().'"}');
|
||||
}
|
||||
}
|
||||
else{
|
||||
exit('{"code": "-2","操作失败!-2"}');
|
||||
}
|
||||
break;
|
||||
case 'delete':
|
||||
$id = $_POST['id'];
|
||||
$delsql = 'DELETE FROM `lylme_apply` WHERE apply_id =' . $id;
|
||||
if ($DB->query($delsql)) {
|
||||
exit('{"code": "200","msg":"操作成功!"}');
|
||||
}else{
|
||||
exit('{"code": "-2","操作失败!-2"}');
|
||||
}
|
||||
break;
|
||||
default:
|
||||
exit('error');
|
||||
break;
|
||||
$sw = $_POST['status'];
|
||||
$sql = "UPDATE `lylme_apply` SET `apply_status` = '" . $sw . "' WHERE `lylme_apply`.`apply_id` = " . $id . ";";
|
||||
if($sw == 1) {
|
||||
if ($DB->query($sql)) {
|
||||
$applyres = $DB->get_row("SELECT * FROM `lylme_apply` WHERE `apply_id` = " . $id);
|
||||
$name = strip_tags(daddslashes($applyres['apply_name']));
|
||||
$url = strip_tags(daddslashes($applyres['apply_url']));
|
||||
$icon = daddslashes($applyres['apply_icon']);
|
||||
$group_id = strip_tags(daddslashes($applyres['apply_group']));
|
||||
$desc = strip_tags(daddslashes($applyres['apply_desc']));
|
||||
$link_order = $DB->count('select MAX(id) from `lylme_links`') + 1;
|
||||
$sql1 = "INSERT INTO `lylme_links` (`id`, `name`, `group_id`, `url`, `icon`, `link_desc`,`link_order`) VALUES (NULL, '" . $name . "', '" . $group_id . "', '" . $url . "', '" . $icon . "', '" . $desc . " ', '" . $link_order . "');";
|
||||
if($DB->query($sql1)) {
|
||||
exit('{"code": "200","msg":"成功!网站已成功收录!"}');
|
||||
} else {
|
||||
exit('{"code": "-1","操作失败!原因:\n' . $DB->error() . '"}');
|
||||
}
|
||||
}
|
||||
} elseif($sw == 2) {
|
||||
if ($DB->query($sql)) {
|
||||
exit('{"code": "200","msg":"操作成功!"}');
|
||||
} else {
|
||||
exit('{"code": "-1","操作失败!原因:\n' . $DB->error() . '"}');
|
||||
}
|
||||
} else {
|
||||
exit('{"code": "-2","操作失败!-2"}');
|
||||
}
|
||||
break;
|
||||
case 'delete':
|
||||
$id = $_POST['id'];
|
||||
$delsql = 'DELETE FROM `lylme_apply` WHERE apply_id =' . $id;
|
||||
if ($DB->query($delsql)) {
|
||||
exit('{"code": "200","msg":"操作成功!"}');
|
||||
} else {
|
||||
exit('{"code": "-2","操作失败!-2"}');
|
||||
}
|
||||
break;
|
||||
default:
|
||||
exit('error');
|
||||
break;
|
||||
}
|
@ -145,7 +145,7 @@ if ($set == 'add') {
|
||||
if ($name == null or $url == null) {
|
||||
echo '<script>alert("保存错误,请确保带星号的都不为空!");history.go(-1);</script>';
|
||||
} else {
|
||||
$sql = "INSERT INTO `lylme_links` (`id`, `name`, `group_id`, `url`, `icon`, `PS`,`link_order`) VALUES (NULL, '" . $name1 . "', '" . $group_id . "', '" . $url . "', '" . $icon . "', '" . $name . "', '" . $link_order . "');";
|
||||
$sql = "INSERT INTO `lylme_links` (`id`, `name`, `group_id`, `url`, `icon`, `link_desc`,`link_order`) VALUES (NULL, '" . $name1 . "', '" . $group_id . "', '" . $url . "', '" . $icon . "', '" . $name . "', '" . $link_order . "');";
|
||||
if ($DB->query($sql)) {
|
||||
echo '<script>alert("添加链接 ' . $name . ' 成功!");window.location.href="./link.php";</script>';
|
||||
} else {
|
||||
|
@ -2,3 +2,6 @@
|
||||
ALTER TABLE `lylme_apply` CHANGE `apply_mail` `apply_desc` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '链接描述';
|
||||
ALTER TABLE `lylme_links` CHANGE `PS` `link_desc` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '链接描述';
|
||||
ALTER TABLE `lylme_tags` ADD `sort` INT NOT NULL DEFAULT '10' COMMENT '权重' AFTER `tag_target`;
|
||||
ALTER TABLE `lylme_config` ADD UNIQUE( `k`);
|
||||
ALTER TABLE `lylme_config` DROP PRIMARY KEY;
|
||||
ALTER TABLE `lylme_config` ADD `id` INT NOT NULL AUTO_INCREMENT COMMENT 'ID' FIRST, ADD PRIMARY KEY (`id`);
|
Loading…
Reference in New Issue
Block a user