体系结构

master
smj 5 years ago
parent 65d91f0e6f
commit b57340c9ef

@ -0,0 +1,15 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="1.8" />
</component>
</project>

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="PLATFORM" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="1.8 (2)" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>
</project>

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
<remote-repository>
<option name="id" value="Google" />
<option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository>
</component>
</project>

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

@ -0,0 +1,42 @@
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.nervesaynerve"
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

@ -0,0 +1,17 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>连接数据库</title>
</head>
<body>
<?php
$conn=mysqli_connect("localhost","root","3256137");
if(!$conn){
die("无法连接到mysql数据库:".mysqli_error($conn));}
mysqli_select_db($conn,'xs');
mysqli_set_charset($conn,"utf8");
?>
</body>
</html>

@ -0,0 +1,15 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>destroy_session</title>
</head>
<body>
<?php
session_start();
session_destroy();
echo "<script>url=\"login.html\";window.location.href=url;</script>";
?>
</body>
</html>

@ -0,0 +1,114 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>系统主页</title>
<style type="text/css">
nav{
background-color: #CCE8F4;
height: 650px;
width: 1260px;
}
.div1{
background-color: #CCE8F4;
display: inline;
width: 10px;
font-family: "华文隶书";
color: #000;
font-size: 18px;
}
.span1{
background-color: #FFF;
display: inline-block;
width: 240px;
height: 380px;
border: 3px inset #CCF;
border-radius: 15px;
text-align:center;
color:#333;
float:left;
}
#d1{
background-color:#6CF;
height: 85px;
font-family: "华文隶书";
color: #969;
font-size: 26px;
text-align: center;
border: 3px inset #CCF;
border-radius: 15px;
}
#d2{
background-color: #6CF;
height: 100px;
font-family: "华文隶书";
color: #969;
font-size: 15px;
text-align:center;
}
#d3{
background-color:#FFF;
width:350px;
height:440px;
text-align:left;}
.d4{
color:#FFF;}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
</style>
</head>
<body>
<nav>
<div id="d1">
学生管理系统<br />
Welcome to the xs system</div>
<table width="160" border="1" align="right" height="35" bordercolor="#FFFFFF">
<tr>
<td>
<div class="div1">
<?php
session_start();
if(isset($_SESSION['username'])){
echo "当前用户:".$_SESSION['username'];
echo "<hr>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"destroy_session.php\">注销</a>";}
else{
echo "<a href=\"login.html\">前往登录</a>||";
echo "<a href=\"register.html\">注册</a>";}?>&nbsp;&nbsp;</div></td>
</tr>
</table>
<br /><br /><br />
<span class="span1"><br /><br /><br /><br /><table width="140" border="1" align="center" background="file:///D|/Users/lenovo/Documents/2020年大一下期期末/19软2班82杨多思数据库/xs/4.png">
<tr>
<td><a href="student.html"><font color="#000000"><b>学生管理</b></font></a></td>
</tr>
</table>
<br /><br /><table width="140" border="1" align="center" background="file:///D|/Users/lenovo/Documents/2020年大一下期期末/19软2班82杨多思数据库/xs/4.png">
<tr>
<td><a href="score.html"><font color="#000000"><b>成绩管理</b></font></a></td>
</tr>
</table>
<br />
</span>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<div id="d2">
<br />&nbsp;&nbsp;&nbsp;&nbsp;系别:软件工程&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;班级19级软件工程2班&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;姓名:杨多思
<br />&nbsp;&nbsp;&nbsp;&nbsp;QQ1068637453&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;邮箱1068637453@qq.com</div>
</nav>
<br />
</nav>
</body>
</html>

@ -0,0 +1,97 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>登录面</title>
<style type="text/css">
nav{
background-color: #CCE8F4;
height: 600px;
width: 1260px;}
#d1{
background-color: #6CF;
height: 100px;
font-family: "华文隶书";
color: #969;
font-size: 15px;
text-align:center;
}
#headl{
letter-spacing:20px;
background-color:#6CF;
height:45px;
font-family: "华文隶书";
color: #969;
font-size: 32px;
text-align: center;
border: 3px inset #CCF;
border-radius: 15px;
padding-top:0.5cm;
padding-bottom:0.5cm;
font-weight:bolder;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
#login{
width:220px;
height:40px;
font-size:14px;
font-family:幼圆;
margin-left:30px;}
#login_name{
margin-left:30px;
width:220px;
height:30px;
font-size:14px;
font-family:幼圆;}
/*用户名*/
#login_password{
margin-left:30px;
width:220px;
height:30px;
font-size:14px;
font-family:幼圆;}
#login_table{
margin-top:80px;
background-color:#6CF;
}
</style>
</head>
<body>
<nav>
<div id="headl">
学生信息管理系统</div>
<table width="300" height="300" border="1" align="center" id="login_table">
<tr>
<td>
<form action="login.php" method="post">
<p id="login_text1">用户登录</p>
<br/><br />
<input name="username" type="text" required="required" placeholder="用户名" id="login_name"/>
<br /><br />
<input name="password" type="password" required="required" placeholder="密码" id="login_password"/>
<br/><br />
<button type="submit" id="login">登录</button>
</form>
</td>
</tr>
</table>
</nav>
<br />
<br /><br /><br />
<div id="d1"><br />&nbsp;&nbsp;&nbsp;&nbsp;系别:软件工程&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;班级19级软件工程2班&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;姓名:杨多思
<br />&nbsp;&nbsp;&nbsp;&nbsp;QQ1068637453&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;邮箱1068637453@qq.com</div>
</nav>
</body>
</html>

