@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
||||
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" />
|
||||
</project>
|
||||
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/cgyxsxt.iml" filepath="$PROJECT_DIR$/.idea/cgyxsxt.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<info>
|
||||
<infoitem key="MMGuideColor" value="#00FF00" />
|
||||
<infoitem key="MMGuideVisible" value="false" />
|
||||
<infoitem key="MMGuideLocked" value="false" />
|
||||
<infoitem key="MMSnapToGuide" value="true" />
|
||||
<infoitem key="MMGuidesSnapToElements" value="true" />
|
||||
<infoitem key="MMDistanceColor" value="#0000FF" />
|
||||
<infoitem key="MMGuideCount" value="0" />
|
||||
</info>
|
||||
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<info>
|
||||
<infoitem key="MMGuideColor" value="#00FF00" />
|
||||
<infoitem key="MMGuideVisible" value="true" />
|
||||
<infoitem key="MMGuideLocked" value="false" />
|
||||
<infoitem key="MMSnapToGuide" value="true" />
|
||||
<infoitem key="MMGuidesSnapToElements" value="true" />
|
||||
<infoitem key="MMDistanceColor" value="#0000FF" />
|
||||
<infoitem key="MMGuideCount" value="0" />
|
||||
</info>
|
||||
@ -0,0 +1,19 @@
|
||||
<!--connect.php-->
|
||||
|
||||
<?php
|
||||
|
||||
//连接数据库
|
||||
$conn = mysqli_connect('localhost','root','111111');
|
||||
|
||||
//如果连接数据库失败就输出错误信息
|
||||
if(!$conn){
|
||||
die("连接数据库错误:".mysqli_error($conn));
|
||||
}
|
||||
|
||||
//选择数据库
|
||||
mysqli_select_db($conn,'school');
|
||||
|
||||
//选择字符集
|
||||
mysqli_set_charset($conn,'utf8');
|
||||
|
||||
?>
|
||||
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
//销毁session跳转到login.html
|
||||
session_start();
|
||||
session_destroy();
|
||||
echo "<script>url=\"index.php\";window.location.href=url;</script>";
|
||||
?>
|
||||
@ -0,0 +1,65 @@
|
||||
@charset "utf-8";
|
||||
/* CSS Document */
|
||||
*{
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
letter-spacing: .05em;
|
||||
}
|
||||
.entire{
|
||||
height: 100vh;
|
||||
background-image: linear-gradient(to right,#00ffee,#0088ff);
|
||||
}
|
||||
.header{
|
||||
width: 100%;
|
||||
height: 80px;
|
||||
color:papayawhip;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
}
|
||||
.head{
|
||||
position: absolute;
|
||||
font-size: 50px;
|
||||
left: 40px;
|
||||
}
|
||||
.username{
|
||||
font-size: 15px;
|
||||
position: absolute;
|
||||
right: 40px;
|
||||
}
|
||||
.body{
|
||||
width: 100%;
|
||||
height: 400px;
|
||||
position: relative;
|
||||
}
|
||||
.manage_option{
|
||||
height: 300px;
|
||||
position: absolute;
|
||||
top: 80px;
|
||||
left: 80px;
|
||||
background:#0088ff;
|
||||
border-radius: 25px;
|
||||
}
|
||||
.button{
|
||||
border-radius: 25px;
|
||||
margin-left: 40px;
|
||||
margin-right: 40px;
|
||||
margin-top: 30px;
|
||||
margin-bottom: 30px;
|
||||
width: 100px;
|
||||
height: 50px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 5px;
|
||||
background:#00eeff;
|
||||
color: aliceblue;
|
||||
}
|
||||
.footer{
|
||||
background:#00eff;
|
||||
border-radius: 25px;
|
||||
}
|
||||
.ifm{
|
||||
position: relative;
|
||||
left:40px;
|
||||
}
|
||||
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 193 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 95 KiB |
|
After Width: | Height: | Size: 86 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 84 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 32 KiB |
@ -0,0 +1,28 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>显示图片</title>
|
||||
<style>
|
||||
*{
|
||||
padding: 0px;
|
||||
margin: 1px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
$imgname = $_GET['imgname'];
|
||||
include("connect.php");
|
||||
$sql = "select 照片 from xs where 姓名 = '$imgname'";
|
||||
$result = mysqli_query($conn,$sql);
|
||||
$row = mysqli_fetch_array($result);
|
||||
$picture = $row['照片'];
|
||||
$image = base64_decode($picture);//把二进制代码解码
|
||||
mysqli_close($conn);
|
||||
?>
|
||||
|
||||
<img width="80px" height="100px" src="data:image/png;base64,<?=base64_encode($image)?>"/>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,60 @@
|
||||
@charset "utf-8";
|
||||
/* CSS Document */
|
||||
*{
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
letter-spacing: .05em;
|
||||
}
|
||||
html{
|
||||
height: 100%;
|
||||
}
|
||||
body{
|
||||
height:100%;
|
||||
}
|
||||
.container{
|
||||
height: 100%;
|
||||
background-image: linear-gradient(to right,#00ffee,#0088ff);
|
||||
}
|
||||
.login-wrapper{
|
||||
background-color: #fff;
|
||||
width: 250px;
|
||||
height: 500px;
|
||||
border-radius: 25px;
|
||||
padding: 0 50px;
|
||||
position: relative;
|
||||
left: 35%;
|
||||
top: 10%;
|
||||
}
|
||||
.login-wrapper .header{
|
||||
font-size: 40px;
|
||||
font-weight:bolder;
|
||||
text-align: center;
|
||||
line-height:200px;
|
||||
}
|
||||
.login-wrapper .form-wrapper .input-item{
|
||||
width: 250px;
|
||||
height: 15px;
|
||||
border: 0;
|
||||
padding: 10px;
|
||||
border-bottom: 1px solid #A69B9B;
|
||||
}
|
||||
.login-wrapper .form-wrapper .input-item::placeholder{
|
||||
text-transform: uppercase;
|
||||
}
|
||||
.login-wrapper .form-wrapper .btn{
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
width: 100%;
|
||||
margin-top: 40px;
|
||||
background-image: linear-gradient(to right,#00ffee,#0088ff);
|
||||
color: aliceblue;
|
||||
font-size: 20px;
|
||||
}
|
||||
.container .form-wrapper .msg{
|
||||
text-align: center;
|
||||
line-height: 120px;
|
||||
}
|
||||
.container .form-wrapper .msg a{
|
||||
text-decoration-line: none;
|
||||
//color: #515CAA;
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>login</title>
|
||||
<link rel="stylesheet" href="login.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="login-wrapper">
|
||||
<div class="header">Login</div>
|
||||
<div class="form-wrapper">
|
||||
<form action="login.php" method="post">
|
||||
<input type="text" name="username" placeholder="用户名" class="input-item" required>
|
||||
<br />
|
||||
<input type="password" name="password" placeholder="密码" class="input-item" required>
|
||||
|
||||
<button name="submit" type="submit" class="btn">Login</button>
|
||||
</form>
|
||||
<div class="msg">
|
||||
Don't have account?<a href="register.html">Sign up</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,11 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>登录警告</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script>alert("请先登录账号")</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,60 @@
|
||||
@charset "utf-8";
|
||||
/* CSS Document */
|
||||
*{
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
letter-spacing: .05em;
|
||||
}
|
||||
html{
|
||||
height: 100%;
|
||||
}
|
||||
body{
|
||||
height:100%;
|
||||
}
|
||||
.container{
|
||||
height: 100%;
|
||||
background-image: linear-gradient(to right,#00ffee,#0088ff);
|
||||
}
|
||||
.register-wrapper{
|
||||
background-color: #fff;
|
||||
width: 250px;
|
||||
height: 500px;
|
||||
border-radius: 25px;
|
||||
padding: 0 50px;
|
||||
position: relative;
|
||||
left: 35%;
|
||||
top: 10%;
|
||||
}
|
||||
.register-wrapper .header{
|
||||
font-size: 40px;
|
||||
font-weight:bolder;
|
||||
text-align: center;
|
||||
line-height:200px;
|
||||
}
|
||||
.register-wrapper .form-wrapper .input-item{
|
||||
width: 250px;
|
||||
height: 15px;
|
||||
border: 0;
|
||||
padding: 10px;
|
||||
border-bottom: 1px solid #A69B9B;
|
||||
}
|
||||
.register-wrapper .form-wrapper .input-item::placeholder{
|
||||
text-transform: uppercase;
|
||||
}
|
||||
.register-wrapper .form-wrapper .btn{
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
background-image: linear-gradient(to right,#00ffee,#0088ff);
|
||||
width: 100%;
|
||||
margin-top: 40px;
|
||||
color: aliceblue;
|
||||
font-size: 20px;
|
||||
}
|
||||
.container .form-wrapper .msg{
|
||||
text-align: center;
|
||||
line-height: 120px;
|
||||
}
|
||||
.container .form-wrapper .msg a{
|
||||
text-decoration-line: none;
|
||||
//color: #515CAA;
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>register</title>
|
||||
<link rel="stylesheet" href="register.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="register-wrapper">
|
||||
<div class="header">Register</div>
|
||||
<div class="form-wrapper">
|
||||
<form action="register.php" method="post">
|
||||
<input type="text" name="username" placeholder="用户名" class="input-item" required>
|
||||
<br />
|
||||
<input type="password" name="password" placeholder="新密码" class="input-item" required>
|
||||
<input type="password" name="repassword" placeholder="确认密码" class="input-item" required>
|
||||
<button name="submit" type="submit" class="btn">Register</button>
|
||||
</form>
|
||||
<div class="msg">
|
||||
Haved an account ? <a href="login.html">log in</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
session_start();
|
||||
function logincheck($to){
|
||||
if(isset($_SESSION['username'])) echo "$to";
|
||||
else echo "loginwarning.php";
|
||||
}
|
||||
?>
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>学生管理</title>
|
||||
<style>
|
||||
*{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
input{
|
||||
margin-bottom: 10px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
button{
|
||||
|
||||
}
|
||||
.operator{
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
}
|
||||
.showdate{
|
||||
position: absolute;
|
||||
left: 280px;
|
||||
width: 667px;
|
||||
height: 297px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="operator">
|
||||
<form action="<?php logincheck("showdata_kc.php");?>" target="data" method="post" >
|
||||
课程名:<input type="text" name="kc" style="width: 60px; margin-left: 5px; margin-bottom: 10px; margin-top: 10px;"><br />
|
||||
学时:<input type="text" name="class_time" style="width: 40px; margin-left: 20px; margin-bottom: 10px;"><br />
|
||||
学分:<input type="text" name="class_score" style="width: 40px; margin-left: 20px; margin-bottom: 10px;"><br>
|
||||
<button type="submit" name="查询" >查询</button>
|
||||
<button type="submit" name="录入" >录入</button>
|
||||
<button type="submit" name="删除" >删除</button>
|
||||
<button type="submit" name="更新" >更新</button>
|
||||
<button type="reset" name="重置" >重置</button>
|
||||
</form>
|
||||
</div>
|
||||
<iframe name="data" class="showdate" scrolling="auto"></iframe>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
session_start();
|
||||
function logincheck($to){
|
||||
if(isset($_SESSION['username'])) echo "$to";
|
||||
else echo "loginwarning.php";
|
||||
}
|
||||
?>
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>学生管理</title>
|
||||
<style>
|
||||
*{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
input{
|
||||
margin-bottom: 10px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
button{
|
||||
position: absolute;
|
||||
left: 120px;
|
||||
}
|
||||
.operator{
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
}
|
||||
.showdate{
|
||||
position: absolute;
|
||||
left: 280px;
|
||||
width: 667px;
|
||||
height: 297px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="operator">
|
||||
<form action="<?php logincheck("showdata_xs.php");?>" target="data" method="post" enctype="multipart/form-data">
|
||||
姓名:<input type="text" name="name" style="margin-top: 5px;width: 55px;"><br \>
|
||||
性别:<input type="radio" name="sex" value="男">男<input type="radio" name="sex" value="女">女<br>
|
||||
出生日期:<input type="date" name="birthday" style="width: 120px;"><br>
|
||||
已修课程数:<input type="number" name="kc_number" style="width: 104px;"><br>
|
||||
备注:<input type="text" name="comment" style="width:80px;"><br>
|
||||
照片:<input type="file" name="photo" id="file" onchange="changepic(this)" style="width: 200px;"><br>
|
||||
<img src="" id="show" width="100px" height="100px" style="border: 3px ridge; background-color: #E3E3E3; float: left; position: relative;">
|
||||
<button type="submit" name="查询" >查询</button><br />
|
||||
<button type="submit" name="录入" >录入</button><br />
|
||||
<button type="submit" name="删除" >删除</button><br />
|
||||
<button type="submit" name="更新" >更新</button><br />
|
||||
<button type="reset" name="重置" onClick="resetpic()">重置</button>
|
||||
<script>
|
||||
function changepic(obj) {
|
||||
//console.log(obj.files[0]);//这里可以获取上传文件的name
|
||||
var newsrc=getObjectURL(obj.files[0]);
|
||||
document.getElementById('show').src=newsrc;
|
||||
}
|
||||
//建立一個可存取到該file的url
|
||||
function getObjectURL(file) {
|
||||
var url = null ;
|
||||
// 下面函数执行的效果是一样的,只是需要针对不同的浏览器执行不同的 js 函数而已
|
||||
if (window.createObjectURL!=undefined) { // basic
|
||||
url = window.createObjectURL(file) ;
|
||||
} else if (window.URL!=undefined) { // mozilla(firefox)
|
||||
url = window.URL.createObjectURL(file) ;
|
||||
} else if (window.webkitURL!=undefined) { // webkit or chrome
|
||||
url = window.webkitURL.createObjectURL(file) ;
|
||||
}
|
||||
return url ;
|
||||
}
|
||||
function resetpic(){
|
||||
document.getElementById('show').src="";
|
||||
}
|
||||
</script>
|
||||
</form>
|
||||
</div>
|
||||
<iframe name="data" class="showdate" scrolling="auto"></iframe>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
session_start();
|
||||
function logincheck($to){
|
||||
if(isset($_SESSION['username'])) echo "$to";
|
||||
else echo "loginwarning.php";
|
||||
}
|
||||
?>
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>学生考试成绩管理</title>
|
||||
<style>
|
||||
*{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
input{
|
||||
margin-bottom: 10px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
button{
|
||||
|
||||
}
|
||||
.operator{
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
}
|
||||
.showdate{
|
||||
position: absolute;
|
||||
left: 280px;
|
||||
width: 667px;
|
||||
height: 297px;
|
||||
}
|
||||
select{
|
||||
margin-bottom: 10px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php include("connect.php");?>
|
||||
<div class="operator">
|
||||
<form action="<?php logincheck("showdata_xs_kc.php");?>" target="data" method="post" >
|
||||
姓名:<select name="name" style="width: 78px; margin-top:10px;height: 20px;">
|
||||
<option>请选择</option>
|
||||
<?php
|
||||
$result = mysqli_query($conn,"select 姓名 from xs");
|
||||
while($row = mysqli_fetch_array($result)){
|
||||
echo "<option>".$row['姓名']."</option>";
|
||||
}
|
||||
?>
|
||||
</select><br />
|
||||
课程名:<select name="kc" style="width: 100px; height: 20px;" >
|
||||
<option>请选择</option>
|
||||
<?php
|
||||
$result = mysqli_query($conn,"select 课程名 from kc");
|
||||
while($row = mysqli_fetch_array($result)){
|
||||
echo "<option>".$row['课程名']."</option>";
|
||||
}
|
||||
mysqli_close($conn);
|
||||
?>
|
||||
</select><br />
|
||||
成绩:<input type="text" name="score" style="width: 40px; margin-left: 5px; margin-bottom: 10px;">
|
||||
|
||||
排序:<select name="sort">
|
||||
<option value="无">无</option>
|
||||
<option value="升序">升序</option>
|
||||
<option value="降序">降序</option>
|
||||
</select><br />
|
||||
<button type="submit" name="查询" >查询</button>
|
||||
<button type="submit" name="录入" >录入</button>
|
||||
<button type="submit" name="删除" >删除</button>
|
||||
<button type="submit" name="更新" >更新</button>
|
||||
<button type="reset" name="重置" >重置</button>
|
||||
</form>
|
||||
</div>
|
||||
<iframe name="data" class="showdate" scrolling="auto"></iframe>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,156 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>课程Data</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php include("connect.php");?>
|
||||
<?php
|
||||
$kc=$_POST['kc'];
|
||||
$class_time=$_POST['class_time'];
|
||||
$class_score=$_POST['class_score'];
|
||||
if(isset($_POST['查询']))//查询功能
|
||||
{
|
||||
$sql = "select * from kc";
|
||||
$where = " where true";
|
||||
if($kc) $where = $where." and 课程名 = '$kc'";
|
||||
if($class_time) $where = $where." and 学时 = '$class_time'";
|
||||
if($class_score) $where = $where." and 学分 = '$class_score'";
|
||||
$sql = $sql.$where;
|
||||
$result = mysqli_query($conn,$sql);
|
||||
if($num = mysqli_num_rows($result)){
|
||||
echo "<table border='1'><tr><th width = 80px;>课程名</th><th width = 70px;>学时</th><th width = 70px;>学分</th></tr>";
|
||||
while($row = mysqli_fetch_array($result))
|
||||
{
|
||||
echo "<tr>";
|
||||
echo "<td>".$row['课程名']."</td>";
|
||||
echo "<td>".$row['学时']."</td>";
|
||||
echo "<td>".$row['学分']."</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
}else{
|
||||
echo "无该课程信息";
|
||||
exit();
|
||||
}
|
||||
}
|
||||
if(isset($_POST['录入']))//录入功能
|
||||
{
|
||||
if(!$kc||!$class_time||!$class_score)//课程名,学时,学分为必填
|
||||
{
|
||||
echo "<script>alert(\"请输入课程名,学时,学分\")</script>";
|
||||
exit();
|
||||
}
|
||||
if($class_time<=0||$class_score<=0)//学时和学分都要是正数
|
||||
{
|
||||
echo "<script>alert(\"学时和学分需为正数!\")</script>";
|
||||
exit();
|
||||
}
|
||||
//主键冲突
|
||||
$sql = "select * from kc where 课程名='$kc'";
|
||||
$result =mysqli_query($conn,$sql);
|
||||
if($row = mysqli_num_rows($result))
|
||||
{
|
||||
echo "<script>alert(\"已存在该课程!\")</script>";
|
||||
exit();
|
||||
}
|
||||
//执行sql语句
|
||||
$sql = "insert into kc values('$kc','$class_time','$class_score')";
|
||||
$result = mysqli_query($conn,$sql);
|
||||
if(!$result)
|
||||
{
|
||||
echo "<script>alert(\"录入失败,请重试!\")</script>";
|
||||
exit();
|
||||
}else{
|
||||
echo "<script>alert(\"录入成功!\")</script>";
|
||||
}
|
||||
//录入成功显示该课程
|
||||
$sql = "select * from kc where 课程名 = '$kc'";
|
||||
$result = mysqli_query($conn,$sql);
|
||||
if($num = mysqli_num_rows($result)){
|
||||
echo "<table border='1'><tr><th width = 80px;>课程名</th><th width = 70px;>学时</th><th width = 70px;>学分</th></tr>";
|
||||
while($row = mysqli_fetch_array($result))
|
||||
{
|
||||
echo "<tr>";
|
||||
echo "<td>".$row['课程名']."</td>";
|
||||
echo "<td>".$row['学时']."</td>";
|
||||
echo "<td>".$row['学分']."</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
|
||||
}
|
||||
if(isset($_POST['删除']))//删除功能
|
||||
{
|
||||
if(!$kc)//课程名为必填
|
||||
{
|
||||
echo "<script>alert(\"请输入课程名!\")</script>";
|
||||
exit();
|
||||
}
|
||||
$sql = "select * from kc where 课程名 = '$kc'";//
|
||||
$result = mysqli_query($conn,$sql);
|
||||
if(!$num = mysqli_num_rows($result))
|
||||
{
|
||||
echo "<script>alert(\"无该课程信息!\")</script>";
|
||||
exit();
|
||||
}
|
||||
$sql = "delete from kc where 课程名 = '$kc'";
|
||||
$result = mysqli_query($conn,$sql);
|
||||
if(!$result)
|
||||
{
|
||||
echo "<script>alert(\"删除失败,请重试!\")</script>";
|
||||
exit();
|
||||
}else{
|
||||
echo "<script>alert(\"删除成功!\")</script>";
|
||||
exit();
|
||||
}
|
||||
|
||||
}
|
||||
if(isset($_POST['更新']))//更新功能
|
||||
{
|
||||
if(!$kc)//课程名必须输入
|
||||
{
|
||||
echo "<script>alert(\"请输入课程名!\")</script>";
|
||||
exit();
|
||||
}//更新需要有该课程信息
|
||||
$sql = "select * from kc where 课程名 = '$kc'";
|
||||
$result = mysqli_query($conn,$sql);
|
||||
if(!($num = mysqli_num_rows($result)))
|
||||
{
|
||||
echo "<script>alert(\"无该课程信息!\")</script>";
|
||||
exit();
|
||||
}
|
||||
$sql = "update kc set 课程名 = '$kc'";
|
||||
if($class_time) $sql = $sql.",学时 = '$class_time'";
|
||||
if($class_score) $sql = $sql.",学分 = '$class_score'";
|
||||
$sql = $sql."where 课程名 = '$kc'";
|
||||
$result = mysqli_query($conn,$sql);
|
||||
if(!$result)
|
||||
{
|
||||
echo "<script>alert(\"更新失败,请重试!\")</script>";
|
||||
exit();
|
||||
}else{
|
||||
echo "<script>alert(\"更新成功!\")</script>";
|
||||
}
|
||||
//录入成功显示该课程
|
||||
$sql = "select * from kc where 课程名 = '$kc'";
|
||||
$result = mysqli_query($conn,$sql);
|
||||
if($num = mysqli_num_rows($result)){
|
||||
echo "<table border='1'><tr><th width = 80px;>课程名</th><th width = 70px;>学时</th><th width = 70px;>学分</th></tr>";
|
||||
while($row = mysqli_fetch_array($result))
|
||||
{
|
||||
echo "<tr>";
|
||||
echo "<td>".$row['课程名']."</td>";
|
||||
echo "<td>".$row['学时']."</td>";
|
||||
echo "<td>".$row['学分']."</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
}
|
||||
mysqli_close($conn);
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,186 @@
|
||||
<!--未增加照片功能!-->
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>学生Data</title>
|
||||
<style>
|
||||
th{
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
}
|
||||
label:hover{
|
||||
opacity: 0;
|
||||
}
|
||||
label:hover+iframe{
|
||||
width: 90px;
|
||||
height: 100px;
|
||||
position: absolute;
|
||||
top: -60px;
|
||||
left: -80px;
|
||||
}
|
||||
label{
|
||||
widows: 80px;
|
||||
height: 20px;
|
||||
}
|
||||
iframe{
|
||||
width: 0px;
|
||||
height: 0px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<?php include("connect.php");?>
|
||||
<?php
|
||||
//获取表单数据
|
||||
$name = $_POST['name'];
|
||||
$sex = $_POST['sex'];
|
||||
$birthday = $_POST['birthday'];
|
||||
$kc_number = $_POST['kc_number'];
|
||||
$comment = $_POST['comment'];
|
||||
$photo = $_POST['photo'];
|
||||
$tmp_file = $_FILES['photo']['tmp_name'];
|
||||
if(isset($_POST['查询']))//查询功能
|
||||
{
|
||||
$sql = "select * from xs ";
|
||||
$where = "where true";
|
||||
if($name) $where = $where." and 姓名 = '$name'";
|
||||
if($sex) $where = $where." and 性别 = '$sex'";
|
||||
if($birthday) $where = $where." and 出生日期 = '$birthday'";
|
||||
if($kc_number) $where = $where." and 修课程数 = '$kc_number'";
|
||||
if($comment) $where = $where." and 备注 = '$comment'";
|
||||
$sql=$sql.$where;
|
||||
$result = mysqli_query($conn,$sql);
|
||||
//以表格形式显示数据
|
||||
if(mysqli_num_rows($result)){//判断有无符合该学生信息
|
||||
echo "<table border=1><tr><th>姓名</th><th>性别</th><th>出生日期</th><th>已修课程数</th><th>备注</th><th>照片</th></tr>";
|
||||
while($row = mysqli_fetch_array($result)){
|
||||
echo "<tr><td width=70px>".$row['姓名']."</td>";
|
||||
echo "<td width=40px>".$row['性别']."</td>";
|
||||
echo "<th width=120px>".$row['出生日期']."</th>";
|
||||
echo "<th width=60px>".$row['修课程数']."</th>";
|
||||
echo "<th width=50%>".$row['备注']."</th>";
|
||||
echo "<th width=80px style=\"position: relative;\"><label>查看图片</label><iframe src=\"imgview.php?imgname=".$row['姓名']."\" scrolling=\"no\" frameborder=\"0\"></iframe></th>";
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
}else
|
||||
{
|
||||
echo "无该学生信息";
|
||||
exit();
|
||||
}
|
||||
}
|
||||
if(isset($_POST["录入"]))//录入功能
|
||||
{
|
||||
//姓名性别不能为空
|
||||
if(!strlen($name) || !strlen($sex)){
|
||||
echo "<script>alert(\"姓名和性别不能为空\");</script>";
|
||||
exit();
|
||||
}
|
||||
//已有该学生
|
||||
$sql = "select 姓名 from xs where 姓名 = '$name'";
|
||||
$result = mysqli_query($conn,$sql);
|
||||
if(mysqli_num_rows($result)){
|
||||
echo "<script>alert(\"数据库中已有该学生\");</script>";
|
||||
exit();
|
||||
}
|
||||
//执行sql
|
||||
$sql = "insert into xs(姓名,性别";
|
||||
$value = "values('$name','$sex'";
|
||||
if($birthday) {$sql = $sql.",出生日期";$value = $value.",'$birthday'";}
|
||||
if($kc_number) {$sql = $sql.",修课程数";$value = $value.",'$kc_number'";}
|
||||
if($comment) {$sql = $sql.",备注";$value = $value.",'$comment'";}
|
||||
if($tmp_file){
|
||||
$handle = fopen($tmp_file,'rb');
|
||||
$picture = base64_encode(fread($handle,filesize($tmp_file)));
|
||||
$sql = $sql.",照片"; $value = $value.",'$picture'";
|
||||
}
|
||||
$sql=$sql.")".$value.")";
|
||||
$result = mysqli_query($conn,$sql);
|
||||
if(!$result)
|
||||
{
|
||||
echo "<script>alert(\"录入失败\");</script>";
|
||||
exit();
|
||||
}
|
||||
else{
|
||||
echo "<script>alert(\"录入成功\");</script>";
|
||||
exit();
|
||||
}
|
||||
|
||||
}
|
||||
if(isset($_POST['删除']))//删除功能
|
||||
{
|
||||
//姓名必须输入
|
||||
if(!strlen($name)){
|
||||
echo "<script>alert(\"请输入要删除的学生\")</script>";
|
||||
exit();
|
||||
}
|
||||
//检查数据库中是否有该学生
|
||||
$sql = "select 姓名 from xs where 姓名 = '$name'";
|
||||
$result = mysqli_query($conn,$sql);
|
||||
if(!mysqli_num_rows($result)){
|
||||
echo "<script>alert(\"未找到该学生\")</script>";
|
||||
exit();
|
||||
}
|
||||
//执行删除语句
|
||||
$sql = "delete from xs where 姓名 = '$name'";
|
||||
$result = mysqli_query($conn,$sql);
|
||||
if(!$result)
|
||||
{
|
||||
echo "<script>alert(\"删除失败,请重试!\")</script>";
|
||||
exit();
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<script>alert(\"删除成功!\")</script>";
|
||||
exit();
|
||||
}
|
||||
}
|
||||
if(isset($_POST['更新']))//更新功能
|
||||
{
|
||||
//姓名必须输入
|
||||
if(!strlen($name)){
|
||||
echo "<script>alert(\"必须输入姓名\")</script>";
|
||||
exit();
|
||||
}
|
||||
//至少填写一项修改内容
|
||||
if(!(strlen($sex) || strlen($birthday) || strlen($kc_number) || strlen($comment) || strlen($photo))){
|
||||
echo "<script>alert(\"至少填写一项修改内容\")</script>";
|
||||
exit();
|
||||
}
|
||||
//查找是否存在该学生
|
||||
$sql = "select * from xs where 姓名 = '$name'";
|
||||
$result = mysqli_query($conn,$sql);
|
||||
if(!mysqli_num_rows($result))
|
||||
{
|
||||
echo "<script>alert(\"无该学生信息\")</script>";
|
||||
exit();
|
||||
}
|
||||
//执行更新SQL语句
|
||||
$sql = "update xs set 姓名 = '$name'";
|
||||
if($sex) $sql = $sql.",性别 = '$sex'";
|
||||
if($birthday) $sql = $sql.",出生日期 = '$birthday'";
|
||||
if($kc_number) $sql = $sql.",修课程数 = '$kc_number'";
|
||||
if($comment) $sql = $sql.",备注 = '$comment'";
|
||||
if($tmp_file){
|
||||
$handle = fopen($tmp_file,'rb');
|
||||
$picture = base64_encode(fread($handle,filesize($tmp_file)));
|
||||
$sql = $sql.",照片 = '$Picture'";
|
||||
}
|
||||
$sql = $sql." where 姓名 = '$name'";
|
||||
$result=mysqli_query($conn,$sql);
|
||||
if($result)
|
||||
{
|
||||
echo "<script>alert(\"更新成功\")</script>";
|
||||
exit();
|
||||
}else{
|
||||
echo "<script>alert(\"更新失败\")</script>";
|
||||
exit();
|
||||
}
|
||||
}
|
||||
mysqli_close($conn);
|
||||
?>
|
||||
<tr>
|
||||
</tr>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,158 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>学生课程Data</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php include("connect.php")?>
|
||||
<?php
|
||||
//接收表单信息
|
||||
$name = $_POST['name'];
|
||||
$kc = $_POST['kc'];
|
||||
$score = $_POST['score'];
|
||||
$sort = $_POST['sort'];
|
||||
if(isset($_POST['查询']))//查询功能
|
||||
{
|
||||
$sql = "select * from xs_kc";
|
||||
$where = " where true";
|
||||
if($name!='请选择') $where = $where." and 姓名 = '$name'";
|
||||
if($kc!='请选择') $where = $where." and 课程名 = '$kc'";
|
||||
if($score) $where = $where." and 成绩 = '$score'";
|
||||
if($sort=='升序')
|
||||
{
|
||||
$where = $where." order by 成绩 asc";
|
||||
}else if($sort == '降序'){
|
||||
$where = $where." order by 成绩 desc";
|
||||
}
|
||||
$sql =$sql.$where;
|
||||
$result = mysqli_query($conn,$sql);
|
||||
if(mysqli_num_rows($result)){//判断有无符合该学生信息
|
||||
echo "<table border=1><tr><th>姓名</th><th>课程名</th><th>成绩</th></td>";
|
||||
while($row = mysqli_fetch_array($result)){
|
||||
echo "<tr><td width=70px>".$row['姓名']."</td>";
|
||||
echo "<td width=100px>".$row['课程名']."</td>";
|
||||
echo "<td width=100px>".$row['成绩']."</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
}else
|
||||
{
|
||||
echo "无该学生信息";
|
||||
exit();
|
||||
}
|
||||
}
|
||||
if(isset($_POST['录入']))//录入功能
|
||||
{
|
||||
if($name == "请选择" || $kc == "请选择" || !strlen($score)){//姓名,课程名,成绩必填
|
||||
echo "<script>alert(\"姓名、课程名和成绩不能为空\");</script>";
|
||||
exit();
|
||||
}
|
||||
$sql = "select * from xs_kc where 姓名='$name' and 课程名='$kc'";//复合主键冲突 姓名和课程
|
||||
$result = mysqli_query($conn,$sql);
|
||||
if(mysqli_num_rows($result))
|
||||
{
|
||||
echo "<script>alert(\"已存在该学生课程信息!\")</script>";
|
||||
echo "<table border=1>";
|
||||
echo "<tr><th>姓名</th><th>课程名</th><th>成绩</th></td>";
|
||||
while($row = mysqli_fetch_array($result))
|
||||
{
|
||||
echo "<tr><td width=70px>".$row['姓名']."</td>";
|
||||
echo "<td width=100px>".$row['课程名']."</td>";
|
||||
echo "<td width=100px>".$row['成绩']."</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
exit();
|
||||
}
|
||||
//执行sql语句 录入
|
||||
$sql = "insert into xs_kc values('$name','$kc','$score')";
|
||||
$result = mysqli_query($conn,$sql);
|
||||
if(!$result)
|
||||
{
|
||||
echo "<script>alert(\"录入失败,请重试!\");</script>";
|
||||
exit();
|
||||
}else{
|
||||
echo "<script>alert(\"录入成功!\");</script>";
|
||||
$sql = "select * from xs_kc where 姓名 = '$name'";
|
||||
$result = mysqli_query($conn,$sql);
|
||||
echo "<table border=1>";
|
||||
echo "<tr><th>姓名</th><th>课程名</th><th>成绩</th></td>";
|
||||
while($row = mysqli_fetch_array($result))
|
||||
{
|
||||
echo "<tr><td width=70px>".$row['姓名']."</td>";
|
||||
echo "<td width=100px>".$row['课程名']."</td>";
|
||||
echo "<td width=100px>".$row['成绩']."</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if(isset($_POST['删除']))//删除功能
|
||||
{
|
||||
//姓名和课程必须输入
|
||||
if($name == "请选择" || $kc == "请选择")
|
||||
{
|
||||
echo "<script>alert(\"必须输入姓名和课程\")</script>";
|
||||
exit();
|
||||
}
|
||||
$sql ="select * from xs_kc where 姓名 = '$name' and 课程名 = '$kc'";
|
||||
$result = mysqli_query($conn,$sql);
|
||||
if(!mysqli_num_rows($result))
|
||||
{
|
||||
echo "无该学生课程信息,请重试!";
|
||||
exit();
|
||||
}
|
||||
$sql = "delete from xs_kc where 姓名 = '$name'and 课程名 = '$kc'";
|
||||
$result = mysqli_query($conn,$sql);
|
||||
if(!$result)
|
||||
{
|
||||
echo "<script>alert(\"删除失败,请重试!\")</script>";
|
||||
exit();
|
||||
}else{
|
||||
echo "<script>alert(\"删除成功!\")</script>";
|
||||
exit();
|
||||
}
|
||||
|
||||
}
|
||||
if(isset($_POST['更新']))//更新功能
|
||||
{
|
||||
//姓名和课程必须输入
|
||||
if($name == "请选择" || $kc == "请选择"|| !strlen($score)){
|
||||
echo "<script>alert(\"必须输入姓名和课程,以及要修改的成绩\")</script>";
|
||||
exit();
|
||||
}
|
||||
$sql = "select * from xs_kc where 姓名 = '$name' and 课程名 = '$kc'";
|
||||
$result = mysqli_query($conn,$sql);
|
||||
if(!mysqli_num_rows($result))
|
||||
{
|
||||
echo"无该学生课程信息";
|
||||
exit();
|
||||
}
|
||||
$sql = "update xs_kc set 姓名 = '$name',课程名 = '$kc',成绩 = '$score' where 姓名 = '$name' and 课程名 = '$kc'";
|
||||
$result = mysqli_query($conn,$sql);
|
||||
if(!$result)
|
||||
{
|
||||
echo "<script>alert(\"更新失败,请重试!\")</script>";
|
||||
exit();
|
||||
}else{
|
||||
echo "<script>alert(\"更新成功!\")</script>";
|
||||
$sql = "select * from xs_kc where 姓名 = '$name' and 课程名 = '$kc' ";
|
||||
$result = mysqli_query($conn,$sql);
|
||||
echo "<table border=1>";
|
||||
echo "<tr><th>姓名</th><th>课程名</th><th>成绩</th></td>";
|
||||
while($row = mysqli_fetch_array($result))
|
||||
{
|
||||
echo "<tr><td width=70px>".$row['姓名']."</td>";
|
||||
echo "<td width=100px>".$row['课程名']."</td>";
|
||||
echo "<td width=100px>".$row['成绩']."</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
exit();
|
||||
}
|
||||
}
|
||||
mysqli_close($conn);
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||