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 @@ if ($page == 'logout') {
//清除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 @@ $cookie = $_COOKIE['key'];
//如果已经登录,直接跳转
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){