@ -0,0 +1,45 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>login.php</title>
</head>
<body>
<?php
include("connect.php");
$username=$_POST['username'];
$password=$_POST['password'];
$sql="select userid from user where username='$username'";
$result=mysqli_query($conn,$sql);
if(mysqli_num_rows($result)<=0)
{
echo "<script>alert(\"该用户不存在\");</script>";
echo "<script>url=\"login.html\";window.location.href=url;</script>";}
$sql="select userid from user where username='$username' and password='$password'";
$result=mysqli_query($conn,$sql);
if(mysqli_num_rows($result)>0){
echo "<script>url=\"index.php\";window.location.href=url;</script>";}
else{
echo "<script>alert(\"用户名或密码错误\");</script>";
echo "<script>url=\"login.html\";window.location.href=url;</script>";}
mysqli_close($conn);
?>
<?php
session_start();
include("connect.php");
$username=$_POST['username'];
$password=$_POST['password'];
$sql="select userid from user where username='$username' and password='$password'";
$result=mysqli_query($conn,$sql);
if(mysqli_num_rows($result)>0){
$_SESSION['username']=$username;
echo "<script>url=\"index.php\",window.location.href=url;</script>";}
else{
echo "<script>alert(\"用户名或密码错误\");</script>";
echo "<script>url=\"login.html\";window.location.href=url;</script>";}
mysqli_close($conn);
?>
</body>
</html>

