From 2ef908a892039631bbd11b151a2c69b57986f662 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=8C=81=E5=A3=AE=E6=88=90=E9=95=BF?= <2291200076@qq.com>
Date: Sat, 16 Jan 2021 03:58:37 +0800
Subject: [PATCH 1/4] =?UTF-8?q?=E9=92=88=E5=AF=B9=E8=BF=99=E4=B8=AA?=
=?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=97=A0=E6=B3=95=E5=9C=A8=E7=BD=91=E7=AB=99?=
=?UTF-8?q?=E9=9D=9E=E6=A0=B9=E7=9B=AE=E5=BD=95=E4=B8=8B=E8=BF=90=E8=A1=8C?=
=?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C=E6=88=91=E5=A4=A7=E8=87=B4?=
=?UTF-8?q?=E4=B8=8A=E9=98=85=E8=AF=BB=E4=BA=86=E4=B8=80=E9=81=8D=E4=BD=A0?=
=?UTF-8?q?=E7=9A=84=E9=A1=B9=E7=9B=AE=E4=BB=A3=E7=A0=81=EF=BC=8C=E7=84=B6?=
=?UTF-8?q?=E5=90=8E=E5=81=9A=E5=87=BA=E4=BA=86=E7=9B=B8=E5=BA=94=E6=94=B9?=
=?UTF-8?q?=E5=8A=A8=EF=BC=8C=E6=88=91=E5=9C=A8=E6=9C=AC=E5=9C=B0=E4=BB=A5?=
=?UTF-8?q?=E5=8F=8A=E9=83=A8=E7=BD=B2=E5=88=B0=E6=9C=8D=E5=8A=A1=E5=99=A8?=
=?UTF-8?q?=E4=B8=8A=E6=B5=8B=E8=AF=95=E8=BF=87=EF=BC=8C=E5=9D=87=E5=8F=AF?=
=?UTF-8?q?=E4=BB=A5=E6=AD=A3=E5=B8=B8=E8=BF=90=E8=A1=8C=EF=BC=88=E4=B8=8D?=
=?UTF-8?q?=E8=BF=87=E5=AF=B9=E4=BA=8E=E9=83=A8=E7=BD=B2=E5=9C=A8=E5=AD=90?=
=?UTF-8?q?=E7=9B=AE=E5=BD=95=E7=9A=84=E7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TF-8?q?=E5=A5=BD=EF=BC=8C=E7=BB=A7=E7=BB=AD=E5=8A=A0=E6=B2=B9=EF=BC=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
controller/admin.php | 4 ++--
controller/login.php | 4 +++-
templates/admin/header.php | 14 +++++++-------
templates/admin/left.php | 8 ++++----
templates/admin/static/embed.js | 32 +++++++++++++++----------------
templates/default/index.php | 2 +-
templates/default/static/embed.js | 8 ++++----
7 files changed, 37 insertions(+), 35 deletions(-)
diff --git a/controller/admin.php b/controller/admin.php
index df1bde4..a02de16 100644
--- a/controller/admin.php
+++ b/controller/admin.php
@@ -64,7 +64,7 @@
//清除cookie
setcookie("key", $key, -(time()+7 * 24 * 60 * 60),"/");
//跳转到首页
- header('location:/');
+ header('location:'.dirname($_SERVER['PHP_SELF']));
exit;
}
@@ -104,7 +104,7 @@ function check_auth($user,$password){
$cookie = $_COOKIE['key'];
//如果cookie的值和计算的key不一致,则没有权限
if( $cookie != $key ){
- exit("
");
+ exit("");
}
}
diff --git a/controller/login.php b/controller/login.php
index 6890712..40e7f9e 100644
--- a/controller/login.php
+++ b/controller/login.php
@@ -12,7 +12,9 @@
//如果已经登录,直接跳转
if( $cookie == $key ){
- header('location:index.php?c=admin');
+ $phpSelf = dirname($_SERVER['PHP_SELF']);
+ $phpSelf = ($phpSelf == "/" || $phpSelf == "\\") ? "" : $phpSelf;
+ header('location:'.$phpSelf.'/index.php?c=admin');
exit;
}
diff --git a/templates/admin/header.php b/templates/admin/header.php
index 4a63226..463ab58 100644
--- a/templates/admin/header.php
+++ b/templates/admin/header.php
@@ -10,14 +10,14 @@
diff --git a/templates/default/static/embed.js b/templates/default/static/embed.js
index ce54c9b..4d329a0 100644
--- a/templates/default/static/embed.js
+++ b/templates/default/static/embed.js
@@ -79,20 +79,20 @@ function admin_menu() {
var link_id = $(this).attr('id');
link_id = link_id.replace('id_','');
var tempwindow=window.open('_blank');
- tempwindow.location='index.php?c=click&id='+link_id;
+ tempwindow.location='./index.php?c=click&id='+link_id;
}},
"edit": {name: "编辑", icon: "edit",callback:function(key,opt){
var link_id = $(this).attr('id');
link_id = link_id.replace('id_','');
var tempwindow=window.open('_blank');
- tempwindow.location='index.php?c=admin&page=edit_link&id='+link_id;
+ tempwindow.location='./index.php?c=admin&page=edit_link&id='+link_id;
}},
"delete": {name: "删除", icon: "delete",callback:function(){
var link_id = $(this).attr('id');
link_id = link_id.replace('id_','');
mdui.confirm('确认删除?',
function(){
- $.post("index.php?c=api&method=del_link",{id:link_id},function(data,status){
+ $.post("./index.php?c=api&method=del_link",{id:link_id},function(data,status){
//如果删除成功,则移除元素
if(data.code == 0) {
$("#id_" + link_id).remove();
@@ -166,7 +166,7 @@ $.contextMenu({
var link_id = $(this).attr('id');
link_id = link_id.replace('id_','');
var tempwindow=window.open('_blank');
- tempwindow.location='index.php?c=click&id='+link_id;
+ tempwindow.location='./index.php?c=click&id='+link_id;
}},
"sep1": "---------",
"qrcode": {name: "二维码", icon:"fa-qrcode",callback:function(data,status){
From dd08d69b21848ebd71320f5af4ca60c382c294e7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=8C=81=E5=A3=AE=E6=88=90=E9=95=BF?= <2291200076@qq.com>
Date: Sat, 16 Jan 2021 17:30:27 +0800
Subject: [PATCH 2/4] Update index.php
---
controller/index.php | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/controller/index.php b/controller/index.php
index 00a78a2..35e6251 100644
--- a/controller/index.php
+++ b/controller/index.php
@@ -101,8 +101,9 @@ function base64($url){
$host = $urls['host'];
//获取端口
$port = empty( $urls['port'] ) ? '' : ':'.$urls['port'];
+ $dir = dirname($_SERVER['PHP_SELF']);
- $new_url = $scheme.$host.$port;
+ $new_url = $scheme.$host.$port.$dir;
return base64_encode($new_url);
}
@@ -119,4 +120,4 @@ function base64($url){
// 载入前台首页模板
require('templates/'.TEMPLATE.'/index.php');
-?>
\ No newline at end of file
+?>
From eff09869f3e6357356102ef02f7b933a4fe8b24a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=8C=81=E5=A3=AE=E6=88=90=E9=95=BF?= <2291200076@qq.com>
Date: Sat, 16 Jan 2021 17:33:23 +0800
Subject: [PATCH 3/4] Update index.php
---
controller/index.php | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/controller/index.php b/controller/index.php
index 35e6251..aa4a93f 100644
--- a/controller/index.php
+++ b/controller/index.php
@@ -101,9 +101,8 @@ function base64($url){
$host = $urls['host'];
//获取端口
$port = empty( $urls['port'] ) ? '' : ':'.$urls['port'];
- $dir = dirname($_SERVER['PHP_SELF']);
- $new_url = $scheme.$host.$port.$dir;
+ $new_url = $scheme.$host.$port;
return base64_encode($new_url);
}
From 94526471a0c13e72d184af5b06cdc0441db7b82e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=8C=81=E5=A3=AE=E6=88=90=E9=95=BF?= <2291200076@qq.com>
Date: Sat, 16 Jan 2021 17:37:36 +0800
Subject: [PATCH 4/4] Update index.php
---
templates/default/index.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/templates/default/index.php b/templates/default/index.php
index 3d30253..646eced 100644
--- a/templates/default/index.php
+++ b/templates/default/index.php
@@ -125,7 +125,7 @@
-
+