1
0
Fork 0
This commit is contained in:
Chenx221 2024-01-17 15:10:30 +08:00
parent bbb2885e18
commit ea7fc186db
5 changed files with 131 additions and 1 deletions

View File

@ -1 +1,14 @@
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST') {
$username = $_POST['username'];
$password = $_POST['password'];
if ($username == 'admin' && $password == 'admin') {
session_start();
setcookie("access",$username,time() + 30);
header('Location: 11.work1.main.php');
} else {
echo "<script>alert('用户名或密码错误!');window.location.href='11.work1.login.php';</script>";
}
}else{
header("location:11.work1.login.php");
}

View File

@ -1 +1,50 @@
<?php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>试用版学习资源网 登录</title>
</head>
<body>
<form method="post" action="11.work1.auth.php">
<table>
<tr>
<th colspan="2" style="text-align: center">
<h1>用户登录</h1>
</th>
</tr>
<tr>
<td>
<label for="username1">用户名</label>
</td>
<td>
<input type="text" id="username1" name="username" required>
</td>
</tr>
<tr>
<td>
<label for="password1">密码</label>
</td>
<td>
<input type="password" name="password" id="password1" required>
</td>
</tr>
<tr>
<td>
<input type="submit" value="登录" name="submit" id="submit1" onclick="return check()">
<input type="reset" value="重置" name="reset" id="reset1">
</td>
</tr>
</table>
</form>
<script>
function check(){
//check username and password empty
const username = document.getElementById("username1").value;
const password = document.getElementById("password1").value;
if(username === "" || password === ""){
alert("用户名或密码不能为空!");
return false;
}
}
</script>
</body>

View File

@ -1 +1,25 @@
<?php
session_start();
$refresh_time = 30;
header("refresh:$refresh_time");
if (empty($_COOKIE['access'])) {
echo <<<EOL
<script>
alert("试用时间已到,请重新登录进行试用");
window.location.href="11.work1.login.php";
</script>
EOL;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>试用版学习资源网</title>
</head>
<body>
暂无学习内容,每次试用会在30s后失效,页面会在试用失效后跳转会登录
</body>

View File

@ -1 +1,37 @@
<?php
session_start();
if (isset($_POST['submit'])) {
$_SESSION['color'] = $_POST['color'];
}
?>
<!--聊天室就免了-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>聊天室</title>
</head>
<body>
<div style="width: 50px;height: 50px;line-height: 50px;text-align: center;border: solid 1px black;
<?php
if(!empty($_SESSION['color'])){
$color = $_SESSION['color'];
echo "background-color: $color;";
}
?> ">
色图
</div>
<form method="post" action="">
<label for="color_select1">在这里可以更改上方色图颜色</label>
<select name="color" id="color_select1">
<option value="white" selected>白色</option>
<option value="green">草绿色</option>
<option value="yellow">亮黄色</option>
<option value="white">纯白色</option>
<option value="red">鲜红色</option>
<option value="gray">深灰色</option>
<option value="lavender">熏衣草</option>
</select>
<input type="submit" name="submit" id="submit1">
</form>
</body>

View File

@ -1 +1,9 @@
<?php
//require_once ('jpgraph\jpgraph.php');
//require_once ('jpgraph\jpgraph_pie.php');
header("Content-type: image/gif");
$im = imagecreate(200,60); //创建一个画布
$grey = imagecolorallocate($im, 255,255,255); //设置画布的背景颜色为灰色
imagegif($im); //输出图像
imagedestroy($im);
?>