@ -0,0 +1,61 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>注册页面</title>
<style type="text/css">
nav{
background-image:url(file:///D|/Users/lenovo/Documents/2020%E5%B9%B4%E5%A4%A7%E4%B8%80%E4%B8%8B%E6%9C%9F%E6%9C%9F%E6%9C%AB/19%E8%BD%AF2%E7%8F%AD82%E6%9D%A8%E5%A4%9A%E6%80%9D%EF%BC%88%E6%95%B0%E6%8D%AE%E5%BA%93%EF%BC%89/xs/4.png);
height: 600px;
width: 1270px;}
#d1{
background-color: #6CF;
height: 100px;
font-family: "华文隶书";
color: #969;
font-size: 15px;
text-align:center;
}
#headl{
letter-spacing:20px;
background-color:#6CF;
height:45px;
font-family: "华文隶书";
color: #969;
font-size: 32px;
text-align: center;
border: 3px inset #CCF;
border-radius: 15px;
padding-top:0.5cm;
padding-bottom:0.5cm;
font-weight:bolder;
}
</style>
</head>
<body>
<nav>
<div id="headl">
学生成绩管理系统</div>
<br />
<table align="center" width="350" border="1" bgcolor="#99CCFF">
<tr>
<td><form action="register.php" method="post"><br /><br /><br />
&nbsp;&nbsp;用户名:&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; <input name="username" type="text" required /><br /><br /><br />
&nbsp;&nbsp;密码:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="password" type="password" required /><br /><br /><br />
&nbsp;&nbsp;确定密码:&nbsp;<input name="repassword" type="password" required /><br /><br />&nbsp;&nbsp;
<button type="submit">注册</button>
</form>
<br />
<form action="login.html" method="post">
&nbsp;&nbsp;&nbsp;<button type="submit">登录</button></form>
</td>
</tr>
</table>
<br /><br /><br /><br /><br />
<div id="d1"><br />&nbsp;&nbsp;&nbsp;&nbsp;系别:软件工程&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;班级19级软件工程2班&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;姓名:杨多思
<br />&nbsp;&nbsp;&nbsp;&nbsp;QQ1068637453&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;邮箱1068637453@qq.com</div>
</nav>
</body>
</html>

@ -0,0 +1,34 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>register.php</title>
</head>
<body>
<?php
$username=$_POST['username'];
$password=$_POST['password'];
$repassword=$_POST['repassword'];
if($password!=$repassword){
echo "<script>alert(\"两次密码不一致\");</script>";
echo "<script>url=\"register.html\";window.location.href=url;</script>";
exit();}
include("connect.php");
$sql="select userid from user where username='$username'";
$result=mysqli_query($conn,$sql);
if(mysqli_num_rows($result)>0){
echo "<script>alert(\"该用户已被注册\");</script>";
echo "<script>url=\"register.html\";window.location.href=url;</script>";
exit();}
$sql="insert into user values(null,'$username','$password')";
$result=mysqli_query($conn,$sql);
if($result){
echo "<script>alert(\"注册成功,登录\");</script>";
echo "<script>url=\"login.html\";window.location.href=url;</script>";}
else{
die("Error: ".mysqli_error($conn));}
mysqli_close($conn);
?>
</body>
</html>

@ -0,0 +1,133 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>成绩管理页面</title>
<style type="text/css">
nav{
background-color: #CCE8F4;
height: 650px;
width: 1260px;}
#d1{
background-color: #6CF;
height: 100px;
font-family: "华文隶书";
color: #969;
font-size: 15px;
text-align:center;
}
#headl{
background-color:#6CF;
height:45px;
font-family: "华文隶书";
color: #969;
font-size: 32px;
text-align: center;
border: 3px inset #CCF;
border-radius: 15px;
padding-top:0.5cm;
padding-bottom:0.5cm;
font-weight:bolder;
letter-spacing:20px;
}
.span1
{
background-color: #FFF;
display: inline-block;
width: 400px;
height: 380px;
float:right;
border: 3px inset #CCF;
border-radius: 15px;}
.span2
{
background-color: #FFF;
display: inline-block;
width: 320px;
height: 380px;
border: 3px inset #CCF;
border-radius: 15px;
text-align:center;
float:right;
}
.span3{
background-color: #FFF;
display: inline-block;
width: 240px;
height: 310px;
border: 3px inset #CCF;
border-radius: 15px;
text-align:center;
color:#333;
float:left;
padding-top:2cm;
}
.d2{
width:400px;
height:380px;
overflow:scroll;}
#d3{
width:158px;
height:25px;}
.d4{
padding-left:100cm;}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
</style>
</head>
<body>
<nav>
<div id="headl">
学生成绩管理</div>
<br />
<span class="span3">
<table width="140" border="1" align="center">
<tr>
<td><a href="student.html"><font color="#000000"><b>学生管理</b></font></a></td>
</tr>
</table>
<br /><br /><table width="140" border="1" align="center">
<tr>
<td><a href="score.php"><font color="#000000"><b>成绩管理</b></font></a></td>
</tr>
</table></span>
<span class="span1">
<iframe name="shuju" align="right" scrolling="auto" width="400px" height="380px"><div class="d4"></div></iframe><br /></span>
<span class="span2">
<br /><br /><br /><br /><br />
<form action="score.php" target="shuju" method="post">
&nbsp;姓名:<input type="text" name="XM" />
<br /><br />
课程:
<select name="KCM" id="d3">
<option>c++</option>
<option>网页设计</option>
<option>高数</option>
<option>php</option>
<option>mysql</option></select>
<br /><br />
&nbsp;成绩:<input type="text" name="CJ" />
<br /><br />
<button class="button" type="submit" name="录入">录入</button>&nbsp;&nbsp;
<button class="button" type="submit" name="查询">查询</button>&nbsp;&nbsp;
<button class="button" type="submit" name="删除">删除</button>&nbsp;&nbsp;
<button class="button" type="submit" name="更新">更新</button>&nbsp;&nbsp;
</form>
</span>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<div id="d1"><br />&nbsp;&nbsp;&nbsp;&nbsp;系别:软件工程&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;班级19级软件工程2班&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;姓名:杨多思
<br />&nbsp;&nbsp;&nbsp;&nbsp;QQ1068637453&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;邮箱1068637453@qq.com</div>
</nav>
</body>
</html>

@ -0,0 +1,141 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>score.php</title>
</head>
<body>
<?php
session_start();
?>
<?php
include("connect.php");
$name=$_POST['XM'];
$kcm=$_POST['KCM'];
$score=$_POST['CJ'];
if(isset($_POST['录入']))
{
if(!strlen($name))
{
echo "<script>alert(\"姓名处不能为空\");</script>";
exit();}
$sql="select XM,KCM from cj where XM='$name' and KCM='$kcm'";
$result=mysqli_query($conn,$sql);
if(mysqli_num_rows($result))
{
echo "<script>alert(\"该学生此课程成绩已录入\");</script>";
exit();}
$sql="insert into cj(XM,KCM,CJ) values('$name','$kcm','$score')";
$result=mysqli_query($conn,$sql);
if($result)
{
echo "<script>alert(\"录入成功\");</script>";
$result=mysqli_query($conn,"select *from cj where XM='$name' and KCM='$kcm';");
$row=mysqli_fetch_array($result);
echo "<table border <tr><th>姓名</th><th>课程名</th><th>成绩</th></tr>";
echo "<tr><th>".$row['XM']."</th>";
echo "<th width=80px>".$row['KCM']."</th>";
echo "<th width=60px>".$row['CJ']."</th></tr>";
echo "</table>";}
else{
echo "<script>alert(\"录入失败\");</script>";
exit();}
}
if(isset($_POST['更新']))
{
if(!strlen($name)||!strlen($kcm)||!strlen($score))
{
echo "<script>alert(\"请填写完整信息\");</script>";
exit();}
$sql="select XM from cj where XM='$name'";
$result=mysqli_query($conn,$sql);
if(!mysqli_num_rows($result)){
echo "<script>alert(\"该学生不存在\");</script>";
exit();}
$sql="update cj set CJ='$score' where XM='$name' and KCM='$kcm'";
$result=mysqli_query($conn,$sql);
if($result)
{
echo "<script>alert(\"更新成功\");</script>";
$result=mysqli_query($conn,"select *from cj where XM='$name' and KCM='$kcm'");
$row=mysqli_fetch_array($result);
echo "<table border <tr><th>姓名</th><th>课程名</th><th>成绩</th></tr>";
echo "<tr><th>".$row['XM']."</th>";
echo "<th width=80px>".$row['KCM']."</th>";
echo "<th width=40px>".$row['CJ']."</th></tr>";
echo "</table>";
}
else
{
echo "<script>alert(\"更新失败\");</script>";
exit();}
}
if(isset($_POST['查询']))
{
if(strlen($name))
{
$sql="select *from cj where XM='$name'";
$result=mysqli_query($conn,$sql);
if(mysqli_num_rows($result))
{
echo "<table border <tr><th>姓名</th><th>课程名</th><th>成绩</th></tr>";
while($row=mysqli_fetch_array($result))
{
echo "<tr><th>".$row['XM']."</th>";
echo "<th width=80px>".$row['KCM']."</th>";
echo "<th width=60px>".$row['CJ']."</th></tr>";
}
echo "</table>";
}
else
{
echo "<script>alert(\"该学生不存在\");</script>";
exit();}
}
else if(strlen($kcm))
{
$sql="select *from cj where KCM='$kcm'";
$result=mysqli_query($conn,$sql);
if(mysqli_num_rows($result))
{
echo "<table border <tr><th>姓名</th><th>课程名</th><th>成绩</th></tr>";
while($row=mysqli_fetch_array($result))
{
echo "<tr><th>".$row['XM']."</th>";
echo "<th width=80px>".$row['KCM']."</th>";
echo "<th width=60px>".$row['CJ']."</th></tr>";}
echo "</table>";}
else
{
echo "<script>alert(\"该课程无学生选择\");</script>";
exit();}
}
}
if(isset($_POST['删除']))
{
if(!strlen($name)&&!strlen($kcm))
{
echo "<script>alert(\"姓名不能为空或课程名不能为空\");</script>";
exit();}
$sql="select XM from cj where XM='$name' and KCM='$kcm'";
$result=mysqli_query($conn,$sql);
if(!$result)
{
echo "<script>alert(\"该学生不存在\");</script>";
exit();}
$sql="delete from cj where XM='$name' and KCM='$kcm'";
$result=mysqli_query($conn,$sql);
if($result)
{
echo "<script>alert(\"删除成功\");</script>";
exit();}
else
{
echo "<script>alert(\"删除失败\");</script>";
exit();}
}
mysqli_close($conn);
?>
</body>
</html>

@ -0,0 +1,134 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>学生信息管理</title>
<style type="text/css">
nav{
background-color: #CCE8F4;
height: 650px;
width: 1260px;}
.div1{
background-color: #CCE8F4;
display: inline;
width: 10px;
font-family: "华文隶书";
color: #000;
font-size: 18px;
}
.span1{
background-color: #FFF;
display: inline-block;
width: 240px;
height: 400px;
border: 3px inset #CCF;
border-radius: 15px;
text-align:center;
color:#333;
float:left;
}
.span2
{
background-color: #FFF;
display: inline-block;
width: 350px;
height: 400px;
border: 3px inset #CCF;
border-radius: 15px;
float:right;
padding-left:0.5cm;}
.span3
{
background-color: #FFF;
display: inline-block;
width: 450px;
height: 400px;
border: 3px inset #CCF;
border-radius: 15px;
float:right;}
#d1{
letter-spacing:20px;
background-color:#6CF;
height:45px;
font-family: "华文隶书";
color: #969;
font-size: 32px;
text-align: center;
border: 3px inset #CCF;
border-radius: 15px;
padding-top:0.5cm;
padding-bottom:0.5cm;
font-weight:bolder;
}
#d2{
background-color: #6CF;
height: 100px;
font-family: "华文隶书";
color: #969;
font-size: 15px;
text-align:center;
}
#d3{
background-color:#FFF;
width:350px;
height:440px;
text-align:left;}
.d4{
color:#000;}
a:link {
text-decoration: none;
}
.d6{
padding-left:3cm;}
.d7{
padding-top:2.5cm;}
</style>
</head>
<body>
<nav>
<div id="d1">
学生信息管理</div>
<br />
<span class="span1"><br /><br /><br /><table width="140" border="1" align="center" background="file:///D|/Users/lenovo/Documents/2020年大一下期期末/19软2班82杨多思数据库/xs/4.png">
<tr>
<td><a href="student.php"><font color="#000000"><b>学生管理</b></font></a></td>
</tr>
</table>
<br /><br /><table width="140" border="1" align="center">
<tr>
<td><a href="score.html"><font color="#000000"><b>成绩管理</b></font></a></td>
</tr>
</table>
<br />
</span>
<span class="span3">
<iframe name="shuju" align="right" scrolling="auto" width="450px" height="400px"></iframe></span>
<span class="span2">
<br /><br /><br />
<form action="student.php" target="shuju" method="post">
&nbsp;姓名:<input type="text" name="XM" />
<br /><br />
&nbsp;性别:<input type="radio" name="XB" value="1" />
<input type="radio" name="XB" value="0" /><br /><br />
&nbsp;出生日期:<input type="date" name="CSSJ" /><br /><br />
&nbsp;课程数:<input type="number" name="KCS" />
<br /><br />
<div class="d7">
<button class="button" type="submit" name="录入">录入</button>&nbsp;&nbsp;
<button class="button" type="submit" name="查询">查询</button>&nbsp;&nbsp;
<button class="button" type="submit" name="删除">删除</button>&nbsp;&nbsp;
<button class="button" type="submit" name="更新">更新</button>&nbsp;&nbsp;</div>
</form></span>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<div id="d2">
<br />&nbsp;&nbsp;&nbsp;&nbsp;系别:软件工程&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;班级19级软件工程2班&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;姓名:杨多思
<br />&nbsp;&nbsp;&nbsp;&nbsp;QQ1068637453&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;邮箱1068637453@qq.com</div>
</nav>
<br />
</nav>
</body>
</html>

@ -0,0 +1,200 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>student.php</title>
</head>
<body>
<?php
session_start();
?>
<?php
include("connect.php");
$name=$_POST['XM'];
$xb=$_POST['XB'];
$birthday=$_POST['CSSJ'];
$kcs=$_POST['KCS'];
if(isset($_POST['录入']))
{
if(!strlen($name))
{
echo "<script>alert(\"姓名不能为空\");</script>";
exit();}
$sql="select XM from student where XM='$name'";
$result=mysqli_query($conn,$sql);
if(mysqli_num_rows($result))
{
echo "<script>alert(\"该学生已存在\");</script>";
exit();}
$sql="insert into student(XM,XB,CSSJ,KCS) values('$name','$xb','$birthday','$kcs')";
$result=mysqli_query($conn,$sql);
if($result)
{
echo "<script>alert(\"录入成功\");</script>";
$result=mysqli_query($conn,"select *from student where XM='$name';");
$row=mysqli_fetch_array($result);
echo "<table border <tr><th>姓名</th><th>性别</th><th>出生日期</th><th>已修课程数</th></tr>";
echo "<tr><th>".$row['XM']."</th>";
echo "<th width=40px>";
if($row['XB']==1) echo "男";
else echo "女";
echo "</th>";
echo "<th width=120px>".$row['CSSJ']."</th>";
echo "<th width=60px>".$row['KCS']."</th></tr>";
echo "</table>";}
else{
echo "<script>alert(\"录入失败\");</script>";
exit();}
}
if(isset($_POST['查询']))
{
if(!strlen($name)&&!strlen($xb)&&!strlen($kcs)){
$sql="select *from student";
$result=mysqli_query($conn,$sql);
if(mysqli_num_rows($result))
{
echo "<table border <tr><th>姓名</th><th>性别</th><th>出生日期</th><th>已修课程数</th></tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr><th>".$row['XM']."</th>";
echo "<th width=40px>";
if($row['XB']==1) echo "男";
else echo "女";
echo "</th>";
echo "<th width=120px>".$row['CSSJ']."</th>";
echo "<th width=60px>".$row['KCS']."</th></tr>";}}
else
{
echo "<script>alert(\"无学生\");</script>";
exit();}
}
if(strlen($name))
{
$sql="select *from student where XM='$name'";
$result=mysqli_query($conn,$sql);
if(mysqli_num_rows($result))
{
$result=mysqli_query($conn,"select *from student where XM='$name'");
$row=mysqli_fetch_array($result);
echo "<table border <tr><th>姓名</th><th>性别</th><th>出生日期</th><th>已修课程数</th></tr>";
echo "<tr><th>".$row['XM']."</th>";
echo "<th width=40px>";
if($row['XB']==1) echo "男";
else echo "女";
echo "</th>";
echo "<th width=120px>".$row['CSSJ']."</th>";
echo "<th width=60px>".$row['KCS']."</th></tr>";
echo "</table>";}
else
{
echo "<script>alert(\"该学生不存在\");</script>";
exit();}
}
else if(strlen($xb))
{
$sql="select *from student where XB='$xb'";
$result=mysqli_query($conn,$sql);
if(mysqli_num_rows($result))
{
echo "<table border <tr><th>姓名</th><th>性别</th><th>出生日期</th><th>已修课程数</th></tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr><th>".$row['XM']."</th>";
echo "<th width=40px>";
if($row['XB']==1) echo "男";
else echo "女";
echo "</th>";
echo "<th width=120px>".$row['CSSJ']."</th>";
echo "<th width=60px>".$row['KCS']."</th></tr>";
}
echo "</table>";}
else
{
echo "<script>alert(\"查询无数据\");</script>";
exit();}
}
else if(strlen($kcs))
{
$sql="select *from student where KCS='$kcs'";
$result=mysqli_query($conn,$sql);
if(mysqli_num_rows($result))
{
echo "<table border <tr><th>姓名</th><th>性别</th><th>出生日期</th><th>已修课程数</th></tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr><th>".$row['XM']."</th>";
echo "<th width=40px>";
if($row['XB']==1) echo "男";
else echo "女";
echo "</th>";
echo "<th width=120px>".$row['CSSJ']."</th>";
echo "<th width=60px>".$row['KCS']."</th></tr>";}
echo "</table>";
}
else
{
echo "<script>alert(\"查询无数据\");</script>";
exit();}
}
}
if(isset($_POST['删除']))
{
if(!strlen($name))
{
echo "<script>alert(\"姓名不能为空\");</script>";
exit();}
$sql="select XM from student where XM='$name'";
$result=mysqli_query($conn,$sql);
if(!mysqli_num_rows($result))
{
echo "<script>alert(\"该学生不存在\");</script>";
exit();}
$sql="delete from student where XM='$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)||!strlen($xb)||!strlen($birthday)||!strlen($kcs))
{
echo "<script>alert(\"请把信息填写完整\");</script>";
exit();}
$sql="select XM from student where XM='$name'";
$result=mysqli_query($conn,$sql);
if(!mysqli_num_rows($result))
{
echo "<script>alert(\"该学生不存在\");</script>";
exit();}
$sql="update student set XB='$xb',CSSJ='$birthday',KCS='$kcs' where XM='$name'";
$result=mysqli_query($conn,$sql);
if($result)
{
echo "<script>alert(\"更新成功\");</script>";
$result=mysqli_query($conn,"select *from student where XM='$name'");
$row=mysqli_fetch_array($result);
echo "<table border <tr><th>姓名</th><th>性别</th><th>出生日期</th><th>已修课程数</th></tr>";
echo "<tr><th>".$row['XM']."</th>";
echo "<th width=40px>";
if($row['XB']==1) echo "男";
else echo "女";
echo "</th>";
echo "<th width=120px>".$row['CSSJ']."</th>";
echo "<th width=60px>".$row['KCS']."</th></tr>";
echo "</table>";}
else
{
echo "<script>alert(\"更新失败\");</script>";
exit();}
}
mysqli_close($conn);
?>
</body>
</html>
Loading…
Cancel
Save