phpinfo();
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
<!DOCTYPE html>
<?php
header("Content-type: text/html;charset=utf-8;");
$id=filter_input(INPUT_POST, 'id');
$password= filter_input(INPUT_POST, 'password');
$jb=filter_input(INPUT_POST,'jb');
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
$link=mysqli_connect("127.0.0.1","root","root","phpdata");
mysqli_set_charset($link,"utf8");
$query="select password,jb from id1 where id=".$id;
$result= mysqli_query($link, $query);
if(!mysqli_num_rows($result))
{echo "<script>alert('没有此用户!');window.location.href='index.php';</script>";}
else
{
$row=mysqli_fetch_assoc($result);
if($row["password"]==$password&&$row["jb"]==$jb)
{
setcookie("willid",$id,time()+3600);
setcookie("nowid",$id,time()+600);
setcookie("nowjb",$jb,time()+600);
echo "<script>alert('欢迎你的驾临!');window.location.href='fun.php';</script>";}
else {echo "<script>alert('密码错误!');window.location.href='index.php';</script>";}
}
<!DOCTYPE h\
ml>
<?php
header("Content-type: text/html;charset=utf-8;");
$id=filter_input(INPUT_POST,'id');
$password=filter_input(INPUT_POST,'password');
$jb= filter_input(INPUT_POST,'jb');
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
echo $id;
echo "<hr>";
echo $password."<hr>";
echo $jb."<hr>";
$link=mysqli_connect("127.0.0.1","root","root");
mysqli_set_charset($link,"utf8");
if(!$link)
{ echo "数据库未连接成功!";}
if(!mysqli_set_charset($link,"utf8"))
{ echo "<hr>"."数据库编码格式没有调整为utf-8"."<hr>";}
if(!mysqli_select_db($link,'phpdata'))
{ echo "数据库没有选择成功!"."<hr>";}
//遍历数据实例:
$sql="select * from id1 where id=".$id;
$result=mysqli_query($link,$sql);
if(mysqli_num_rows($result))
{
echo"<script>alert('该用户已存在');history.go(-1);</script>";
}
else
{
$query="insert into id1 values('{$id}','{$password}','{$jb}','0','0','0')";
if(mysqli_query($link,$query))
{
echo"<script>alert('注册成功了,开始登陆作战吧!');</script>";
echo"<script>window.location.href='index.php';</script>";
}
else
{
echo $id." ".$password." ".$jb."插入失败!"."<hr>";
}
}
<!DOCTYPE html>
<?php
header("Content-type:text/html;charset=utf-8;");
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
$id=isset($_COOKIE["nowid"])?$_COOKIE["nowid"]:'';
$jb=isset($_COOKIE["nowjb"])?$_COOKIE["nowjb"]:'';
if($id=='')
{echo "<script>window.location.href='index.php';</script>";}
if($jb=="student")
{$jbname="学生";}
if($jb=="teacher")
{$jbname="老师";}
$link=mysqli_connect("127.0.0.1", "root", "root", "phpdata");
mysqli_set_charset($link, "utf8")
?>
<html>
<head>
<meta charset="UTF-8">
<title>功能</title>
<link href="https://cdn.bootcss.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<style>
h1{line-height:100px;height:100px;color:green;}
.left{width:25%;border:1px solid green;border-radius:6px 6px;float:left;margin-right:60px;padding:7px 10px;margin-left:10px;position:fixed;}
.right{width:55%;border:1px solid green;border-radius:3px 3px;float:right;padding:10px 20px;margin-right:15%;margin-bottom:30px;padding-bottom: 30px }
button{width:315px;}
table{width:100%;border:2px solid green;text-align:center;}
button:active{font-size: 9px;}
</style>
<h1 align="center">QUT.EDU</h1>
<hr>
<div class="left">
<h3 align="center">所有权</h3>
<hr>
<p>登陆者id:<?php echo $id."身份:".$jbname;?></p>
<a href="index.php"><button class="btn">重新登陆</button></a>
<form method="post" action="fun.php" role="form">
<br>
<input type="text" class="form-control"name="select"placeholder="请输入id">
<button class="btn btn-success" type="submit" >查询</button>
</form>
<br>
<form role="form" method="post" action="fun.php">
<input type="text" class="form-control"name="alter_0" style="width:100px;float:left;margin:0 2px;"placeholder="id" <?php if($jb=='student') {echo 'disabled="disabled"';}?> >
<select <?php if($jb=='student') {echo 'disabled="disabled"';}?> class="form-control" style="width:100px;display:inline-block;"name="alter_1">
<option value ="meth">数学</option>
<option value ="english">英语</option>
<option value="chinese">语文</option>
</select>
<input type="text" class="form-control"name="alter_2" style="width:100px;float:left;margin:0 2px;"placeholder="修正值" <?php if($jb=='student') {echo 'disabled="disabled"';}?>>
<button class="btn btn-success" type="submit" <?php if($jb=='student') {echo 'disabled="disabled"';}?> >修改</button>
</form>
<br>
<form method="post" action="fun.php" role="form">
<input type="text" class="form-control"name="delete"placeholder="请输入id"<?php if($jb=='student') {echo 'disabled="disabled"';}?> >
<button type="submit" class="btn btn-success" <?php if($jb=='student') {echo 'disabled="disabled"';}?>>删除</button>
<br>
</form>
</div>
<div class="right">
<h1 align="center">信息表</h1>
<hr>
<?php
$select=filter_input(INPUT_POST, "select");
$alter_0= filter_input(INPUT_POST, "alter_0");
$alter_1= filter_input(INPUT_POST, "alter_1");
$alter_2= filter_input(INPUT_POST, "alter_2");
$delete= filter_input(INPUT_POST, "delete");
if($select!="")
{
if(!is_numeric($select))
{ echo "请输入正确id!";}
else
{
$query_select="select * from id1 where id=".$select;
$result_select= mysqli_query($link, $query_select);
if(!mysqli_num_rows($result_select))
{ echo "查无此人!";}
if(mysqli_num_rows($result_select)==1)
{
$row= mysqli_fetch_assoc($result_select);
echo "学工号:";
echo $row["id"];
echo "<hr>";
echo "身份:";
echo $row["jb"];
echo "<hr>";
echo "数学:";
echo $row["meth"];
echo "<hr>";
echo "语文:";
echo $row["chinese"];
echo "<hr>";
echo "英语:";
echo $row["english"];
echo "<hr>";
echo "总分:";
echo $row["meth"]+$row["chinese"]+$row["english"];
}
}
}
if($delete!="")
{
if(!is_numeric($delete))
{echo "请输入正确id";}
else{
$query_delete="select * from id1 where id=".$delete;
$result_delete= mysqli_query($link, $query_delete);
if(!mysqli_num_rows($result_delete))
{ echo "查无此人!";}
else
{
$result_delete_true="delete from id1 where id=".$delete;
if(mysqli_query($link, $result_delete_true))
{echo "删除成功!";}
else
{echo "删除失败!";}
}
}
}
if($alter_0!=0||$alter_2!=0)
{
if($alter_0!=''&&$alter_2!='')
{
$query_alter="select * from id1 where id=".$alter_0;
$result_alter= mysqli_query($link, $query_alter);
if(!mysqli_num_rows($result_alter))
{ echo "查无此人!";}
else if(!is_numeric($alter_2))
{echo "修改值必须是数字";}
else if($alter_2<=150&&$alter_2>=0)
{
$query_alter_="update id1 set ".$alter_1."=".$alter_2." where id=".$alter_0;
$result_alter_=mysqli_query($link,$query_alter_);
if($result_alter_)
{echo "修改成功!";}
}
}
else if($alter_2==''||$alter_0=='')
{echo "请填写完整";}
}
if($delete==''&&$alter_0==""&&$alter_2==''&&$select=='')
{
$query_all="select * from id1 where jb='student'order by id asc";
$result_all= mysqli_query($link, $query_all);
echo "<br>";
echo '<table border="1"><tr><td>学工号</td><td>身份</td><td>英语</td><td>语文</td><td>数学</td><td>总分</td></tr>';
while($row= mysqli_fetch_assoc($result_all))
{
$all=$row["english"]+$row["chinese"]+$row["meth"];
echo "<tr><td> {$row["id"]}</td> ".
"<td>{$row["jb"]} </td> ".
"<td>{$row["english"]} </td> ".
"<td>{$row["chinese"]} </td> ".
"<td>{$row["meth"]} </td> ".
"<td>{$all} </td> ".
"</tr>";
}
echo '</table>';
}
?>
</div>
<script>
</script>
</body>
</html>
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<?php
$will_id=isset($_COOKIE["willid"])?$_COOKIE["willid"]:'';
?>
<html>
<head>
<meta charset="UTF-8">
<title>登录</title>
<link href="https://cdn.bootcss.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet">
</head>
<body >
<style>
.startdiv{margin:0 auto;width:24%;margin-top:10%;border:1px solid green;padding:20px 30px;border-radius:35px 0px;}
h1,h6{color:green;}
button{background-color:green;color:white;}
</style>
<div class="startdiv">
<form role="form" action="do_denglu.php" method="post">
<div class="form-group">
<h1>QUT.EDU</h1>
<hr>
<h6>学工号:</h6>
<input class="form-control" type="text" placeholder="请输入学工号" name="id" value="<?PHP echo $will_id;?>">
<h6>密码:</h6>
<input type="password" class="form-control" placeholder="请输入密码" name="password">
<label>
老师
<input type="radio" value="teacher" name="jb" checked>
</label>
<label>
学生
<input type="radio" value="student" name="jb" >
</label>
</div>
<button class="btn btn-default" type="submit">登录</button>
<a href="zhuce.html"><button class="btn btn-default"type="button">注册</button></a>
</form>
</div>
</body>
</html>
QUT.EDU注册
学工号:
密码:
再次输入密码:
你的身份: 老师 学生注册 重置
这是舍友大力帮助下写的,具体软件的安装与下载我有时间的话在修该,希望对你有所帮助