adminlogin.php

来自「php开发实例完全剖析」· PHP 代码 · 共 55 行

PHP
55
字号
<?php
session_start();

if($_SESSION['UserName']=='admin' | $_session['UserName']=='Admin') {
	// 管理员已经在线,则重定向到在线用户管理页面,以便管理在线用户
	header("Location:AdminOnlineUser.php");
	// 登录过的话,立即结束
   exit;
}
?>
<html>

<script language="javascript"> 
    function checklogin()
    { 
      if ((login.username.value!="") && (login.password.value!=""))
        // 如果昵称和密码均不为空,则返回true
         return true
      else {
        // 如果昵称或密码为空,则显示警告信息
         alert("昵称或密码不能为空!")
         return false
         } 
    } 
</script>

<body>
<form action="ChkAdmLogin.php" method="post" name="login" onsubmit="return checklogin()">
<p align="center">聊天室管理员登录</p>
<table align="center" border="0">
 <tr>
  <th>
管理员:
  </th>
  <th>
<input type="text" name="username">
  </th>
 </tr>
 <tr>
  <th>
密 码:
  </th>
  <th>
<input type="password" name="password">
  </th>
 </tr>
 <tr>
  <th colspan="2" align="right">
<input type="submit" value="登录">
</form>
  </th>
 </tr>
</table>
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?