📄 menu.php
字号:
<?php
if (!isset($_SESSION)) session_start();
if ( isset ( $_GET["op"] ) && $_GET["op"] == "logout" ) {
unset ( $_SESSION["MM_Username"] );
session_unset();
session_destroy ();
header ( "Location login.php" );
}
$currentPage = basename ( $PHP_SELF ); // 获取当前页路径
// 从会员变量中读取用户名信息
// 当会员登录到网站后,用户名被保存到会话变量MM_Username中
if ( isset ( $_SESSION["MM_Username"] ) )
$username = $_SESSION["MM_Username"];
else
$username = "游客";
?>
<img src="images/logo.gif" width="159" height="31" />
<table width="99%" border="0" align="center" cellpadding="1" cellspacing="1" class="tbbd">
<tr>
<td width="12%" align="center" nowrap="nowrap">欢迎您,<?php echo $username; ?> </td>
<?php if ( strcmp ( $currentPage, "index.php" ) == 0) { ?>
<td width="12%" align="center" nowrap="nowrap" class="selected">»系统首页«</td>
<?php } else { ?>
<td width="12%" align="center" nowrap="nowrap"><a href="index.php">系统首页</a></td>
<?php } ?>
<?php if ( strcmp ( $currentPage, "login.php" ) == 0 ) { ?>
<td width="12%" align="center" nowrap="nowrap" class="selected">»会员登录«</td>
<?php } else { ?>
<td width="12%" align="center" nowrap="nowrap"><a href="login.php">会员登录</a></td>
<?php } ?>
<?php if ( strcmp ( $currentPage, "register.php" ) == 0 ) { ?>
<td width="12%" align="center" nowrap="nowrap" class="selected">»会员注册«</td>
<?php } else { ?>
<td width="12%" align="center" nowrap="nowrap"><a href="register.php">会员注册</a></td>
<?php } ?>
<?php if ( preg_match ( "/^getpwd/", $currentPage ) ) { ?>
<td width="12%" align="center" nowrap="nowrap" class="selected">»找回密码«</td>
<?php } else { ?>
<td width="12%" align="center" nowrap="nowrap"><a href="getpwd1.php">找回密码</a></td>
<?php } ?>
<?php if ( strcmp ( $currentPage, "modify.php" ) == 0 ) { ?>
<td width="12%" align="center" nowrap="nowrap" class="selected">»修改资料«</td>
<?php } else { ?>
<td width="12%" align="center" nowrap="nowrap"><a href="modify.php">修改资料</a></td>
<?php } ?>
<?php if ( strcmp ( $currentPage, "select.php" ) == 0 || strcmp ( $currentPage, "upload.php" ) == 0 ) { ?>
<td width="12%" align="center" nowrap="nowrap" class="selected">»上传照片«</td>
<?php } else { ?>
<td width="12%" align="center" nowrap="nowrap"><a href="upload.php">上传照片</a></td>
<?php } ?>
<?php if ( strcmp ( $currentPage, "manage.php" ) == 0 ) { ?>
<td width="12%" align="center" nowrap="nowrap" class="selected">»系统维护«</td>
<?php } else { ?>
<td width="12%" align="center" nowrap="nowrap"><a href="manage.php">系统维护</a></td>
<?php } ?>
<?php if( $username != "游客" ){ ?>
<td width="12%" align="center" nowrap="nowrap"><a href="login.php?op=logout">注销</a></td>
<?php } ?>
</tr>
</table>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -