PHP+MySQL实现学生信息管理系统登录功能(附带源码)

文件目录

包括学生登录界面和管理员登录界面 由于功能相同 只展示管理员登录界面

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;

}

之后会介绍管理员界面以及增删改查操作

  • 7
    点赞
  • 116
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论
学生信息管理系统是一个常见的管理系统,可以用来管理学生的基本信息、成绩、考勤等。下面是一个简单的基于phpmysql学生信息管理系统实现步骤: 1. 创建数据库和表 首先,需要创建一个数据库来存储学生信息,可以使用MySQL或其他关系型数据库。创建一个名为“student”的数据库,并创建一个名为“stu_info”的表,包含以下字段:id、name、gender、age、major、grade。 2. 编写php代码 使用php编写程序,连接到数据库,并实现增、删、改、查等功能。可以使用mysqli或PDO等扩展库来连接到MySQL数据库。 3. 实现添加学生信息功能 编写php代码,实现添加学生信息的功能。当用户提交学生信息表单时,将表单数据保存到数据库中。 4. 实现删除学生信息功能 编写php代码,实现删除学生信息的功能。当用户选择要删除的学生时,将该学生的信息从数据库中删除。 5. 实现修改学生信息功能 编写php代码,实现修改学生信息的功能。当用户选择要修改的学生时,将该学生的信息从数据库中读取出来,并显示在表单中,用户可以修改该学生的信息并保存到数据库中。 6. 实现查询学生信息功能 编写php代码,实现查询学生信息的功能。用户可以根据学生姓名、学号、专业等条件查询学生信息,并将查询结果显示在页面上。 7. 实现分页功能 当学生信息较多时,需要分页显示。可以使用php代码实现分页功能,将查询结果分页显示。 8. 实现登录和权限管理功能 为了保护学生信息的安全,需要实现登录和权限管理功能。用户需要登录才能访问学生信息管理系统,并根据用户权限来控制其可以访问的功能。 以上就是一个基于phpmysql学生信息管理系统实现步骤。当然,还有很多细节需要考虑,如表单验证、数据安全等,需要根据具体情况进行实现
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Ctrlcv用户

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值