php学生信息管理系统 phpstudy HBuilder

这是一个基于PHP和MySQL的学生信息管理系统,包括用户和管理员的注册、登录功能。管理员可以进行学生信息的增删查改,普通用户能查询学号对应的学生信息。主要文件有login.html、user.html、check.php等,涉及数据库连接、插入、查找和删除操作。
摘要由CSDN通过智能技术生成

注册,登录(普通用户和管理员)

启动phpstudy 在www文件夹建立我们的项目文件student

建立数据库test student表
建立userinfo表用于登录
login.html

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		
		<title>登录界面</title>
		<style>
			html{
    
			    height: 100%;
			}
			body{
    
			    height: 100%;
			    font-family: 'JetBrains Mono Medium';
			    display: flex;
			    align-items: center;
			    justify-content: center;
			    background-color: black;
			}
			.form-wrapper{
    
			    width: 300px;
			    background-color: rgb(41,45,62);
			    color: #ffffff;
			    border-radius: 2px;
			    padding: 50px;
			}
			.form-wrapper .header{
    
			    text-align: center;
			    font-size: 35px;
			    text-transform: uppercase;
			    line-height: 100px;
			}
			.form-wrapper .action{
    
			    display: flex;
			    justify-content: center;
			}
			.form-wrapper .action .btn{
    
			    width: 60%;
			    text-transform: uppercase;
			    border: 2px solid #FFFFFF;
			    text-align: center;
			    line-height: 20px;
			    border-radius: 20px;
			    cursor: pointer;
			    transition:0.2s;
			}
		</style>
	</head>
	<body>	
					<div class="form-wrapper" align="center" >
						<div class="header">
						        用户登录
						</div>
						
					     <form action="check.php" method="post">
						    <p>用户名:<input type="text" name="username" placeholder="手机号/邮箱" /></p>
					        
					         <p>密码:<input type="password" name="password" placeholder="密码可见" /></p>
					         
					<br />
					<button class="btn">登录</button>
					<p>
						没有账号?请
						<a href="regist.html">注册</a>
						
					</p>
						<div style="clear: both;"></div>
					</form>
					
				</div>
	</body>
</html>

user.html

<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>首页</title>
	<style>
		html{
    
		    height: 100%;
		}
		body{
    
		    height: 100%;
		    font-family: 'JetBrains Mono Medium';
		    display: flex;
		    align-items: center;
		    justify-content: center;
		    background-color: black;
		}
		.form-wrapper{
    
		    width: 300px;
		    background-color: rgb(41,45,62);
		    color: #ffffff;
		    border-radius: 2px;
		    padding: 50px;
		}
		.form-wrapper .header{
    
		    text-align: center;
		    font-size: 35px;
		    text-transform: uppercase;
		    line-height: 100px;
		}
		.form-wrapper .action{
    
		    display: flex;
		    justify-content: center;
		}
		.form-wrapper .action .btn{
    
		    width: 60%;
		    text-transform: uppercase;
		    border: 2px solid #FFFFFF;
		    text-align: center;
		    line-height: 50px;
		    border-radius: 30px;
		    cursor: pointer;
		    transition:0.2s;
		}
	</style>
</head>

<body>
<div class="form-wrapper" align="center" >
	<div class="header">
	        TA反馈系统
	</div>
   
    <div class="action">
        <div class="btn"><a href="InsertStudent.php">添加学生记录</a></div>
    </div>
	<div class="action">
	    <div class="btn"><a href="StudentList.php">查看学生列表</a></div>
	</div>
    
    
</div>
</body>
</html>

#登录逻辑:check.php(判断是不是管理员,还是普通人

check.php

<?php
        header("Content-type: text/html; charset=utf-8");
		$username = $_POST['username'];
		$password = $_POST['password'];
		$is_manager=$_POST['is_manager'];
		if ($username == ''){
   
		    echo '<script>alert("请输入用户名!");history.go(-1);</script>';
		    exit(0);
		}
		if ($password == ''){
   
		    echo '<script>alert("请输入密码");history.go(-1);</script>';
		    exit(0);
		}
		
		
		$conn = new mysqli('localhost','root','root','test');
			    if ($conn->connect_error){
   
			        echo '数据库连接失败!';
			        exit(0);
			    }else {
   
				$sql = "select username,password from userinfo where username = '$_POST[username]' and password = '$_POST[password]'";
				        $result = $conn->query($sql);
				        $number = mysqli_num_rows($result);
				        if ($number ) {
   
							if ($username == "admin" && $password == "123456") {
   
				        				        header("Location: index.html");
												
						}else{
   
				            echo '<script>window.location="user.html";</script>';
							}
				         }else {
   
				            echo '<script>alert("用户名或密码错误!");</script>';
							echo '<script>window.location="login.html";';
							}	
					}
?>	

用户注册:regist.html

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>用户注册
  • 0
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值