first commit

This commit is contained in:
2025-01-09 11:57:41 +08:00
commit 700113c47b
47 changed files with 2050 additions and 0 deletions

8
.idea/.gitignore generated vendored Normal file
View File

@ -0,0 +1,8 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

8
.idea/20250103.iml generated Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

8
.idea/modules.xml generated Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/20250103.iml" filepath="$PROJECT_DIR$/.idea/20250103.iml" />
</modules>
</component>
</project>

20
.idea/php.xml generated Normal file
View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MessDetectorOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PHPCSFixerOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PHPCodeSnifferOptionsConfiguration">
<option name="highlightLevel" value="WARNING" />
<option name="transferred" value="true" />
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="7.0" />
<component name="PhpStanOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PsalmOptionsConfiguration">
<option name="transferred" value="true" />
</component>
</project>

6
.idea/vcs.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

485
Readme.md Normal file
View File

@ -0,0 +1,485 @@
本题5分 共5个小题
1. B/S架构系统后台常见的服务器端编程技术有JSP 、______、PHP、Python等。
2. JavaScript是一种___________编程语言。
3. CMS是指________________。
4. B/S架构系统制作完成后一般通过_____________工具上传到服务器上运行。
5. HTTP服务器默认监听的是______________端口。
备注:作答结果填写在中间的作答框中,答案之间用空格分开就行,不用写题号,顺序不限制。
```
ASP
解释型
内容管理系统
FTP
80
```
本题5分
div+CSS编程
样式如下
![img](http://125.64.9.222:8022/question/question_10_1_1.png)
要求如下:
1. 各div的id如图所示。
2. 所有的div相对定位左浮动border都为实线,1px,红色。
3. 所有的div的外边距为10px内边距为10px。
4. main的宽为400px高为270px;
5. top的宽为358px,高为20px。
6. menu的宽为358px,高为20px。
7. footer的宽为358px高为15px。
8. left的宽为110px。
<!DOCTYPE html>
```
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Div Layout</title>
<style>
div {
position: relative;
float: left;
border: 1px solid red;
margin: 10px;
padding: 10px;
}
#main {
width: 400px;
height: 270px;
}
#top {
width: 358px;
height: 20px;
}
#menu {
width: 358px;
height: 20px;
}
#footer {
width: 358px;
height: 15px;
}
#left {
width: 110px;
}
#right_1, #right_2 {
width: 206px; /* 358px (main inner width) - 110px (left) - 20px (2 * margin) */
}
</style>
</head>
<body>
<div id="main">
<div id="top">Top</div>
<div id="menu">Menu</div>
<div id="left">Left</div>
<div id="right_1">Right 1</div>
<div id="right_2">Right 2</div>
<div id="footer">Footer</div>
</div>
</body>
</html>
```
本题5分 共5个小题
1. 一般情况下B/S架构系统的首页文件名是_______________。
2. 小型B/S架构系统可采用申请________________的方式运行。
3. document.getElementById的功能是________________。
4. JavaScript编程中产生随机数是用________________。
5. Jquery是________________。
备注:作答结果填写在中间的作答框中,答案之间用空格分开就行,不用写题号,顺序不限制。
```
index.html 虚拟主机 获取对象 Math.random() js类库
```
本题5分 共5个小题
> 1. spring boot中@RequestMapping注解的作用是___________。
> 2. spring boot中'@SpringBootApplication注解的作用是___________。
> 3. spring boot中'@Controller注解的作用是___________。
> 4. spring boot中'@Service注解的作用是___________。
> 5. spring boot中'@Autowired注解的作用是___________。
备注:作答结果填写在中间的作答框中,答案之间用空格分开就行,不用写题号,顺序不限制。
```
映射URL路径
主配置类
标识一个Java 类是一个控制器
用于标识服务层组件
注入对象
```
本题5分 共5个小题
> 1. ___________是用来简化Spring MVC的技术。
> 2. spring boot中使用注解来代替繁琐的__________配置。
> 3. AOP是指________________。
> 4. IOC是指________________。
> 5. DI是指______________。
备注:作答结果填写在中间的作答框中,答案之间用空格分开就行,不用写题号,顺序不限制。
```
springboot XML 面向切面编程 控制反 依赖注入
```
本题5分 共5个小题
数据表student的字段为id,name,score;偏移量为offset每页记录数为rowsOfPage;完成mapper层的功能设计
> <mapper namespace="com.luowei.app.mapper.StudentMapper">
> <select id="selectAll" resultType="com.luowei.app.entity.StudentEntity">
>
> 1._______________________________________________________
> </select>
> <select id="selectLimit" resultType="com.luowei.app.entity.StudentEntity">
>
> 2._______________________________________________________
> </select>
> <select id="selectCount" resultType="int">
>
> 3._______________________________________________________
> </select>
> <select id="select" resultType="com.luowei.app.entity.StudentEntity">
>
> 4._______________________________________________________
> </select>
> <update id="update" parameterType="com.luowei.app.entity.StudentEntity">
>
> 5._______________________________________________________
> </update>
> </mapper>
备注SQL关键词大写。作答结果填写在中间的作答框中答案之间用空格分开就行不用写题号顺序不限制。
```
`<mapper namespace="com.luowei.app.mapper.StudentMapper">`
`<select id="selectAll" resultType="com.luowei.app.entity.StudentEntity">`
`SELECT * FROM student`
`</select>`
`<select id="selectLimit" resultType="com.luowei.app.entity.StudentEntity">`
`SELECT * FROM student LIMIT #{offset},#{rowsOfPage}`
`</select>`
`<select id="selectCount" resultType="int">`
`SELECT COUNT(*) AS counter FROM student`
`</select>`
`<select id="select" resultType="com.luowei.app.entity.StudentEntity">`
`SELECT * FROM student WHERE id=#{id}`
`</select>`
`<update id="update" parameterType="com.luowei.app.entity.StudentEntity">`
`UPDATE student SET name=#{name},score=#{score} WHERE id=#{id}`
`</update>`
`</mapper>`
```
————————————————————————————————————————————————————————————————————————————————
本题5分 共5个小题
数据表student的字段为id,name,score;偏移量为offset每页记录数为rowsOfPage;数据表实体为:StudentEntity;完成mapper接口的功能设计
> @Repository
> @Mapper
> public interface StudentMapper {
>
> List<StudentEntity> 1.___________________________________
>
> List<StudentEntity> 2.___________________________________
>
> 3._______________________________________________________
>
> 4._______________________________________________________
>
> 5._______________________________________________________
> }
备注SQL关键词大写函数与方法名遵循驼峰命名法。作答结果填写在中间的作答框中答案之间用空格分开就行不用写题号顺序不限制。
```
selectAll();
selectLimit(int offset,int rowsOfPage);
int selectCount();
StudentEntity select(String id);
int update(StudentEntity studentEntity);
```
Javascript编程实现回调
要求如下:
1. 定义函数main实现回调。
2. main函数接受一个回调参数实现回调功能。
3. 回调时传"callback"字符串参数给回调函数。
4. 注:此题在提交时,请把自行测试时调用函数的代码行注释掉或是删除
```
<html lang="en">
<head>
<meta charset="utf-8">
<title>14</title>
</head>
<body>
<script>
function main(callback){
callback("callback");
}
function myCallback(arg){
console.log(arg);
}
main(myCallback);
</script>
</body>
</html>
```
本题5分
使用AJAX技术获取服务器时间。
要求如下:
1. 获取的时间显示在div中div的id为div_1。
2. 从服务器返回的数据是JSON格式时间数据的键为time。
3. 服务器处理程序的地址为"/public_libs/server_ajax_521_1.php"
4. Jquery的引入地址为"/public_libs/jquery.js"(注此项非强制,可用原生代码实现)
```
<!DOCTYPE html>
<html>
<head>
<title>AJAX获取服务器时间</title>
<script src="/public_libs/jquery.js"></script>
</head>
<body>
<div id="div_1"></div>
<script type="text/javascript">
$(document).ready(function() {
$.ajax({
url: "/public_libs/server_ajax_1.php",
type: "GET",
success: function(response) {
$("#div_1").html(response);
}
});
});
</script>
</body>
</html>
```
本题5分
HIS程序设计专项能力评测前端程序设计专用。
患者首诊建档。
样式如下:
![img](http://125.64.9.222:8022/question/question_60_2_1.png)
要求如下:
1. form的id为form_1,
2. 姓名输入框的id,name为name;对应信息提示区span的id为span_name
3. 身份证输入框的id,name为id;对应信息提示区span的id为span_id
4. 性别控件的name为genderid男为male女为femalevalue男为01女为02;对应信息提示区span的id为span_gender
5. 家庭地址省控件的id,name为provinceoption的value及标题依次为"510000000000,四川""130000000000,河北""530000000000,云南";对应信息提示区span的id为span_province
6. 家庭地址市控件的id,name为cityoption的value及标题依次为"510100000000,成都""510700000000,绵阳""510600000000,德阳",默认选中德阳;对应信息提示区span的id为span_city
7. 既往史的name为historyid高血压为hypertension、糖尿病为diabetes、 精神病为psychosisvalue高血压为icd_01糖尿病为icd_02精神病为icd_03。对应信息提示区span的id为span_history
8. 保存按钮的id,name,value为oktype为button
9. 实现函数checkData完成如下功能
10. 当姓名为空时,在姓名提示区显示:姓名不能为空
11. 当性别为空时,在性别提示区显示:请选择性别
12. 当市没有选中德阳,在市提示区显示:请选择德阳
13. 既往史没有选定项时,在既往史提示区显示:请选择至少一项疾病
14. 没有错误时,信息区显示空白
```
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<form id="form_1">
姓名:<input type="text" id="name" name="name" value="">
<span id="span_name"></span><br>
身份证:<input type="text" id="id" name="id" value="">
<span id="span_id"></span><br>
性别:<input type="radio" id="male" name="gender" value="1">男
<input type="radio" id="female" name="gender" value="2">女
<span id="span_gender"></span><br>
家庭地址:<select id="province" name="province">
<option value="sc">四川</option>
<option value="hb">河北</option>
<option value="yn">云南</option>
</select>
<span id="span_province"></span><br>
<select id="city" name="city">
<option checked value="510600000000">德阳</option>
<option value="510700000000">绵阳</option>
<option value="510100000000">成都</option>
</select>
<span id="span_city"></span><br>
既往史:<input type="checkbox" id="hypertension" name="history" value="icd_01">高血压
<input type="checkbox" id="diabetes" name="history" value="icd_02">糖尿病
<input type="checkbox" id="psychosis" name="history" value="icd_03">精神病
<span id="span_history"></span><br>
<input type="button" id="ok" name="ok" value="ok" onclick="checkData()">
</form>
</body>
<script>
function checkData()
{
var objName=document.getElementById("name");
var objSpanName=document.getElementById("span_name");
var objid=document.getElementById("id");
var objSpan_id=document.getElementById("span_id");
var objgender=document.getElementById("span_gender");
var objcity=document.getElementById("span_city");
var objhistory=document.getElementById("span_history");
var name1=objName.value;
var id1=objid.value;
var gender1=objgender.value;
var city1=objcity.value;
var history1=objhistory.value;
var errorMessage_1="";
var errorMessage_2="";
var errorMessage_3="";
var errorMessage_4="";
if(name1=="")
{
errorMessage_1="姓名不能为空";
}
else
{
errorMessage_1="";
}
objSpanName.innerHTML=errorMessage_1;
if(gender1!="1"||gender1!="2")
{
errorMessage_2="请选择性别";
}
else
{
errorMessage_2="";
}
objgender.innerHTML=errorMessage_2;
if(city1!="dy")
{
errorMessage_3="请选择德阳";
}
else
{
errorMessage_3="";
}
objcity.innerHTML=errorMessage_3;
if(history1!="icd_01"&&history1!="icd_02"&&history1!="icd_03")
{
errorMessage_4="请选择至少一项疾病";
}
else
{
errorMessage_4="";
}
objhistory.innerHTML=errorMessage_4;
}
</script>
<html>
```

17
acl_list.php Normal file
View File

@ -0,0 +1,17 @@
<?php
// 定义 ACL 表
$acl = array(
"cto" => array("p_1.php", "p_2.php", "p_3.php"),
"manager" => array("p_2.php", "p_3.php"),
"staff" => array("p_3.php")
);
// 定义检查权限的函数
function checkAccess($role, $resource) {
global $acl;
if (isset($acl[$role]) && in_array($resource, $acl[$role])) {
return true; // 有权限
}
return false; // 无权限
}

38
api_183_1.php Normal file
View File

@ -0,0 +1,38 @@
<?php
// 获取参数
$student_id = $_GET['student_id'] ?? null;
$english = $_GET['english'] ?? null;
$math = $_GET['math'] ?? null;
$computer = $_GET['computer'] ?? null;
// 校验参数是否完整
if ($student_id === null || $english === null || $math === null || $computer === null) {
// 返回错误信息
echo json_encode([
"error" => "Missing required parameters: student_id, english, math, computer"
]);
exit;
}
// 验证分数是否为数字
if (!is_numeric($english) || !is_numeric($math) || !is_numeric($computer)) {
// 返回错误信息
echo json_encode([
"error" => "Parameters english, math, and computer must be numeric"
]);
exit;
}
// 计算总分
$sum = $english + $math + $computer;
// 封装为 JSON 格式
$response = [
"student_id" => $student_id,
"sum" => (string)$sum // 转为字符串以匹配返回格式
];
// 输出 JSON
header('Content-Type: application/json');
echo json_encode($response);
?>

38
api_183_2.php Normal file
View File

@ -0,0 +1,38 @@
<?php
// 获取参数
$student_id = $_GET['student_id'] ?? null;
$english = $_GET['english'] ?? null;
$math = $_GET['math'] ?? null;
$computer = $_GET['computer'] ?? null;
// 校验参数是否完整
if ($student_id === null || $english === null || $math === null || $computer === null) {
// 返回错误信息
echo json_encode([
"error" => "Missing required parameters: student_id, english, math, computer"
]);
exit;
}
// 验证分数是否为数字
if (!is_numeric($english) || !is_numeric($math) || !is_numeric($computer)) {
// 返回错误信息
echo json_encode([
"error" => "Parameters english, math, and computer must be numeric"
]);
exit;
}
// 计算最高分
$max = max($english, $math, $computer);
// 封装为 JSON 格式
$response = [
"student_id" => $student_id,
"max" => (string)$max // 转为字符串以匹配返回格式
];
// 输出 JSON
header('Content-Type: application/json');
echo json_encode($response);
?>

36
bmi_631_1.php Normal file
View File

@ -0,0 +1,36 @@
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$height = $_POST['height'];
$weight = $_POST['weight'];
if ($height!= "" && $weight!= "") {
$bmi = $weight / ($height * $height);
if ($bmi >= 18.50 && $bmi <= 23.90) {
$result = "BMI指数正常";
} else {
$result = "BMI指数异常";
}
} else {
$result = "请输入完整的身高和体重信息";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>BMI健康指标计算器</title>
</head>
<body>
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
身高(米): <input type="text" id="height" name="height" placeholder="请输入身高"><br>
体重(千克): <input type="text" id="weight" name="weight" placeholder="请输入体重"><br>
<input type="submit" id="ok" name="ok" value="确定">
</form>
<?php if (isset($result)) {?>
<p><?php echo $result;?></p>
<?php }?>
</body>
</html>

6
bootstrap.min.css vendored Normal file

File diff suppressed because one or more lines are too long

7
bootstrap.min.js vendored Normal file

File diff suppressed because one or more lines are too long

102
create_tables.php Normal file
View File

@ -0,0 +1,102 @@
<?php
include_once "db_config.php";
// 创建数据库连接
$conn = $link;
// 检查连接是否成功
if ($conn->connect_error) {
die("数据库连接失败: " . $conn->connect_error);
}
// 设置字符集
$conn->set_charset("utf8");
// 创建患者表
$sql_patient = "
CREATE TABLE IF NOT EXISTS patient_90 (
patient_id CHAR(50),
patient_name CHAR(50),
patient_gender CHAR(1),
patient_address CHAR(50)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
";
if ($conn->query($sql_patient) === TRUE) {
echo "患者表创建成功!<br>";
} else {
echo "创建患者表失败: " . $conn->error . "<br>";
}
// 创建医生表
$sql_doctor = "
CREATE TABLE IF NOT EXISTS doctor_90 (
doctor_id CHAR(50),
doctor_name CHAR(50),
doctor_gender CHAR(1),
department_id CHAR(50)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
";
if ($conn->query($sql_doctor) === TRUE) {
echo "医生表创建成功!<br>";
} else {
echo "创建医生表失败: " . $conn->error . "<br>";
}
// 创建科室表
$sql_department = "
CREATE TABLE IF NOT EXISTS department_90 (
department_id CHAR(50),
department_name CHAR(50),
department_location CHAR(50)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
";
if ($conn->query($sql_department) === TRUE) {
echo "科室表创建成功!<br>";
} else {
echo "创建科室表失败: " . $conn->error . "<br>";
}
// 创建挂号表
$sql_register = "
CREATE TABLE IF NOT EXISTS register_90 (
biz_id CHAR(50),
doctor_id CHAR(50),
patient_id CHAR(50),
register_date INT,
fee INT,
state CHAR(1)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
";
if ($conn->query($sql_register) === TRUE) {
echo "挂号表创建成功!<br>";
} else {
echo "创建挂号表失败: " . $conn->error . "<br>";
}
// 插入测试数据
$sql_insert = "
INSERT IGNORE INTO patient_90 (patient_id, patient_name, patient_gender, patient_address) VALUES
('510103001', '张三', '1', '成都'),
('510103002', '李四', '2', '重庆');
INSERT IGNORE INTO doctor_90 (doctor_id, doctor_name, doctor_gender, department_id) VALUES
('510105001', '王医生', '2', '001'),
('510105002', '罗医生', '1', '002'),
('510105003', '陈医生', '1', '001');
INSERT IGNORE INTO department_90 (department_id, department_name, department_location) VALUES
('001', '内科', '1楼2诊室'),
('002', '外科', '1楼5诊室');
";
if ($conn->multi_query($sql_insert) === TRUE) {
echo "测试数据插入成功!<br>";
} else {
echo "插入测试数据失败: " . $conn->error . "<br>";
}
// 关闭数据库连接
$conn->close();
?>

8
db_config.php Normal file
View File

@ -0,0 +1,8 @@
<?php
$link=mysqli_connect('localhost','user_20250109_58053','fFPALeYRQxo32lB','exam_20250109_58053');
mysqli_query($link,'set names utf8');
// 设置默认时区
date_default_timezone_set("Asia/Shanghai");

43
form_test_2.php Normal file
View File

@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>表单编程与现场恢复</title>
</head>
<body>
<?php
// 定义变量用于回显数据
$name = "";
$password_md5 = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// 获取提交的姓名和密码
$name = isset($_POST['name']) ? htmlspecialchars($_POST['name']) : "";
$password = isset($_POST['password']) ? $_POST['password'] : "";
// 使用 MD5 对密码进行加密
$password_md5 = md5($password);
}
?>
<!-- 表单 -->
<form action="form_test_2.php" method="post">
<label for="name">姓名:</label>
<input type="text" id="name" name="name" value="<?php echo $name; ?>">
<br><br>
<label for="password">密码:</label>
<input type="password" id="password" name="password" value="">
<br><br>
<input type="submit" id="ok" name="ok" value="提交">
</form>
<!-- 输出提交结果 -->
<?php if ($_SERVER["REQUEST_METHOD"] == "POST"): ?>
<h3>提交结果:</h3>
<p>姓名:<?php echo $name; ?></p>
<p>处理后的密码:<?php echo $password_md5; ?></p>
<?php endif; ?>
</body>
</html>

79
form_test_74_2.php Normal file
View File

@ -0,0 +1,79 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>表单提交与现场恢复</title>
</head>
<body>
<?php
// 定义变量,用于回显用户输入的数据
$name = "";
$gender = "";
$courses = [];
$hometown = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// 获取表单数据
$name = isset($_POST['name']) ? htmlspecialchars($_POST['name']) : "";
$gender = isset($_POST['gender']) ? $_POST['gender'] : "";
$courses = isset($_POST['course']) ? $_POST['course'] : [];
$hometown = isset($_POST['hometown']) ? $_POST['hometown'] : "";
}
?>
<!-- 表单 -->
<form action="form_test_74_2.php" method="post">
<!-- 姓名 -->
<label for="name">姓名:</label>
<input type="text" id="name" name="name" value="<?php echo $name; ?>">
<br><br>
<!-- 性别 -->
性别:
<input type="radio" id="male" name="gender" value="1" <?php echo ($gender == "1") ? "checked" : ""; ?>>
<label for="male">男</label>
<input type="radio" id="female" name="gender" value="2" <?php echo ($gender == "2") ? "checked" : ""; ?>>
<label for="female">女</label>
<br><br>
<!-- 选课 -->
选课:
<input type="checkbox" id="computer" name="course[]" value="computer" <?php echo in_array("computer", $courses) ? "checked" : ""; ?>>
<label for="computer">计算机</label>
<input type="checkbox" id="math" name="course[]" value="math" <?php echo in_array("math", $courses) ? "checked" : ""; ?>>
<label for="math">数学</label>
<input type="checkbox" id="english" name="course[]" value="english" <?php echo in_array("english", $courses) ? "checked" : ""; ?>>
<label for="english">英语</label>
<br><br>
<!-- 籍贯 -->
籍贯:
<select id="hometown" name="hometown">
<option value="beijing" <?php echo ($hometown == "beijing") ? "selected" : ""; ?>>北京</option>
<option value="chengdu" <?php echo ($hometown == "chengdu") ? "selected" : ""; ?>>成都</option>
<option value="chongqing" <?php echo ($hometown == "chongqing") ? "selected" : ""; ?>>重庆</option>
</select>
<br><br>
<!-- 提交按钮 -->
<input type="submit" id="ok" name="ok" value="提交">
</form>
<!-- 输出提交结果 -->
<?php if ($_SERVER["REQUEST_METHOD"] == "POST"): ?>
<h3>提交结果:</h3>
<p>姓名:<?php echo $name; ?></p>
<p>性别:<?php echo ($gender == "1") ? "男" : (($gender == "2") ? "女" : "未选择"); ?></p>
<p>选课:
<?php
if (!empty($courses)) {
echo implode("", $courses);
} else {
echo "未选择";
}
?>
</p>
<p>籍贯:<?php echo !empty($hometown) ? $hometown : "未选择"; ?></p>
<?php endif; ?>
</body>
</html>

20
img_code_1.php Normal file
View File

@ -0,0 +1,20 @@
<?php
//GD
//phpinfo();
//登录验证码
session_start();
header("Content-type: image/png; charset=utf-8");
//创建一个图片
$image = imagecreate(120,30);
//定义背景颜色
$black = imagecolorallocate($image,0, 0, 0);//reb 000代表黑
//定义前景颜色
$white = imagecolorallocate($image,255, 255, 255);
imagefill($image, 0, 0, $black );//向图片中填充背景
$string = $_GET['img_code'];
//把文字写到图片中
imagestring( $image, 5, 10, 8, $string, $white);
//生成png格式图形
imagepng( $image );

5
jquery.min.js vendored Normal file

File diff suppressed because one or more lines are too long

97
list_72.php Normal file
View File

@ -0,0 +1,97 @@
<?php
require_once "db_config.php"; // 引入数据库配置文件
$conn = $link;
// 每页显示的记录数
$limit = 10;
// 获取当前的action和offset参数
$action = isset($_GET['action']) ? $_GET['action'] : 'top';
$offset = isset($_GET['offset']) ? intval($_GET['offset']) : 0;
// 获取总记录数
$sql_count = "SELECT COUNT(*) AS total FROM user_70";
$result_count = $conn->query($sql_count);
$total_records = $result_count->fetch_assoc()['total'];
// 计算总页数
$total_pages = ceil($total_records / $limit);
// 根据action计算新的offset
switch ($action) {
case 'top':
$offset = 0;
break;
case 'previous':
$offset = max(0, $offset - $limit);
break;
case 'next':
$offset = min($total_records - $limit, $offset + $limit);
break;
case 'bottom':
$offset = max(0, ($total_pages - 1) * $limit);
break;
default:
$offset = 0;
break;
}
// 查询当前页的数据
$sql = "SELECT name FROM user_70 LIMIT $offset, $limit";
$result = $conn->query($sql);
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>姓名列表</title>
<style>
table {
width: 300px;
border-collapse: collapse;
margin: 20px auto;
}
th, td {
border: 1px solid #000;
text-align: center;
padding: 8px;
}
a {
margin: 0 5px;
text-decoration: none;
color: blue;
}
a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<table>
<tr>
<th>姓名列表</th>
</tr>
<?php
// 输出数据
if ($result->num_rows > 0) {
$index = $offset + 1; // 起始序号
while ($row = $result->fetch_assoc()) {
echo "<tr><td>{$index}. {$row['name']}</td></tr>";
$index++;
}
} else {
echo "<tr><td>没有数据</td></tr>";
}
?>
<tr>
<td>
<a href="list_72.php?action=top&offset=0">首页</a>
<a href="list_72.php?action=previous&offset=<?php echo $offset; ?>">上一页</a>
<a href="list_72.php?action=next&offset=<?php echo $offset; ?>">下一页</a>
<a href="list_72.php?action=bottom&offset=<?php echo ($total_pages - 1) * $limit; ?>">末页</a>
</td>
</tr>
</table>
</body>
</html>

80
list_72_1_e.php Normal file
View File

@ -0,0 +1,80 @@
<meta charset="UTF-8">
<?php
//数据列表 带编辑,新增与删除操作
//引入数据库配置文件
/*
* select * from student_1 limit 0,10
* select * from student_1 limit 10,10
*
*/
require_once "db_config.php";
mysqli_set_charset($link, 'utf8');
//取总记录数
$queryString="select count(name) as maxRows from user_70";
$rs=mysqli_query($link,$queryString);
$row=mysqli_fetch_assoc($rs);
$maxRows=$row['maxRows'];
$rowsOfPage = $_GET['rows_of_page'] ?? 15;
if(isset($_GET['action'])){
//翻页进入
if($_GET['action']=="top"){
$offset=0;
}
if($_GET['action']=="pre"){
$offset=$_GET['offset']-$rowsOfPage;
if($offset<0){
$offset=0;
}
}
if($_GET['action']=="next"){
$offset=$_GET['offset']+$rowsOfPage;
//处理最后一页的计算逻辑
if($offset>=$maxRows){
$offset=$_GET['offset'];
}
}
if($_GET['action']=='bottom'){
if($maxRows%$rowsOfPage==0){
//整页
$offset=$maxRows-$rowsOfPage;
}else{
//非整页
$offset=$maxRows-$maxRows%$rowsOfPage;
//20 10 20-10 25-25%10 20
}
}
}else{
//第一次进入偏移量为0
$offset=0;
}
$queryString="select * from user_70 limit $offset,$rowsOfPage";
$rs=mysqli_query($link,$queryString);
//用循环语句,从数据集中读出每一条记录
echo "<table border='1'>";
//id,name,password,gender,birthday,course,hometown,resume
echo "<tr><td colspan='10'>姓名列表</td>";
$pattern = '/(\d+)/';
while ($row=mysqli_fetch_assoc($rs)){
preg_match_all($pattern, $row['name'], $matches);
echo "<tr>";
echo "<td>".($matches[0][0]+1)."</td>";
echo "<td>".$row['name']."</td>";
}
echo "<tr><td colspan='10'>
<a href='list_72_1_e.php?action=top&offset=$offset&rows_of_page=$rowsOfPage'>首页</a>
|
<a href='list_72_1_e.php?action=pre&offset=$offset&rows_of_page=$rowsOfPage'>上一页</a>
|
<a href='list_72_1_e.php?action=next&offset=$offset&rows_of_page=$rowsOfPage'>下一页</a>
|
<a href='list_72_1_e.php?action=bottom&offset=$offset&rows_of_page=$rowsOfPage'>末页</a>
</td></tr>";
echo "</table>";

52
login.php Normal file
View File

@ -0,0 +1,52 @@
<?php
session_start(); // 启用 Session
require_once "db_config.php"; // 引入数据库配置
$conn = $link;
// 检查是否提交表单
if ($_SERVER["REQUEST_METHOD"] === "POST") {
$name = isset($_POST['name']) ? trim($_POST['name']) : '';
$password = isset($_POST['password']) ? trim($_POST['password']) : '';
if (empty($name) || empty($password)) {
echo "姓名和密码不能为空!";
} else {
// 将密码转换为 MD5 格式
$hashedPassword = md5($password);
// 查询用户信息
$sql = "SELECT * FROM user_70 WHERE name = ? AND password = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("ss", $name, $hashedPassword);
$stmt->execute();
$result = $stmt->get_result();
if ($result->num_rows > 0) {
// 登录成功,设置 Session
$_SESSION['s_name'] = $name;
header("Location: user_info.php"); // 跳转到 user_info.php
exit();
} else {
// 登录失败
echo "用户名或密码错误!";
}
}
}
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>用户登录</title>
</head>
<body>
<form method="POST" action="login.php">
<label for="name">姓名:</label>
<input type="text" id="name" name="name"><br>
<label for="password">密码:</label>
<input type="password" id="password" name="password"><br>
<button type="submit" id="ok" name="ok">提交</button>
</form>
</body>
</html>

3
my_first_program.php Normal file
View File

@ -0,0 +1,3 @@
<?php
include_once "db_config.php";
var_dump($link);

14
p_1.php Normal file
View File

@ -0,0 +1,14 @@
<?php
// 引入 ACL 文件
include 'acl_list.php';
// 获取角色参数
$role = $_GET['role'] ?? null;
// 检查权限
if ($role && checkAccess($role, 'p_1.php')) {
echo "欢迎光临";
} else {
echo "无权访问";
}
?>

9
p_2.php Normal file
View File

@ -0,0 +1,9 @@
<?php
include 'acl_list.php';
$role = $_GET['role'] ?? null;
if ($role && checkAccess($role, 'p_2.php')) {
echo "欢迎光临";
} else {
echo "无权访问";
}
?>

8
p_3.php Normal file
View File

@ -0,0 +1,8 @@
<?php
include 'acl_list.php';
$role = $_GET['role'] ?? null;
if ($role && checkAccess($role, 'p_3.php')) {
echo "欢迎光临";
} else {
echo "无权访问";
}

72
patient_90.php Normal file
View File

@ -0,0 +1,72 @@
<?php
require 'db_config.php';
$conn = $link;
mysqli_set_charset($link, 'utf8');
// 初始化变量
$patient_id = $patient_name = $patient_gender = $patient_address = "";
// 检查表单提交
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$patient_id = ($_POST['patient_id']);
$patient_name = ($_POST['patient_name']);
$patient_gender = ($_POST['patient_gender']);
$patient_address = ($_POST['patient_address']);
// 保存数据
try {
// 检查是否存在该患者
$query = "SELECT COUNT(*) AS count FROM patient_90 WHERE patient_id = '$patient_id'";
$result = mysqli_query($conn, $query);
$row = mysqli_fetch_assoc($result);
if ($row['count'] > 0) {
// 更新记录
$update_query = "UPDATE patient_90 SET
patient_name = '$patient_name',
patient_gender = '$patient_gender',
patient_address = '$patient_address'
WHERE patient_id = '$patient_id'";
mysqli_query($conn, $update_query);
} else {
// 插入新记录
$insert_query = "INSERT INTO patient_90
(patient_id, patient_name, patient_gender, patient_address)
VALUES
('$patient_id', '$patient_name', '$patient_gender', '$patient_address')";
mysqli_query($conn, $insert_query);
}
} catch (Exception $e) {
die("数据保存失败: " . $e->getMessage());
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>患者建档</title>
</head>
<body>
<h1>患者建档</h1>
<form action="patient_90.php" method="post">
<label for="patient_name">姓名:</label>
<input type="text" id="patient_name" name="patient_name" value=""><br>
<label for="patient_id">身份证:</label>
<input type="text" id="patient_id" name="patient_id" value=""><br>
<label>性别:</label>
<input type="radio" id="male" name="patient_gender" value="1" <?= $patient_gender === '1' ? 'checked' : '' ?>>
<label for="male">男</label>
<input type="radio" id="female" name="patient_gender" value="2" <?= $patient_gender === '2' ? 'checked' : '' ?>>
<label for="female">女</label><br>
<label for="patient_address">家庭住址:</label>
<input type="text" id="patient_address" name="patient_address" value=""><br>
<input type="submit" id="ok" name="ok" value="ok">
</form>
</body>
</html>

114
patient_register_90.php Normal file
View File

@ -0,0 +1,114 @@
<?php
include "db_config.php";
date_default_timezone_set("Asia/Shanghai");
$conn = $link;
// 生成UUID函数
function generateUUID() {
return bin2hex(random_bytes(16));
}
// 初始化变量
$patient_id = $doctor_id = $fee = "";
$register_date = date("Y-m-d");
$message = "";
// 提交表单处理
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$patient_id = $_POST["patient_id"];
$doctor_id = $_POST["doctor_id"];
$fee = empty($_POST["fee"]) ? 10 : (int)$_POST["fee"]; // 默认挂号费为10元
$current_date = strtotime($register_date);
// 检查同一患者当天是否已挂号
$sql_check = "SELECT * FROM register_90 WHERE patient_id = '$patient_id' AND register_date = $current_date";
$result_check = $conn->query($sql_check);
if ($result_check->num_rows > 0) {
// 更新挂号信息
$sql_update = "UPDATE register_90 SET doctor_id = '$doctor_id', fee = $fee, state = '1' WHERE patient_id = '$patient_id' AND register_date = $current_date";
if ($conn->query($sql_update)) {
$message = "挂号信息已更新!";
} else {
$message = "更新失败: " . $conn->error;
}
} else {
// 插入新挂号记录
$biz_id = generateUUID();
$sql_insert = "INSERT INTO register_90 (biz_id, doctor_id, patient_id, register_date, fee, state) VALUES ('$biz_id', '$doctor_id', '$patient_id', $current_date, $fee, '1')";
if ($conn->query($sql_insert)) {
$message = "挂号成功!";
} else {
$message = "挂号失败: " . $conn->error;
}
}
}
// 获取患者列表
$sql_patients = "SELECT patient_id, patient_name FROM patient_90";
$result_patients = $conn->query($sql_patients);
// 获取医生和科室列表
$sql_doctors = "
SELECT doctor_90.doctor_id, doctor_90.doctor_name, department_90.department_name
FROM doctor_90
JOIN department_90 ON doctor_90.department_id = department_90.department_id";
$result_doctors = $conn->query($sql_doctors);
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>患者挂号</title>
</head>
<body>
<h2>患者挂号</h2>
<form action="patient_register_90.php" method="post">
<!-- 患者选择 -->
<label for="patient_id">选择患者:</label>
<select id="patient_id" name="patient_id">
<?php if ($result_patients->num_rows > 0): ?>
<?php while ($row = $result_patients->fetch_assoc()) { ?>
<option value="<?php echo $row['patient_id']; ?>" <?php echo ($patient_id == $row['patient_id']) ? "selected" : ""; ?>>
<?php echo $row['patient_name']; ?>
</option>
<?php } ?>
<?php else: ?>
<option value="">暂无患者数据</option>
<?php endif; ?>
</select>
<br><br>
<!-- 医生选择 -->
<label for="doctor_id">选择医生:</label>
<select id="doctor_id" name="doctor_id">
<?php if ($result_doctors->num_rows > 0): ?>
<?php while ($row = $result_doctors->fetch_assoc()) { ?>
<option value="<?php echo $row['doctor_id']; ?>" <?php echo ($doctor_id == $row['doctor_id']) ? "selected" : ""; ?>>
<?php echo $row['doctor_name'] . "|" . $row['department_name']; ?>
</option>
<?php } ?>
<?php else: ?>
<option value="">暂无医生数据</option>
<?php endif; ?>
</select>
<br><br>
<!-- 挂号时间 -->
<label for="register_date">挂号时间:</label>
<input type="text" id="register_date" name="register_date" value="<?php echo $register_date; ?>" readonly>
<br><br>
<!-- 挂号费 -->
<label for="fee">挂号费:</label>
<input type="text" id="fee" name="fee" value="<?php echo $fee; ?>">
<br><br>
<!-- 提交按钮 -->
<input type="submit" id="ok" name="ok" value="确定">
</form>
<p><?php echo $message; ?></p>
</body>
</html>

View File

@ -0,0 +1,107 @@
<?php
include "db_config.php";
date_default_timezone_set("Asia/Shanghai");
$conn = $link;
// 初始化变量
$search_field = isset($_POST["search_field"]) ? $_POST["search_field"] : "doctor";
$search_value = isset($_POST["search_value"]) ? $_POST["search_value"] : "";
$message = "";
// 查询挂号信息
$sql_query = "
SELECT
department_90.department_name,
doctor_90.doctor_name,
patient_90.patient_name,
FROM_UNIXTIME(register_90.register_date, '%Y-%m-%d') AS register_date,
register_90.fee,
register_90.biz_id
FROM register_90
JOIN doctor_90 ON register_90.doctor_id = doctor_90.doctor_id
JOIN department_90 ON doctor_90.department_id = department_90.department_id
JOIN patient_90 ON register_90.patient_id = patient_90.patient_id";
if ($_SERVER["REQUEST_METHOD"] == "POST" && !empty($search_value)) {
if ($search_field == "doctor") {
$sql_query .= " WHERE doctor_90.doctor_name LIKE '%$search_value%'";
} elseif ($search_field == "patient") {
$sql_query .= " WHERE patient_90.patient_name LIKE '%$search_value%'";
}
}
$result = $conn->query($sql_query);
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>患者挂号列表</title>
<style>
table {
border-collapse: collapse;
width: 100%;
}
th, td {
border: 1px solid #ddd;
padding: 8px;
}
th {
background-color: #f2f2f2;
}
tr:hover {
background-color: #f5f5f5;
}
</style>
</head>
<body>
<h2>患者挂号列表</h2>
<form action="patient_register_list_90.php" method="post">
<label for="search_field">查询条件:</label>
<select id="search_field" name="search_field">
<option value="doctor" <?php echo ($search_field == "doctor") ? "selected" : ""; ?>>医生</option>
<option value="patient" <?php echo ($search_field == "patient") ? "selected" : ""; ?>>患者</option>
</select>
=
<input type="text" id="search_value" name="search_value" value="<?php echo htmlspecialchars($search_value); ?>">
<input type="submit" id="ok" name="ok" value="确定">
</form>
<hr>
<table>
<thead>
<tr>
<th>科室</th>
<th>医生</th>
<th>患者</th>
<th>就诊时间</th>
<th>挂号费</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php if ($result && $result->num_rows > 0): ?>
<?php while ($row = $result->fetch_assoc()) { ?>
<tr>
<td><?php echo $row["department_name"]; ?></td>
<td><?php echo $row["doctor_name"]; ?></td>
<td><?php echo $row["patient_name"]; ?></td>
<td><?php echo $row["register_date"]; ?></td>
<td><?php echo $row["fee"]; ?></td>
<td>
<a href="edit_register_90.php?biz_id=<?php echo $row['biz_id']; ?>">编辑</a>
|
<a href="delete_register_90.php?biz_id=<?php echo $row['biz_id']; ?>" onclick="return confirm('确定要删除此记录吗?');">删除</a>
</td>
</tr>
<?php } ?>
<?php else: ?>
<tr>
<td colspan="6" style="text-align: center;">暂无数据</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</body>
</html>

6
program_85.php Normal file
View File

@ -0,0 +1,6 @@
<?php
$str = $_GET['string'];
function mySwap($string){
return $string[strlen($string)-1].substr($string,1,strlen($string)-2).$string[0];
}
echo mySwap($str);

View File

@ -0,0 +1 @@
VPS server address : 125.64.9.222<br>VPS server port : 58023<br>VPS FTP user name : user_20250103_58023<br>VPS FTP user pass : BlxFQtLkKWQm57R<br>VPS FTP port : 21<br>VPS database name : exam_20250103_58023<br>VPS database user name : user_20250103_58023<br>VPS database pass : BlxFQtLkKWQm57R<br><br>VPS spring boot port : 58323<br>

73
register.php Normal file
View File

@ -0,0 +1,73 @@
<?php
include_once "db_config.php";
$conn = $link;
// 检查连接
if ($conn->connect_error) {
die("连接失败: " . $conn->connect_error);
}
// 检查是否提交表单
if ($_SERVER["REQUEST_METHOD"] === "POST") {
$name = isset($_POST['name']) ? trim($_POST['name']) : '';
$password = isset($_POST['password']) ? trim($_POST['password']) : '';
// 表单验证
if (empty($name) || empty($password)) {
echo "姓名和密码不能为空!";
} else {
// 密码加密
$hashedPassword = md5($password);
// 查询是否存在该用户
$sql = "SELECT * FROM user_70 WHERE name = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("s", $name);
$stmt->execute();
$result = $stmt->get_result();
if ($result->num_rows > 0) {
// 用户存在,更新密码
$updateSql = "UPDATE user_70 SET password = ? WHERE name = ?";
$updateStmt = $conn->prepare($updateSql);
$updateStmt->bind_param("ss", $hashedPassword, $name);
if ($updateStmt->execute()) {
echo "密码更新成功!";
} else {
echo "密码更新失败:" . $conn->error;
}
} else {
// 用户不存在,插入新用户
$insertSql = "INSERT INTO user_70 (name, password) VALUES (?, ?)";
$insertStmt = $conn->prepare($insertSql);
$insertStmt->bind_param("ss", $name, $hashedPassword);
if ($insertStmt->execute()) {
echo "注册成功!";
} else {
echo "注册失败:" . $conn->error;
}
}
}
}
// 关闭数据库连接
$conn->close();
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>用户注册与修改密码</title>
</head>
<body>
<form method="POST" action="register.php">
<label for="name">姓名:</label>
<input type="text" id="name" name="name"><br>
<label for="password">密码:</label>
<input type="password" id="password" name="password"><br>
<button type="submit" id="ok" name="ok" value="ok">提交</button>
</form>
</body>
</html>

5
robot_251_1.php Normal file
View File

@ -0,0 +1,5 @@
<?php
$content = file_get_contents("http://localhost:8022/goods/flash_sale.php");
$pattern = '/\d+(?=元)/';
preg_match_all($pattern, $content, $matches);
echo "[".$matches[0][0]."]";

42
search_73.php Normal file
View File

@ -0,0 +1,42 @@
<?php
require_once "db_config.php"; // 引入数据库配置
$conn = $link;
// 判断是否有表单提交过来的数据
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$search_name = $_POST['search_name'];
// 编写SQL查询语句从user_70表中根据姓名查找对应的地址信息
$sql = "SELECT address FROM user_70 WHERE name = '$search_name'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// 如果查询到数据,输出对应的地址
while ($row = $result->fetch_assoc()) {
echo $row["address"];
}
} else {
// 如果没有查询到数据,输出提示信息
echo "查无此人";
}
}
// 关闭数据库连接
$conn->close();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>姓名查询</title>
</head>
<body>
<!-- 创建form表单用于输入姓名进行查询 -->
<form action="search_73.php" method="post">
<label for="sName">姓名:</label>
<input type="text" id="sName" name="sName">
<input type="submit" id="ok" name="ok" value="确定">
</form>
</body>
</html>

68
search_73_1_e.php Normal file
View File

@ -0,0 +1,68 @@
<?php
// 处理表单提交的 POST 请求
if ($_SERVER["REQUEST_METHOD"] === "POST") {
// 数据库配置
$host = "localhost";
$dbname = "exam_20250109_58053";
$dbuser = "user_20250109_58053";
$dbpass = "fFPALeYRQxo32lB";
// 接收表单数据
$sName = trim($_POST["sName"]);
$sAddress = trim($_POST["sAddress"]);
$sLogic = $_POST["sLogic"];
// 创建数据库连接
$conn = new mysqli($host, $dbuser, $dbpass, $dbname);
if ($conn->connect_error) {
die("数据库连接失败: " . $conn->connect_error);
}
// 动态构建 SQL 查询语句
$conditions = [];
if (!empty($sName)) {
$conditions[] = "name LIKE '%" . $conn->real_escape_string($sName) . "%'";
}
if (!empty($sAddress)) {
$conditions[] = "address LIKE '%" . $conn->real_escape_string($sAddress) . "%'";
}
$query = "SELECT * FROM user_70";
if (count($conditions) > 0) {
$query .= " WHERE " . implode(" $sLogic ", $conditions);
}
// 执行查询
$result = $conn->query($query);
if ($result) {
$rowCount = $result->num_rows;
echo "[[$rowCount]]"; // 输出符合条件的记录数
} else {
echo "[[0]]"; // 查询失败
}
// 关闭连接
$conn->close();
} else {
// 显示查询表单
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>多条件组合查询</title>
</head>
<body>
<form action="search_73_1_e.php" method="POST">
<label for="sName">姓名:</label>
<input type="text" id="sName" name="sName"><br>
<label for="sAddress">地址:</label>
<input type="text" id="sAddress" name="sAddress"><br>
<label>连接条件:</label>
<input type="radio" id="and" name="sLogic" value="and" checked> AND
<input type="radio" id="or" name="sLogic" value="or"> OR<br>
<button type="submit" id="ok" name="ok" value="ok">确定</button>
</form>
</body>
</html>
<?php
}

56
setup.html Normal file
View File

@ -0,0 +1,56 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>操作表</title>
<link href="./bootstrap.min.css" rel="stylesheet">
<script src="./jquery.min.js"></script>
<script src="./bootstrap.min.js"></script>
<script>
// 确保在文档加载完成后执行
$(document).ready(function(operation, table) {
function query(operation, table) {
$.ajax({
url: "/setup.php",
type: "POST",
data: {
operation: operation,
table: table
}
}).done((res) => {
console.log(res)
// 检查并使用返回的JSON数据
$("#result").html(res);
}).fail((jqXHR, textStatus, errorThrown) => {
$('#result').html('Request failed: ' + textStatus);
});
}
// 按钮点击事件绑定
$('button').click(function() {
const operation = $(this).attr('data-operation');
const table = $('#mySelect').val()
query(operation, table);
});
});
</script>
</head>
<body>
<h1 class="text-center mb-4 mt-3">操作表</h1>
<div class="container-sm mt-4 w-75 border border-2 p-4 rounded-3">
<div class="d-flex h-100 ">
<button data-operation="del" class="btn btn-danger m-2">drop table</button>
<button data-operation="create" class="btn btn-success m-2">create table</button>
<button data-operation="select" class="btn btn-primary m-2">select table</button>
<select id="mySelect" class="form-select m-2 " aria-label="Select table">
<option value="user_70" selected>user_70</option>
<option value="nucleic_acid_test_2">nucleic_acid_test_2</option>
<option value="patient_90">patient_90</option>
</select>
<button class="btn btn-secondary m-2" onclick="location.reload();">refresh</button>
</div>
<div class="m-4" id="result" style="margin-top:15px; margin-left: 20px; margin-right: 100px; padding: 50px">
</div>
</div>
</body>
</html>

118
setup.php Normal file
View File

@ -0,0 +1,118 @@
<?php
session_start();
include_once("db_config.php");
mysqli_set_charset($link, 'utf8');
$table = '';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$operation = $_POST['operation'];
$table = $_POST['table'];
if ($operation == 'del') {
drop_table($link, $table);
} else if ($operation == 'create') {
create_table($link, $table);
} else {
select_table($link, $table);
}
}
function drop_table($link, $table){
$query_string = "drop table if exists $table";
mysqli_query($link,$query_string);
echo "表删除成功";
}
function create_table($link, $table){
$result = mysqli_query($link,"show tables like '$table' ");
if ($result && mysqli_num_rows($result) > 0) {
$tableExist = true;
}else{
$tableExist = false;
}
if(!$tableExist){
if($table == 'user_70'){
$query_string = "create table user_70(name char(50),address char(50),password char(50))ENGINE=MyISAM DEFAULT CHARSET=utf8";
mysqli_query($link,$query_string);
$query_string = "insert into user_70(name,address,password)values('mike','chengdu','c4ca4238a0b923820dcc509a6f75849b')";
mysqli_query($link,$query_string);
$query_string = "insert into user_70(name,address,password)values('mike','beijing','c4ca4238a0b923820dcc509a6f75849b')";
mysqli_query($link,$query_string);
$query_string = "insert into user_70(name,address,password)values('tom','chengdu','c4ca4238a0b923820dcc509a6f75849b')";
mysqli_query($link,$query_string);
$query_string = "insert into user_70(name,address,password)values('rose','chengdu','c4ca4238a0b923820dcc509a6f75849b')";
mysqli_query($link,$query_string);
}
else if($table == 'nucleic_acid_test_2'){
$eventTime=mktime(12,12,12,12,12,2022);
$query_string = "create table nucleic_acid_test_2(id varchar(50),name varchar(50),address varchar(50),event_time int,insert_time int,code varchar(1))ENGINE=MyISAM DEFAULT CHARSET=utf8";
mysqli_query($link,$query_string);
$query_string = "insert into nucleic_acid_test_2(id,name,address,event_time,insert_time,code)values('510103199010210012','mike','shanghai',$eventTime,'1597238637','3')";
mysqli_query($link,$query_string);
$query_string ="insert into nucleic_acid_test_2(id,name,address,event_time,insert_time,code)values('510103198310607013','rose','beijing',$eventTime,'1597242237','2')";
mysqli_query($link,$query_string);
}else if($table == 'patient_90'){
$query_string = "create table patient_90(patient_id char(50),patient_name char(50),patient_gender char(1),patient_address char(50))ENGINE=MyISAM DEFAULT CHARSET=utf8";
mysqli_query($link,$query_string);
$query_string = "insert into patient_90 values('123456','王某','1','1')";
mysqli_query($link,$query_string);
}
select_table($link, $table);
}else{
echo "表已存在";
}
}
function select_table($link, $table){
$result = mysqli_query($link,"show tables like '$table'");
var_dump($result);
echo "<br>";
if ($result && mysqli_num_rows($result) > 0) {
$tableExist = true;
}else{
$tableExist = false;
}
if($tableExist){
if($table == 'user_70'){
$query_string = "select * from user_70";
$result = mysqli_query($link,$query_string);
echo "<div style='font-weight: bold;font-size: 18px;color: red; border-bottom: 1px solid #ccc;padding: 10px'>";
var_dump($result);
echo "</div><br>";
while($row = mysqli_fetch_array($result)){
echo $row['name']."<br>";
echo $row['address']."<br>";
echo $row['password']."<br>";
echo "<br>";
}
}
else if($table == 'nucleic_acid_test_2'){
$query_string = "select * from nucleic_acid_test_2";
$result = mysqli_query($link,$query_string);
echo "<div style='font-weight: bold;font-size: 18px;color: red; border-bottom: 1px solid #ccc;padding: 10px'>";
var_dump($result);
echo "</div><br>";
while($row = mysqli_fetch_array($result)){
echo $row['id']."<br>";
echo $row['name']."<br>";
echo $row['address']."<br>";
echo $row['event_time']."<br>";
echo $row['insert_time']."<br>";
echo $row['code']."<br>";
echo "<br>";
}
}
else if($table == 'patient_90'){
$query_string = "select * from patient_90";
$result = mysqli_query($link,$query_string);
echo "<div style='font-weight: bold;font-size: 18px;color: red; border-bottom: 1px solid #ccc;padding: 10px'>";
var_dump($result);
echo "</div><br>";
while($row = mysqli_fetch_array($result)){
echo $row['patient_id']."<br>";
echo $row['patient_name']."<br>";
echo $row['patient_gender']."<br>";
echo $row['patient_address']."<br>";
echo "<br>";
}
}
}
}

30
setup_2.php Normal file
View File

@ -0,0 +1,30 @@
<?php
include_once("db_config.php");
mysqli_set_charset($link, 'utf8');
$query_string = "create table user_70(name char(50),address char(50),password char(50))ENGINE=MyISAM DEFAULT CHARSET=utf8";
mysqli_query($link,$query_string);
$query_string = "insert into user_70(name,address,password)values('mike','chengdu','c4ca4238a0b923820dcc509a6f75849b')";
mysqli_query($link,$query_string);
$query_string = "insert into user_70(name,address,password)values('mike','beijing','c4ca4238a0b923820dcc509a6f75849b')";
mysqli_query($link,$query_string);
$query_string = "insert into user_70(name,address,password)values('tom','chengdu','c4ca4238a0b923820dcc509a6f75849b')";
mysqli_query($link,$query_string);
$query_string = "insert into user_70(name,address,password)values('rose','chengdu','c4ca4238a0b923820dcc509a6f75849b')";
mysqli_query($link,$query_string);
$eventTime=mktime(12,12,12,12,12,2022);
$query_string = "create table nucleic_acid_test_2(id varchar(50),name varchar(50),address varchar(50),event_time int,insert_time int,code varchar(1))ENGINE=MyISAM DEFAULT CHARSET=utf8";
mysqli_query($link,$query_string);
$query_string = "insert into nucleic_acid_test_2(id,name,address,event_time,insert_time,code)values('510103199010210012','mike','shanghai',$eventTime,'1597238637','3')";
mysqli_query($link,$query_string);
$query_string ="insert into nucleic_acid_test_2(id,name,address,event_time,insert_time,code)values('510103198310607013','rose','beijing',$eventTime,'1597242237','2')";
mysqli_query($link,$query_string);
$query_string = "create table patient_90(patient_id char(50),patient_name char(50),patient_gender char(1),patient_address char(50))ENGINE=MyISAM DEFAULT CHARSET=utf8";
mysqli_query($link,$query_string);
$query_string = "insert into patient_90 values('123456','王某','1','1')";
mysqli_query($link,$query_string);
echo "表创建成功"

24
setup_3.php Normal file
View File

@ -0,0 +1,24 @@
<?php
include_once "db_config.php";
$queryString ="create table patient_90(patient_id char(50),patient_name char(50),patient_gender char(1),patient_address char(50))ENGINE=MyISAM DEFAULT CHARSET=utf8";
mysqli_query($link, $queryString);
$queryString ="create table doctor_90(doctor_id char(50),doctor_name char(50),doctor_gender char(1), department_id char(50))ENGINE=MyISAM DEFAULT CHARSET=utf8";
mysqli_query($link, $queryString);
$queryString ="create table department_90(department_id char(50),department_name char(50),department_location char(50))ENGINE=MyISAM DEFAULT CHARSET=utf8";
mysqli_query($link, $queryString);
$queryString ="create table register_90(biz_id char(50),doctor_id char(50),patient_id char(50),register_date int,fee int,state char(1))ENGINE=MyISAM DEFAULT CHARSET=utf8";
mysqli_query($link, $queryString);
$queryString ="insert into patient_90(patient_id,patient_name,patient_gender,patient_address)values('510103001','张三','1','成都')";
mysqli_query($link, $queryString);
$queryString ="insert into patient_90(patient_id,patient_name,patient_gender,patient_address)values('510103002','李四','2','重庆')";
mysqli_query($link, $queryString);
$queryString ="insert into doctor_90(doctor_id,doctor_name,doctor_gender,department_id)values('510105001','王医生','2','001')";
mysqli_query($link, $queryString);
$queryString ="insert into doctor_90(doctor_id,doctor_name,doctor_gender,department_id)values('510105002','罗医生','1','002')";
mysqli_query($link, $queryString);
$queryString ="insert into doctor_90(doctor_id,doctor_name,doctor_gender,department_id)values('510105003','陈医生','1','001')";
mysqli_query($link, $queryString);
$queryString ="insert into department_90(department_id,department_name,department_location)values('001','内科','1楼2诊室')";
mysqli_query($link, $queryString);
$queryString ="insert into department_90(department_id,department_name,department_location)values('002','外科','1楼5诊室')";
mysqli_query($link, $queryString);

38
spider_251_2.php Normal file
View File

@ -0,0 +1,38 @@
<?php
// 获取传入参数
$goods = $_GET['goods'] ?? null;
// 检查参数是否提供
if ($goods === null) {
echo json_encode(["error" => "Missing required parameter: goods"]);
exit;
}
// 定义目标地址
$target_url = "http://localhost:8022/goods/flash_sale_1.php";
// 使用 cURL 抓取页面内容
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $target_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10); // 设置超时时间
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo json_encode(["error" => "Failed to fetch the target page"]);
curl_close($ch);
exit;
}
curl_close($ch);
// 使用正则表达式匹配指定商品的价格
// 根据提供的网页结构,价格在 <span id="商品ID">价格</span> 中
$pattern = '/<span id="' . preg_quote($goods, '/') . '">(\d+)元<\/span>/';
if (preg_match($pattern, $response, $matches)) {
// 提取并输出价格
echo json_encode([(int)$matches[1]]);
} else {
// 如果没有匹配到价格,返回提示信息
echo json_encode(["error" => "Price not found for the specified goods"]);
}
?>

View File

@ -0,0 +1 @@
TipU5uMBK4WCb4D3zK3

46
upload_1.php Normal file
View File

@ -0,0 +1,46 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>文件上传</title>
</head>
<body>
<?php
// 定义文件上传目录
$uploadDir = __DIR__ . "/upload/";
// 检查并创建目录
if (!file_exists($uploadDir)) {
mkdir($uploadDir, 0777, true);
}
// 处理文件上传
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_FILES["my_upload_file"])) {
$file = $_FILES["my_upload_file"];
$fileName = basename($file["name"]);
$targetFile = $uploadDir . $fileName;
// 检查文件是否上传成功
if ($file["error"] === UPLOAD_ERR_OK) {
// 移动文件到指定目录
if (move_uploaded_file($file["tmp_name"], $targetFile)) {
echo "<p>文件上传成功!文件名:{$fileName}</p>";
echo "<p>存储路径:{$targetFile}</p>";
} else {
echo "<p>文件上传失败,请检查目录权限!</p>";
}
} else {
echo "<p>文件上传出错,错误码:" . $file["error"] . "</p>";
}
}
?>
<!-- 文件上传表单 -->
<form action="" method="post" enctype="multipart/form-data">
<label for="my_upload_file">请选择文件:</label>
<input type="file" id="my_upload_file" name="my_upload_file" required>
<br><br>
<input type="submit" id="ok" name="ok" value="上传">
</form>
</body>
</html>

7
www/admin/main.php Normal file
View File

@ -0,0 +1,7 @@
<?php
?>
<html>
<head>
<title>main</title>
</head>
</html>

7
www/config/config.php Normal file
View File

@ -0,0 +1,7 @@
<?php
?>
<html>
<head>
<title>config</title>
</head>
</html>

10
www/display.html Normal file
View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>display</title>
</head>
<body>
<a href="index.html">Index</a>
</body>
</html>

10
www/index.html Normal file
View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>index</title>
</head>
<body>
<a href="list.html">list</a>
</body>
</html>

7
www/lib/class.php Normal file
View File

@ -0,0 +1,7 @@
<?php
?>
<html>
<head>
<title>class</title>
</head>
</html>

11
www/list.html Normal file
View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>list</title>
</head>
<body>
<a href="display.html">display</a>
<a href="index.html">index</a>
</body>
</html>