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.
wastesortingserver/index.php

65 lines
1.8 KiB

5 years ago
<?php
5 years ago
5 years ago
require_once $_SERVER["DOCUMENT_ROOT"] . "/config.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/head.php";
getMenu("后台管理");
5 years ago
require_once $_SERVER["DOCUMENT_ROOT"] . "/admin/Login.php";
if (!check_login()) {
error_res("您尚未登陆,跳转到登陆页", "/admin/Manager.php");
return;
}
5 years ago
require_once $_SERVER["DOCUMENT_ROOT"] . "/entity/Menu.php";
5 years ago
//菜单信息
$menus = array("API" => new Menu("百度AK/SK配置", "/admin/ApiConfig.php"), new Menu("垃圾分类", "/admin/WasteSorting.php"), new Menu("题目管理", "/admin/Question.php"));
5 years ago
5 years ago
echo <<<EOF
<script>
function logout() {
if(confirm("确认退出?")){
5 years ago
delCookie("login_token");
delCookie("manager_name");
location.href="/admin/Manager.php"
}
}
</script>
5 years ago
<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) {
5 years ago
if ($value instanceof Menu) {
echo '<li class="nav-item">';
echo '<a class="nav-link" href="' . $value->getInterface() . '">' . $value->getName() . '</a>';
echo '</li>';
}
5 years ago
}
$manager_name = $_COOKIE["manager_name"];
5 years ago
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>
5 years ago
</li>
</ul>
</div>
</nav>
EOF;