文件目录
包括学生登录界面和管理员登录界面 由于功能相同 只展示管理员登录界面
index.html文件
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>hbu_information</title>
<style>
.header
{
text-align: center;
font-size: 25px;
font-family: monospace;
background-color: beige;
margin-left: 497px;
width: 500px;
}
.content
{
width: 510px;
background-color: #0390f47a;
height: 400px;
margin-left: 488px;
border: 6px #2196f3 solid;
}
.first
{
height: 185px;
border: 4px #03a9f4 solid;
}
.second
{
border: 4px #03a9f4 solid;
height: 200px;
}
.button1
{
float: right;
margin-top: 67px;
margin-right: 222px;
height: 40px;
width: 80px;
background-color: #71c1fb;
font-family: fangsong;
font-weight: bold;
}
.button2
{
float: right;
margin-top: 67px;
margin-right: 222px;
height: 40px;
width: 80px;
background-color: #71c1fb;
font-family: fangsong;
font-weight: bold;
}
</style>
</head>
<div>
<div class="header">
<p>河北大学学生信息管理系统</p>
</div>
<div class="content">
<div class="first">
<a href="./Studentindex.php"><button class="button1">用 户</button></a>
</div>
<div class="second">
<a href="./Adminindex.php"><button class="button2">管 理 员</button></a>
</div>
</div>
</body>
</html>
```html
<!DOCTYPE html>
<html lang="en">
<link href="index.css" type="text/css" rel="Stylesheet"/>
<head>
<title>管理员登录</title>
<meta charset="utf-8">
<style>
body {
background-image: url("static/1.jpg");
background-repeat: no-repeat;
background-size: 100% 100%;
background-attachment: fixed;
}
</style>
</head>
<body>
<div class='all'>
<div class='grey'>
<span class="left">
<img src="static/2.1.jpg" class="hdxh">
</span>
<span class="right">
<p class = 'p' align = "center">河北大学学生信息管理系统</p>
<form align="center"method="POST"action="../php/AdminLogin.php">
<table>
<div>
<label class = 'p'>账号</label>
<input type="text" name="adminname" id="adminname"style="height: 28px;">
</div>
<br>
<div>
<label class = 'p'">密码</label>
<input type="password"name="password" id="password"style="height: 28px;">
</div>
<br>
<input class="submit"type="submit" i value="提交" style="font-size: 20px;">
<br>
<a href="/pages/logins/register/Admin_register.html">还没有账号,请注册 </a>
</table>
</form>
</span>
</div>
</div>
</body>
<script>
function confirmName()
{
var name=document.getElementById("adminname");
name.onblur=function()
{
if((name.value).length!=0){
reg=/^[0-9]{6,16}$/g;
if(!reg.test(name.value)){
alert("对不起,输入的用户名限6-16个数字 ");
}
}
else{
alert("输入账号不能为空");
}
};
}
function confirmPassword()
{
var password=document.getElementById("password");
password.onblur=function()
{
if((password.value).length!=0){
reg=/^(\w){6,20}$/;
if(!reg.test(password.value)){
alert("对不起,您输入的密码格式不正确!");
}
}
};
}
window.onload=function()
{
confirmName();
confirmPassword();
};
</script>
</html>
网页中所带的图片自己去直接百度一个高清就可以 接下来是管理员登录界面的后台处理代码
AdminLogin.php
<?php
session_start();
$link=mysqli_connect('127.0.0.1', 'root', '', 'userinformation') or die('连接或者选择数据库失败');
mysqli_set_charset($link, 'utf8mb4');
$adminname=$_POST['adminname'] ;
$password=$_POST['password'] ;
//对加密密码验证
// password_verify()
$sqlname = "SELECT *from adminindex where adminname = '$adminname'";
$nameresult = mysqli_query($link, $sqlname);
$sql="SELECT * from adminindex where adminname=$adminname and password=$password";
$result= mysqli_query($link, $sql);
if (!mysqli_num_rows($nameresult))
{
echo "<script>alert('账号不存在,请先注册')</script>";
$url = "../register/Admin_register.html";
echo "<script>";
echo " window.location.href='$url' ";
echo "</script>";
}
if (mysqli_num_rows($result)>=1) {
$_SESSION['manage']['name']=$adminname;
echo "<script>alert('登录成功')</script>";
header("location:../admin/admin.php");
} else {
echo "<script>alert('密码错误')</script>";
$url = "../login/Adminindex.php";
echo "<script>";
echo " window.location.href='$url' ";
echo "</script>";
}
mysqli_close($link);
index.css文件
.all
{
position: relative;
width: 100%;
height: 100%;
}
.hdxh {
position: relative;
margin: 10%;
}
.grey {
/* opacity: 0.5;
background-color: #BEE7E9; */
background: rgba(190, 231,233, 0.5);
position: relative;
margin: 80px auto 0 auto;
height: 800px;
width: 910px;
border-radius: 50px;
}
.left {
position: relative;
height: 100%;
display: inline-block;
width: 50%;
top: 179px;
}
.right {
position: relative;
width: 40%;
top: 122px;
display: inline-block;
height: 30%;
padding: 1em;
outline: 10px solid rgb(54 146 151 / 50%);
box-shadow: 0 0 0 5px #596654;
}
.p{
font-weight: bold;
font-size: 20px;
}
.submit{
position: relative;
background: #00CCFF;
border: none;
color: white;
padding: 6px 85px;
}
之后会介绍管理员界面以及增删改查操作