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.
97 lines
3.5 KiB
97 lines
3.5 KiB
<?php
|
|
if (isset($_REQUEST["function_name"])) {
|
|
$function_name = $_REQUEST["function_name"];
|
|
$function_flag = True;
|
|
}else{
|
|
$function_name = "";
|
|
$function_flag = False;
|
|
}
|
|
|
|
/**
|
|
* 查詢登入者資料
|
|
*/
|
|
function get_user_info() {
|
|
global $_COOKIE, $link;
|
|
|
|
if ($link && !$_COOKIE["_m"]) {
|
|
$uid = substr($_COOKIE["token"], 0, strpos($_COOKIE["token"],"."));
|
|
$db_query = "select accounttype, name from appwms.account where accountid = '$uid'";
|
|
$res = mysqli_query($link, $db_query);
|
|
foreach ($res as $acct) {
|
|
if ($acct["accounttype"] == "H") $uname = $acct["name"];
|
|
setcookie("_m", serialize($uid.";".$uname), time()+86400, "", $_SERVER["HTTP_HOST"]);
|
|
}
|
|
}
|
|
}
|
|
|
|
// 檢查登入者
|
|
get_user_info();
|
|
list($uid, $uname) = explode(";", unserialize($_COOKIE["_m"]));
|
|
$user_str = $uname."(".$uid.")";
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link rel="stylesheet" href="css/styles.css" />
|
|
<link rel="stylesheet" href="css/bootstrap.min.css">
|
|
<script src="css/jquery.min.js"></script>
|
|
<script src="css/bootstrap.min.js"></script>
|
|
<script src="css/jquery.dataTables.min.js"></script>
|
|
<script src="css/dataTables.bootstrap4.min.js"></script>
|
|
<script src="css/function.js"></script>
|
|
<script>
|
|
$(document).ready(function() {
|
|
$('#table_index').DataTable();
|
|
if(window.localStorage){
|
|
var tokendata=window.localStorage.getItem("token");
|
|
|
|
if(tokendata==null){
|
|
window.location.href="login.php";
|
|
}
|
|
}else{
|
|
var tokendata=$.cookie("token");
|
|
}
|
|
|
|
var url = "headerapi.php";
|
|
$.ajax({
|
|
method: 'post',
|
|
url: url,
|
|
data: {
|
|
token:tokendata
|
|
},
|
|
success: function (data) {
|
|
var res=eval('('+data+')');
|
|
if(res.code!='200'){
|
|
window.location.href='login.php?errno=3';
|
|
} else {
|
|
$(".header-right > a").html(res.user_name+"("+res.user_id+")");
|
|
}
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<nav class="navbar navbar-inverse">
|
|
<div class="container-fluid">
|
|
<div class="navbar-header">
|
|
<a class="navbar-brand" href="#">Masada</a>
|
|
</div>
|
|
<ul class="nav navbar-nav">
|
|
<!-- <li class="active"><a href="#">Home</a></li> -->
|
|
<li class="dropdown">
|
|
<a class="dropdown-toggle" data-toggle="dropdown" href="#">新梯後台
|
|
<span class="caret"></span></a>
|
|
<ul class="dropdown-menu">
|
|
<?php /*<li <?php if (($function_name == "account") and ($function_flag == True)) echo "class='active'" ?>><a href="account-index.php?function_name=account">有望客戶</a></li>*/ ?>
|
|
<li <?php if (($function_name == "pricereview") and ($function_flag == True)) echo "class='active'" ?>><a href="pricereview-index.php?function_name=pricereview">價格審查</a></li>
|
|
<li <?php if (($function_name == "specsurvey") and ($function_flag == True)) echo "class='active'" ?>><a href="specsurvey-index.php?function_name=specsurvey">規格調查</a></li>
|
|
<li <?php if (($function_name == "contractapply") and ($function_flag == True)) echo "class='active'" ?>><a href="contractapply-index.php?function_name=contractapply">合約申請</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<div class="header-right">
|
|
<a class="navbar-brand" href="#"><?php echo $user_id;?></a>
|
|
</div>
|
|
</nav>
|