From 6bbc820e11857ecc8ce114a467260489a2cd885f Mon Sep 17 00:00:00 2001 From: LyLme Date: Mon, 25 Dec 2023 22:26:12 +0800 Subject: [PATCH] fix bugs --- admin/ajax_apply.php | 97 ++++++++++++++++++++-------------------- admin/link.php | 2 +- install/data/update8.sql | 5 ++- 3 files changed, 54 insertions(+), 50 deletions(-) diff --git a/admin/ajax_apply.php b/admin/ajax_apply.php index a6a79fe..35e7119 100644 --- a/admin/ajax_apply.php +++ b/admin/ajax_apply.php @@ -1,54 +1,55 @@ window.location.href='./login.php';"); +if(isset($islogin) == 1) { +} else { + exit(""); +} 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; -} \ No newline at end of file + $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; +} diff --git a/admin/link.php b/admin/link.php index f450591..56c3ed8 100644 --- a/admin/link.php +++ b/admin/link.php @@ -145,7 +145,7 @@ if ($set == 'add') { if ($name == null or $url == null) { echo ''; } 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 ''; } else { diff --git a/install/data/update8.sql b/install/data/update8.sql index 463c8f4..35db018 100644 --- a/install/data/update8.sql +++ b/install/data/update8.sql @@ -1,4 +1,7 @@ -- v1.8.0 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`; \ No newline at end of file +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`); \ No newline at end of file