You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.8 KiB
64 lines
1.8 KiB
<?php
|
|
|
|
require_once $_SERVER["DOCUMENT_ROOT"] . "/config.php";
|
|
require_once $_SERVER["DOCUMENT_ROOT"] . "/head.php";
|
|
|
|
getMenu("后台管理");
|
|
|
|
require_once $_SERVER["DOCUMENT_ROOT"] . "/admin/Login.php";
|
|
|
|
if (!check_login()) {
|
|
error_res("您尚未登陆,跳转到登陆页", "/admin/Manager.php");
|
|
return;
|
|
}
|
|
|
|
|
|
require_once $_SERVER["DOCUMENT_ROOT"] . "/entity/Menu.php";
|
|
|
|
//菜单信息
|
|
$menus = array("API" => new Menu("百度AK/SK配置", "/admin/ApiConfig.php"), new Menu("垃圾分类", "/admin/WasteSorting.php"), new Menu("题目管理", "/admin/Question.php"));
|
|
|
|
|
|
|
|
|
|
echo <<<EOF
|
|
<script>
|
|
function logout() {
|
|
if(confirm("确认退出?")){
|
|
delCookie("login_token");
|
|
delCookie("manager_name");
|
|
location.href="/admin/Manager.php"
|
|
}
|
|
}
|
|
</script>
|
|
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
|
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
<div class="collapse navbar-collapse" id="navbarNav">
|
|
<ul class="navbar-nav">
|
|
EOF;
|
|
foreach ($menus as $key => $value) {
|
|
|
|
if ($value instanceof Menu) {
|
|
echo '<li class="nav-item">';
|
|
|
|
echo '<a class="nav-link" href="' . $value->getInterface() . '">' . $value->getName() . '</a>';
|
|
|
|
echo '</li>';
|
|
}
|
|
|
|
}
|
|
$manager_name = $_COOKIE["manager_name"];
|
|
echo <<<EOF
|
|
<li class="nav-item">
|
|
<a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true"><span style="color: black">欢迎管理员<b style="color: red">$manager_name</b>登陆</span></a>
|
|
</li>
|
|
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="#" onclick="logout()"><span style="color: red">退出</span</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</nav>
|
|
EOF;
|
|
|