• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

php实例 简单学生成绩管理系统

php 搞代码 4年前 (2022-01-04) 41次浏览 已收录 0个评论

学了php的一些基础,包括HTML,php,pdo,mysql操作等,一直都没有将它们有机结合。最近来源gaodaimacom搞#^代%!码网写了一个简单的网页版学生信息管理系统,前台用HTML,脚本用到了JavaScript和PHP,数据库用到了MySQL。麻雀虽小,五脏俱全。算是对这些知识的一次总结吧。

首先通过login_in 进入登录页面 用户输入信息到login.php中 ,login.php 连接数据库判断是否账号密码是否正确。
通过验证转入welcome_mag.html页面用户选择跳入Select_mag.html查看成绩,lnsert.html插入成绩,delete.html删除成绩。
查看成绩 从页面输入信息 select_opt.php获取用户指令,连接数据库,找出相应的数据并显示。
插入成绩 从页面输入信息 mysql_opt.php获取用户指令,连接数据库,在数据库中添加信息并返回welcome页面。
删除成绩 从页面输入要删出的学号delete_opt.phpl获取指令,连接数据库,删除相应信息并返回welcome页面。
注意事项:1获取用户输入信息 2数据库使用转码,从数据库中查找文字尚未解决 只能查找数字 3连接数据库的mysqli语句 4页面跳转
5<?php 和?>的插入位置 login_in.html到login.php页面可以看到方法
数据库需要 SGMsystem库 其中包含login 用户登录表 stu_info 成绩存储表
需要软件phpSrorm wampp

所有需要的文件 02头像 bg背景图index.css样式表

login_in.html文件++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>重新_信息登录系统标题栏显示</title>
<link rel="stylesheet" href="css/index.css" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" />
</head>
<body>
<img src="css/bgImg.jpg" class="bgImg" />
<form class="content" action="login.php" method="post">
<div class="bidTitle">学生信息管理系统</div>
<div class="logCon">
<div class="line"><span>账号:</span>
<input class="bt_input" placeholder="请输入四位账号" name="no" tabindex="1" type="text" ></div>
<div class="line"><span>密码:</span>
<input class="bt_input" placeholder="请输入密码" name="password" tabindex="2" type="password" ></div>
<button type="submit" class="logingBut" value="提交" >登录</button>
</div>
</form>
</body>
login.php文件
<title>用户登录验证</title>
<meta charset="utf-8">
<?php
function get_str($str){
$val = ($_POST[$str])?$_POST[$str]:null;
return $val;}
$nom = get_str("no");
$password = get_str("password");
if($nom==null or $password==null){?>
<script type="text/javascript">
alert("账号或者密码不能为空");
window.location.href="login_in.html" rel="external nofollow" rel="external nofollow" ;
</script>
<?php
}
$con =mysqli_connect("localhost","root","");
if($con){?>
<script type="text/javascript" >
alert("成功连接数据库");
// window.location.href="login_in" rel="external nofollow" rel="external nofollow" ;
</script><?php
mysqli_select_db($con,"sgmsystem");
mysqli_query($con,"SET NAMES utf8"); /*转码为utf8 否则会出现乱码*/
$sql = "select * from login where no=$nom";
$info = mysqli_query($con, $sql);
$num = mysqli_num_rows($info);
if($num){
$row = mysqli_fetch_row($info);
if($row[2]==$password){?>
<script type="text/javascript">
alert("欢迎登录");
window.location.href="welcome_mag.html" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" ;
</script><?php
}
}
else{?>
<script type="text/javascript">
alert("账号不存在或者密码错误");
window.location.href="login_in.html" rel="external nofollow" rel="external nofollow" ;
</script><?php
}}
else{?>
<script type="text/javascript">
alert("连接数据库发生错误");
window.location.href="login_in" rel="external nofollow" rel="external nofollow" ;
</script><?php
}

搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:php实例 简单学生成绩管理系统
喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址