commit eab1d7006199f09b3fc1937aa3546168d51a3cfd
Author: monjack
Date: Tue Jan 7 17:55:50 2025 +0800
Initial commit
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..e841b08
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,11 @@
+Tesseract/
+Shadowsocks-4.4.1.0/
+chrome-win64/
+_internal/
+.idea/
+dist/
+build/
+node_modules/
+test.py
+main.exe
+main.spec
diff --git a/20241115/exam_config.php b/20241115/exam_config.php
new file mode 100644
index 0000000..cec2b9f
--- /dev/null
+++ b/20241115/exam_config.php
@@ -0,0 +1,3 @@
+";
+$queryString="insert into user_70(name,address,password)values('mike','shanghai','c4ca4238a0b923820dcc509a6f75849b')";
+mysqli_query($link,$queryString);
+echo mysqli_error($link)."
";
+$queryString="insert into user_70(name,address,password)values('rose','beijing','c4ca4238a0b923820dcc509a6f75849b')";
+mysqli_query($link,$queryString);
+echo mysqli_error($link)."
";
\ No newline at end of file
diff --git a/20241115/form_test_1.php b/20241115/form_test_1.php
new file mode 100644
index 0000000..c93aed2
--- /dev/null
+++ b/20241115/form_test_1.php
@@ -0,0 +1,27 @@
+
+
+
+
\ No newline at end of file
diff --git a/20241115/list_72.php b/20241115/list_72.php
new file mode 100644
index 0000000..5114517
--- /dev/null
+++ b/20241115/list_72.php
@@ -0,0 +1,87 @@
+
+=$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 "";
+//id,name,password,gender,birthday,course,hometown,resume
+echo "学号 | 姓名 | 班级 | 性别 | 出生日期 | 选课 | 籍贯 | 操作 |
";
+while ($row=mysqli_fetch_assoc($rs)){
+ /*
+ echo $row['name'];
+
+ echo $row['course'];*/
+
+ echo "";
+
+ echo "".$row['name']." | ";
+ echo "
";
+
+}
+//新增与编辑的差异在于新增是地id没有值,而编辑时id有一个值。新增与编辑90%的功能是一样的,因此在实际开发中都是调用的同一个模块
+echo "
+新增
+|
+首页
+|
+上一页
+|
+下一页
+|
+尾页
+ |
";
+echo "
";
diff --git a/20241115/my_first_program.php b/20241115/my_first_program.php
new file mode 100644
index 0000000..a1c856a
--- /dev/null
+++ b/20241115/my_first_program.php
@@ -0,0 +1,4 @@
+
+
+
+
+
+ 文件上传
+
+
+文件上传表单
+
+
+
+文件上传成功!文件路径:$targetFilePath
";
+ } else {
+ echo "文件上传失败,请重试。
";
+ }
+ } else {
+ echo "未选择文件或文件上传出错。
";
+ }
+}
+?>
+
+
diff --git a/20241115/www/admin/main.php b/20241115/www/admin/main.php
new file mode 100644
index 0000000..740ea81
--- /dev/null
+++ b/20241115/www/admin/main.php
@@ -0,0 +1,12 @@
+
+
+
+
+ main
+
+
+
+
+
diff --git a/20241115/www/config/config.php b/20241115/www/config/config.php
new file mode 100644
index 0000000..3829f5d
--- /dev/null
+++ b/20241115/www/config/config.php
@@ -0,0 +1,10 @@
+
+
+
+
+ config
+
+
+
+
+
+
+
+
+ display
+
+
+list
+
+
\ No newline at end of file
diff --git a/20241115/www/index.html b/20241115/www/index.html
new file mode 100644
index 0000000..89e3121
--- /dev/null
+++ b/20241115/www/index.html
@@ -0,0 +1,10 @@
+
+
+
+
+ index
+
+
+list
+
+
\ No newline at end of file
diff --git a/20241115/www/lib/class.php b/20241115/www/lib/class.php
new file mode 100644
index 0000000..d07fa5c
--- /dev/null
+++ b/20241115/www/lib/class.php
@@ -0,0 +1,10 @@
+
+
+
+
+ class
+
+
+
+
+
+
+
+
+ list
+
+
+显示
+返回
+
+
\ No newline at end of file
diff --git a/20241208/acl_list.php b/20241208/acl_list.php
new file mode 100644
index 0000000..dca0719
--- /dev/null
+++ b/20241208/acl_list.php
@@ -0,0 +1,7 @@
+
+array("r_1.php","r_2.php","r_3.php"),
+ "manager"=>array("r_2.php","r_3.php"),
+ "staff"=>array("r_3.php")
+);
\ No newline at end of file
diff --git a/20241208/api_73_5_e_insert.php b/20241208/api_73_5_e_insert.php
new file mode 100644
index 0000000..ef9e3a8
--- /dev/null
+++ b/20241208/api_73_5_e_insert.php
@@ -0,0 +1,27 @@
+query($sql_check);
+
+if ($result_check->num_rows > 0) {
+ // 如果已有记录,直接返回码值
+ echo $code;
+} else {
+ // 插入新记录
+ $sql_insert = "INSERT INTO nucleic_acid_test_2 (id, name, address, event_time, code) VALUES ('$id', '$name', '$address', $event_time, '$code')";
+ if ($link->query($sql_insert) === TRUE) {
+ echo $code;
+ } else {
+ echo "插入失败: " . $link->error;
+ }
+}
diff --git a/20241208/api_73_5_e_select.php b/20241208/api_73_5_e_select.php
new file mode 100644
index 0000000..143fde2
--- /dev/null
+++ b/20241208/api_73_5_e_select.php
@@ -0,0 +1,50 @@
+query($sql_red);
+
+if ($result_red->num_rows > 0) {
+ // 存在红码时空交集,赋红码并入库
+ $sql_check = "SELECT * FROM nucleic_acid_test_2 WHERE id = '$id' AND address = '$address' AND event_time = $event_time";
+ $result_check = $conn->query($sql_check);
+ if ($result_check->num_rows == 0) {
+ $sql_insert = "INSERT INTO nucleic_acid_test_2 (id, name, address, event_time, code) VALUES ('$id', '$name', '$address', $event_time, '3')";
+ $conn->query($sql_insert);
+ }
+ echo "3";
+ $conn->close();
+ exit;
+}
+
+// 查询是否存在黄码时空交集
+$sql_yellow = "SELECT * FROM nucleic_acid_test_2
+ WHERE (address = '$address' OR ABS(event_time - $event_time) < 1800) AND code = '2'";
+$result_yellow = $conn->query($sql_yellow);
+
+if ($result_yellow->num_rows > 0) {
+ // 存在黄码时空交集,赋黄码并入库
+ $sql_check = "SELECT * FROM nucleic_acid_test_2 WHERE id = '$id' AND address = '$address' AND event_time = $event_time";
+ $result_check = $conn->query($sql_check);
+ if ($result_check->num_rows == 0) {
+ $sql_insert = "INSERT INTO nucleic_acid_test_2 (id, name, address, event_time, code) VALUES ('$id', '$name', '$address', $event_time, '2')";
+ $conn->query($sql_insert);
+ }
+ echo "2";
+ $conn->close();
+ exit;
+}
+
+// 无风险,返回绿码
+echo "1";
+?>
diff --git a/20241208/db_config.php b/20241208/db_config.php
new file mode 100644
index 0000000..578507f
--- /dev/null
+++ b/20241208/db_config.php
@@ -0,0 +1,4 @@
+";
+ echo $row['address']."
";
+ echo $row['password']."
";
+ echo "
";
+ }
+echo mysqli_error($link);
+
+$query_string = "select * from nucleic_acid_test_2;";
+$result = mysqli_query($link,$query_string);
+echo mysqli_error($link);
+echo "
";
+echo "
";
+echo "nucleic_acid_test_2:";
+while($row = mysqli_fetch_array($result)){
+ echo $row['id']."
";
+ echo $row['name']."
";
+ echo $row['address']."
";
+ echo $row['event_time']."
";
+ echo $row['insert_time']."
";
+ echo $row['code']."
";
+ echo "
";
+}
+
+echo "
";
+echo "
";
+echo "patient_90:";
+$query_string = "select * from patient_90;";
+$result =mysqli_query($link,$query_string);
+while($row = mysqli_fetch_array($result)){
+ echo $row['patient_id']."
";
+ echo $row['patient_name']."
";
+ echo $row['patient_gender']."
";
+ echo $row['patient_address']."
";
+ echo "
";
+ }
+echo mysqli_error($link);
\ No newline at end of file
diff --git a/20241208/form_test_2.php b/20241208/form_test_2.php
new file mode 100644
index 0000000..4753576
--- /dev/null
+++ b/20241208/form_test_2.php
@@ -0,0 +1,31 @@
+
+
+
+
+
+ Form Test 2
+
+
+提交后的姓名:$name";
+ echo "处理后的密码:$password
";
+}
+?>
+
+
+
+
diff --git a/20241208/form_test_74_2.php b/20241208/form_test_74_2.php
new file mode 100644
index 0000000..078f283
--- /dev/null
+++ b/20241208/form_test_74_2.php
@@ -0,0 +1,56 @@
+
+
+
+
\ No newline at end of file
diff --git a/20241208/img_code_1.php b/20241208/img_code_1.php
new file mode 100644
index 0000000..abfc623
--- /dev/null
+++ b/20241208/img_code_1.php
@@ -0,0 +1,20 @@
+
+=$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 "";
+//id,name,password,gender,birthday,course,hometown,resume
+echo "姓名列表 | ";
+$pattern = '/(\d+)/';
+while ($row=mysqli_fetch_assoc($rs)){
+ preg_match_all($pattern, $row['name'], $matches);
+ echo "
";
+ echo "".($matches[0][0]+1)." | ";
+ echo "".$row['name']." | ";
+
+}
+echo "
+首页
+|
+上一页
+|
+下一页
+|
+末页
+ |
";
+echo "
";
diff --git a/20241208/login.php b/20241208/login.php
new file mode 100644
index 0000000..61ee92a
--- /dev/null
+++ b/20241208/login.php
@@ -0,0 +1,32 @@
+
+
+
+用户登录
+
+
diff --git a/20241208/patient_90.php b/20241208/patient_90.php
new file mode 100644
index 0000000..20a9fac
--- /dev/null
+++ b/20241208/patient_90.php
@@ -0,0 +1,72 @@
+ 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());
+ }
+}
+?>
+
+
+
+
+
+
+ 患者建档
+
+
+患者建档
+
+
+
diff --git a/20241208/program_85.php b/20241208/program_85.php
new file mode 100644
index 0000000..3c5a134
--- /dev/null
+++ b/20241208/program_85.php
@@ -0,0 +1,29 @@
+
+$value){
+// echo "$value
";
+//}
+isAllow($acl, $role,"r_1.php");
+function isAllow($acl, $role, $resource){
+ if($role != ""){
+ if(isset($acl[$role])){
+ if(in_array($resource, $acl[$role])){
+// echo "角色".$role."可以访问".$resource."
";
+ echo "欢迎光临";
+ }else{
+// echo "角色无此权限,无法访问系统
";
+ echo "无权访问";
+ }
+ }else{
+// echo "角色未定义,无权访问系统
";
+ echo "无权访问";
+ }
+ }else{
+// echo "没有给定角色,无权访问系统
";
+ echo "无权访问";
+ }
+}
\ No newline at end of file
diff --git a/20241208/r_2.php b/20241208/r_2.php
new file mode 100644
index 0000000..35acc9b
--- /dev/null
+++ b/20241208/r_2.php
@@ -0,0 +1,27 @@
+$value){
+// echo "$value
";
+//}
+isAllow($acl, $role,"r_2.php");
+function isAllow($acl, $role, $resource){
+ if($role != ""){
+ if(isset($acl[$role])){
+ if(in_array($resource, $acl[$role])){
+// echo "角色".$role."可以访问".$resource."
";
+ echo "欢迎光临";
+ }else{
+// echo "角色无此权限,无法访问系统
";
+ echo "无权访问";
+ }
+ }else{
+// echo "角色未定义,无权访问系统
";
+ echo "无权访问";
+ }
+ }else{
+// echo "没有给定角色,无权访问系统
";
+ echo "无权访问";
+ }
+}
\ No newline at end of file
diff --git a/20241208/r_3.php b/20241208/r_3.php
new file mode 100644
index 0000000..0251129
--- /dev/null
+++ b/20241208/r_3.php
@@ -0,0 +1,27 @@
+$value){
+// echo "$value
";
+//}
+isAllow($acl, $role,"r_3.php");
+function isAllow($acl, $role, $resource){
+ if($role != ""){
+ if(isset($acl[$role])){
+ if(in_array($resource, $acl[$role])){
+// echo "角色".$role."可以访问".$resource."
";
+ echo "欢迎光临";
+ }else{
+// echo "角色无此权限,无法访问系统
";
+ echo "无权访问";
+ }
+ }else{
+// echo "角色未定义,无权访问系统
";
+ echo "无权访问";
+ }
+ }else{
+// echo "没有给定角色,无权访问系统
";
+ echo "无权访问";
+ }
+}
\ No newline at end of file
diff --git a/20241208/register.php b/20241208/register.php
new file mode 100644
index 0000000..f51564a
--- /dev/null
+++ b/20241208/register.php
@@ -0,0 +1,51 @@
+
+";
+ $valid = false;
+ }
+ //判断姓名是否重复
+ $queryString = "select count(name) as counter from user_70 where name = '$name'";
+ $rs = mysqli_query($link,$queryString);
+ $row = mysqli_fetch_assoc($rs);
+ if($row['counter'] != 0){
+// echo "用户". $name."已存在,请换名
";
+ $userExist = true;
+ }else{
+ $userExist = false;
+ }
+
+ if($valid && !$userExist){
+ //对密码加密
+ $password_1 = md5($password_1);
+ //如果验证通过,把注册信息写入表中
+ $queryString = "insert into user_70(name,password) values('$name','$password_1') ";
+ mysqli_query($link,$queryString);
+ echo "恭喜,注册成功!";
+ }
+ if($valid && $userExist){
+ $password_1 = md5($password_1);
+ $queryString = "update user_70 set password = '$password_1' where name = '$name'";
+ mysqli_query($link,$queryString);
+ echo "密码更新成功";
+ }
+
+
+}else{
+ $name = "";
+}
+?>
+
+
diff --git a/20241208/robot_251.php b/20241208/robot_251.php
new file mode 100644
index 0000000..f9ee20d
--- /dev/null
+++ b/20241208/robot_251.php
@@ -0,0 +1,5 @@
+
+
+
+
+ 姓名查询
+
+
+
+
+
+prepare("SELECT address FROM user_70 WHERE name = ?");
+ $query->bind_param("s", $searchName);
+ $query->execute();
+ $result = $query->get_result();
+
+ if ($result->num_rows > 0) {
+ // 输出查询结果
+ while ($row = $result->fetch_assoc()) {
+ echo "地址: " . htmlspecialchars($row['address']) . "
";
+ }
+ } else {
+ // 在没有查询到结果时显示
+ echo "查无此人
";
+ }
+
+}
+?>
+
+
+
\ No newline at end of file
diff --git a/20241208/search_73_1.php b/20241208/search_73_1.php
new file mode 100644
index 0000000..3dc2dd3
--- /dev/null
+++ b/20241208/search_73_1.php
@@ -0,0 +1,74 @@
+
+
+
+
+ 姓名与地址查询
+
+
+
+
+
+ 0) {
+ $sql = "SELECT * FROM user_70 WHERE " . implode(" " . strtoupper($searchLogic) . " ", $conditions);
+ $stmt = $link->prepare($sql);
+ $stmt->bind_param($types, ...$params);
+ $stmt->execute();
+ $result = $stmt->get_result();
+
+ $rowCount = $result->num_rows;
+ echo "[" . $rowCount . "]
"; // 显示记录数
+
+ if ($rowCount > 0) {
+ while ($row = $result->fetch_assoc()) {
+ echo "姓名: " . htmlspecialchars($row['name']) . " 地址: " . htmlspecialchars($row['address']) . "
";
+ }
+ }
+
+ $stmt->close();
+ } else {
+ // 如果没有提供查询条件则不执行查询
+ echo "[0]
";
+ }
+}
+ ?>
\ No newline at end of file
diff --git a/20241208/user_info.php b/20241208/user_info.php
new file mode 100644
index 0000000..1696dae
--- /dev/null
+++ b/20241208/user_info.php
@@ -0,0 +1,3 @@
+
+
+
+
+ main
+
+
+
+
+
+
+
diff --git a/20241208/www/admin/left.html b/20241208/www/admin/left.html
new file mode 100644
index 0000000..566549b
--- /dev/null
+++ b/20241208/www/admin/left.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Title
+
+
+
+
+
\ No newline at end of file
diff --git a/20241208/www/admin/right.html b/20241208/www/admin/right.html
new file mode 100644
index 0000000..566549b
--- /dev/null
+++ b/20241208/www/admin/right.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Title
+
+
+
+
+
\ No newline at end of file
diff --git a/20241208/www/admin/top.html b/20241208/www/admin/top.html
new file mode 100644
index 0000000..566549b
--- /dev/null
+++ b/20241208/www/admin/top.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Title
+
+
+
+
+
\ No newline at end of file
diff --git a/20241208/www/display.html b/20241208/www/display.html
new file mode 100644
index 0000000..7331e12
--- /dev/null
+++ b/20241208/www/display.html
@@ -0,0 +1,10 @@
+
+
+
+
+ display
+
+
+list.html
+
+
\ No newline at end of file
diff --git a/20241208/www/index.html b/20241208/www/index.html
new file mode 100644
index 0000000..43f0052
--- /dev/null
+++ b/20241208/www/index.html
@@ -0,0 +1,10 @@
+
+
+
+
+ index
+
+
+list.html
+
+
\ No newline at end of file
diff --git a/20241208/www/list.html b/20241208/www/list.html
new file mode 100644
index 0000000..09c2571
--- /dev/null
+++ b/20241208/www/list.html
@@ -0,0 +1,11 @@
+
+
+
+
+ list
+
+
+index.html
+display.html
+
+
\ No newline at end of file
diff --git a/20250103/acl_list.php b/20250103/acl_list.php
new file mode 100644
index 0000000..f671e17
--- /dev/null
+++ b/20250103/acl_list.php
@@ -0,0 +1,17 @@
+ array("r_1.php", "r_2.php", "r_3.php"),
+ "manager" => array("r_2.php", "r_3.php"),
+ "staff" => array("r_3.php")
+);
+
+// 定义检查权限的函数
+function checkAccess($role, $resource) {
+ global $acl;
+ if (isset($acl[$role]) && in_array($resource, $acl[$role])) {
+ return true; // 有权限
+ }
+ return false; // 无权限
+}
+
diff --git a/20250103/api_183_1.php b/20250103/api_183_1.php
new file mode 100644
index 0000000..06e5c5c
--- /dev/null
+++ b/20250103/api_183_1.php
@@ -0,0 +1,38 @@
+ "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);
+?>
diff --git a/20250103/api_183_2.php b/20250103/api_183_2.php
new file mode 100644
index 0000000..cdc25fd
--- /dev/null
+++ b/20250103/api_183_2.php
@@ -0,0 +1,38 @@
+ "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);
+?>
diff --git a/20250103/create_tables.php b/20250103/create_tables.php
new file mode 100644
index 0000000..6d8d48e
--- /dev/null
+++ b/20250103/create_tables.php
@@ -0,0 +1,102 @@
+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 "患者表创建成功!
";
+} else {
+ echo "创建患者表失败: " . $conn->error . "
";
+}
+
+// 创建医生表
+$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 "医生表创建成功!
";
+} else {
+ echo "创建医生表失败: " . $conn->error . "
";
+}
+
+// 创建科室表
+$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 "科室表创建成功!
";
+} else {
+ echo "创建科室表失败: " . $conn->error . "
";
+}
+
+// 创建挂号表
+$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 "挂号表创建成功!
";
+} else {
+ echo "创建挂号表失败: " . $conn->error . "
";
+}
+
+// 插入测试数据
+$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 "测试数据插入成功!
";
+} else {
+ echo "插入测试数据失败: " . $conn->error . "
";
+}
+
+// 关闭数据库连接
+$conn->close();
+?>
diff --git a/20250103/db_config.php b/20250103/db_config.php
new file mode 100644
index 0000000..f5c0d90
--- /dev/null
+++ b/20250103/db_config.php
@@ -0,0 +1,8 @@
+
+
+
+
+
+ 表单编程与现场恢复
+
+
+
+
+
+
+
+
+
+ 提交结果:
+ 姓名:
+ 处理后的密码:
+
+
+
diff --git a/20250103/form_test_74_2.php b/20250103/form_test_74_2.php
new file mode 100644
index 0000000..0a80528
--- /dev/null
+++ b/20250103/form_test_74_2.php
@@ -0,0 +1,79 @@
+
+
+
+
+ 表单提交与现场恢复
+
+
+
+
+
+
+
+
+
+ 提交结果:
+ 姓名:
+ 性别:
+ 选课:
+
+
+ 籍贯:
+
+
+
diff --git a/20250103/list_72.php b/20250103/list_72.php
new file mode 100644
index 0000000..f810837
--- /dev/null
+++ b/20250103/list_72.php
@@ -0,0 +1,97 @@
+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);
+
+?>
+
+
+
+
+
+ 姓名列表
+
+
+
+
+
+ 姓名列表 |
+
+ num_rows > 0) {
+ $index = $offset + 1; // 起始序号
+ while ($row = $result->fetch_assoc()) {
+ echo "{$index}. {$row['name']} |
";
+ $index++;
+ }
+ } else {
+ echo "没有数据 |
";
+ }
+ ?>
+
+
+ 首页
+ 上一页
+ 下一页
+ 末页
+ |
+
+
+
+
diff --git a/20250103/login.php b/20250103/login.php
new file mode 100644
index 0000000..b8f99a3
--- /dev/null
+++ b/20250103/login.php
@@ -0,0 +1,52 @@
+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 "用户名或密码错误!";
+ }
+ }
+}
+?>
+
+
+
+
+
+ 用户登录
+
+
+
+
+
diff --git a/20250103/patient_register_90.php b/20250103/patient_register_90.php
new file mode 100644
index 0000000..a77550e
--- /dev/null
+++ b/20250103/patient_register_90.php
@@ -0,0 +1,114 @@
+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);
+?>
+
+
+
+
+
+ 患者挂号
+
+
+患者挂号
+
+
+
+
+
diff --git a/20250103/patient_register_list_90.php b/20250103/patient_register_list_90.php
new file mode 100644
index 0000000..b2e779a
--- /dev/null
+++ b/20250103/patient_register_list_90.php
@@ -0,0 +1,107 @@
+query($sql_query);
+?>
+
+
+
+
+
+ 患者挂号列表
+
+
+
+患者挂号列表
+
+
+
+
+
+
+ 科室 |
+ 医生 |
+ 患者 |
+ 就诊时间 |
+ 挂号费 |
+ 操作 |
+
+
+
+ num_rows > 0): ?>
+ fetch_assoc()) { ?>
+
+ |
+ |
+ |
+ |
+ |
+
+ 编辑
+ |
+ 删除
+ |
+
+
+
+
+ 暂无数据 |
+
+
+
+
+
+
diff --git a/20250103/r_1.php b/20250103/r_1.php
new file mode 100644
index 0000000..3207fc5
--- /dev/null
+++ b/20250103/r_1.php
@@ -0,0 +1,14 @@
+
diff --git a/20250103/r_2.php b/20250103/r_2.php
new file mode 100644
index 0000000..270a1e3
--- /dev/null
+++ b/20250103/r_2.php
@@ -0,0 +1,9 @@
+
diff --git a/20250103/r_3.php b/20250103/r_3.php
new file mode 100644
index 0000000..b15933c
--- /dev/null
+++ b/20250103/r_3.php
@@ -0,0 +1,8 @@
+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();
+?>
+
+
+
+
+
+ 用户注册与修改密码
+
+
+
+
+
diff --git a/20250103/robot_251_1.php b/20250103/robot_251_1.php
new file mode 100644
index 0000000..52f61f2
--- /dev/null
+++ b/20250103/robot_251_1.php
@@ -0,0 +1,5 @@
+
+
+
+
+ 操作表
+
+
+
+
+
+
+操作表
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/20250103/setup.php b/20250103/setup.php
new file mode 100644
index 0000000..5a127b4
--- /dev/null
+++ b/20250103/setup.php
@@ -0,0 +1,118 @@
+ 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 "
";
+ 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 "";
+ var_dump($result);
+ echo "
";
+ while($row = mysqli_fetch_array($result)){
+ echo $row['name']."
";
+ echo $row['address']."
";
+ echo $row['password']."
";
+ echo "
";
+ }
+ }
+ else if($table == 'nucleic_acid_test_2'){
+ $query_string = "select * from nucleic_acid_test_2";
+ $result = mysqli_query($link,$query_string);
+ echo "";
+ var_dump($result);
+ echo "
";
+ while($row = mysqli_fetch_array($result)){
+ echo $row['id']."
";
+ echo $row['name']."
";
+ echo $row['address']."
";
+ echo $row['event_time']."
";
+ echo $row['insert_time']."
";
+ echo $row['code']."
";
+ echo "
";
+ }
+ }
+ else if($table == 'patient_90'){
+ $query_string = "select * from patient_90";
+ $result = mysqli_query($link,$query_string);
+ echo "";
+ var_dump($result);
+ echo "
";
+ while($row = mysqli_fetch_array($result)){
+ echo $row['patient_id']."
";
+ echo $row['patient_name']."
";
+ echo $row['patient_gender']."
";
+ echo $row['patient_address']."
";
+ echo "
";
+ }
+ }
+
+ }
+}
diff --git a/20250103/spider_251_2.php b/20250103/spider_251_2.php
new file mode 100644
index 0000000..33c6b8e
--- /dev/null
+++ b/20250103/spider_251_2.php
@@ -0,0 +1,38 @@
+ "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);
+
+// 使用正则表达式匹配指定商品的价格
+// 根据提供的网页结构,价格在 价格 中
+$pattern = '/(\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"]);
+}
+?>
diff --git a/20250103/upload_1.php b/20250103/upload_1.php
new file mode 100644
index 0000000..bb78344
--- /dev/null
+++ b/20250103/upload_1.php
@@ -0,0 +1,46 @@
+
+
+
+
+ 文件上传
+
+
+文件上传成功!文件名:{$fileName}";
+ echo "存储路径:{$targetFile}
";
+ } else {
+ echo "文件上传失败,请检查目录权限!
";
+ }
+ } else {
+ echo "文件上传出错,错误码:" . $file["error"] . "
";
+ }
+}
+?>
+
+
+
+
+
diff --git a/20250103/user_info.php b/20250103/user_info.php
new file mode 100644
index 0000000..80a5dc9
--- /dev/null
+++ b/20250103/user_info.php
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+ 用户信息
+
+
+欢迎, !
+
+
diff --git a/20250103/www/admin/main.php b/20250103/www/admin/main.php
new file mode 100644
index 0000000..879657d
--- /dev/null
+++ b/20250103/www/admin/main.php
@@ -0,0 +1,7 @@
+
+
+
+main
+
+
diff --git a/20250103/www/config/config.php b/20250103/www/config/config.php
new file mode 100644
index 0000000..7645bd9
--- /dev/null
+++ b/20250103/www/config/config.php
@@ -0,0 +1,7 @@
+
+
+
+config
+
+
diff --git a/20250103/www/display.html b/20250103/www/display.html
new file mode 100644
index 0000000..b9e7ca4
--- /dev/null
+++ b/20250103/www/display.html
@@ -0,0 +1,10 @@
+
+
+
+
+ display
+
+
+ Index
+
+
\ No newline at end of file
diff --git a/20250103/www/index.html b/20250103/www/index.html
new file mode 100644
index 0000000..4ff09bf
--- /dev/null
+++ b/20250103/www/index.html
@@ -0,0 +1,10 @@
+
+
+
+
+ index
+
+
+ list
+
+
\ No newline at end of file
diff --git a/20250103/www/lib/class.php b/20250103/www/lib/class.php
new file mode 100644
index 0000000..0bd4b83
--- /dev/null
+++ b/20250103/www/lib/class.php
@@ -0,0 +1,7 @@
+
+
+
+class
+
+
diff --git a/20250103/www/list.html b/20250103/www/list.html
new file mode 100644
index 0000000..1e97c65
--- /dev/null
+++ b/20250103/www/list.html
@@ -0,0 +1,11 @@
+
+
+
+
+ list
+
+
+ display
+ index
+
+
\ No newline at end of file
diff --git a/__pycache__/main.cpython-311.pyc b/__pycache__/main.cpython-311.pyc
new file mode 100644
index 0000000..6dba7e9
Binary files /dev/null and b/__pycache__/main.cpython-311.pyc differ
diff --git a/blankFillingQ/textarea_student_answer_01 b/blankFillingQ/textarea_student_answer_01
new file mode 100644
index 0000000..4dbe848
--- /dev/null
+++ b/blankFillingQ/textarea_student_answer_01
@@ -0,0 +1 @@
+ASP 解释型脚本 内容管理系统 FTP 80
\ No newline at end of file
diff --git a/blankFillingQ/textarea_student_answer_01_2.txt b/blankFillingQ/textarea_student_answer_01_2.txt
new file mode 100644
index 0000000..13a9a22
--- /dev/null
+++ b/blankFillingQ/textarea_student_answer_01_2.txt
@@ -0,0 +1,5 @@
+新Spring应用的初始搭建以及开发过程
+注解和约定大于配置
+面向切面编程
+控制反转
+依赖注入
\ No newline at end of file
diff --git a/blankFillingQ/textarea_student_answer_01_2_e b/blankFillingQ/textarea_student_answer_01_2_e
new file mode 100644
index 0000000..5867b3a
--- /dev/null
+++ b/blankFillingQ/textarea_student_answer_01_2_e
@@ -0,0 +1,5 @@
+springboot
+XML
+面向切面编程
+控制反转
+依赖注入
diff --git a/blankFillingQ/textarea_student_answer_01_3.txt b/blankFillingQ/textarea_student_answer_01_3.txt
new file mode 100644
index 0000000..7418c82
--- /dev/null
+++ b/blankFillingQ/textarea_student_answer_01_3.txt
@@ -0,0 +1,5 @@
+@RequestMapping
+@SpringBootApplication
+@Controller
+@Service
+@Autowired
\ No newline at end of file
diff --git a/blankFillingQ/textarea_student_answer_01_3_e b/blankFillingQ/textarea_student_answer_01_3_e
new file mode 100644
index 0000000..84dbab5
--- /dev/null
+++ b/blankFillingQ/textarea_student_answer_01_3_e
@@ -0,0 +1,3 @@
+映射URL路径
+标识一个Java 类是一个控制器
+用于标识服务层组件
diff --git a/blankFillingQ/textarea_student_answer_02 b/blankFillingQ/textarea_student_answer_02
new file mode 100644
index 0000000..af18d70
--- /dev/null
+++ b/blankFillingQ/textarea_student_answer_02
@@ -0,0 +1 @@
+index.html 虚拟主机 获取对象 Math.random() js类库
\ No newline at end of file
diff --git a/blankFillingQ/textarea_student_answer_03.txt b/blankFillingQ/textarea_student_answer_03.txt
new file mode 100644
index 0000000..4569b37
--- /dev/null
+++ b/blankFillingQ/textarea_student_answer_03.txt
@@ -0,0 +1,5 @@
+JSP
+解释型脚本
+CMS
+21
+http
\ No newline at end of file
diff --git a/blankFillingQ/textarea_student_answer_04.txt b/blankFillingQ/textarea_student_answer_04.txt
new file mode 100644
index 0000000..455d464
--- /dev/null
+++ b/blankFillingQ/textarea_student_answer_04.txt
@@ -0,0 +1,5 @@
+首页
+VPS
+document.getElementById("user_name")
+Date.getYear()
+ajax
\ No newline at end of file
diff --git a/blankFillingQ/textarea_student_answer_521.txt b/blankFillingQ/textarea_student_answer_521.txt
new file mode 100644
index 0000000..bf63dc7
--- /dev/null
+++ b/blankFillingQ/textarea_student_answer_521.txt
@@ -0,0 +1,20 @@
+
+
+
+
+ Title
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/blankFillingQ/textarea_student_answer_521_1 b/blankFillingQ/textarea_student_answer_521_1
new file mode 100644
index 0000000..f3fad36
--- /dev/null
+++ b/blankFillingQ/textarea_student_answer_521_1
@@ -0,0 +1,23 @@
+
+
+
+
+ AJAX获取服务器时间
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/blankFillingQ/textarea_student_answer_60_2_e b/blankFillingQ/textarea_student_answer_60_2_e
new file mode 100644
index 0000000..0625300
--- /dev/null
+++ b/blankFillingQ/textarea_student_answer_60_2_e
@@ -0,0 +1,103 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/captcha.png b/captcha.png
new file mode 100644
index 0000000..316606f
Binary files /dev/null and b/captcha.png differ
diff --git a/chromedriver.exe b/chromedriver.exe
new file mode 100644
index 0000000..edf2227
Binary files /dev/null and b/chromedriver.exe differ
diff --git a/info.txt b/info.txt
new file mode 100644
index 0000000..d62b780
--- /dev/null
+++ b/info.txt
@@ -0,0 +1,10 @@
+125.64.9.222
+58011
+user_20250103_58011
+5BSVN9rMFNaiFGc
+21
+exam_20250103_58011
+user_20250103_58011
+5BSVN9rMFNaiFGc
+58311
+58611
diff --git a/main.py b/main.py
new file mode 100644
index 0000000..0264441
--- /dev/null
+++ b/main.py
@@ -0,0 +1,357 @@
+from selenium import webdriver
+from selenium.webdriver.common.by import By
+from selenium.webdriver.chrome.service import Service
+from selenium.webdriver.chrome.options import Options
+from selenium.webdriver.support.ui import WebDriverWait
+from selenium.webdriver.support import expected_conditions as EC
+import requests
+from PIL import Image
+import pytesseract
+import io
+import time
+import re
+import os
+import tkinter as tk
+import ftplib
+
+#
+# def ftp_upload_with_proxy(server, username, password, local_file_path, remote_path, proxy):
+# """使用 pycurl 上传单个文件到 FTP 服务器"""
+# buffer = BytesIO()
+# c = pycurl.Curl()
+#
+# # 设置 FTP URL
+# ftp_url = f'ftp://{server}/{remote_path}'
+# c.setopt(c.URL, ftp_url)
+#
+# # 设置 FTP 认证
+# c.setopt(c.USERPWD, f"{username}:{password}")
+# c.setopt(c.READDATA, open(local_file_path, 'rb'))
+# c.setopt(c.UPLOAD, 1)
+# c.setopt(c.PREQUOTE, ['PASV'])
+#
+# # 设置代理
+# c.setopt(c.PROXY, proxy)
+#
+# try:
+# c.perform()
+# print(f"文件 {local_file_path} 成功上传到 {remote_path}!")
+# except pycurl.error as e:
+# print(f"FTP 错误: {e}")
+# finally:
+# c.close()
+
+# def upload_directory_to_ftp(server, username, password, local_directory, remote_directory, proxy):
+# """上传整个目录及其子目录到FTP服务器"""
+# # 确保远程目录存在
+# try:
+# # 此段代码需要检查并创建远程目录
+# # pycurl 不直接提供创建目录的功能,需要手动实现
+#
+# # 上传文件和子目录
+# for root, dirs, files in os.walk(local_directory):
+# # 上传子文件夹
+# for dir_name in dirs:
+# remote_dir_path = os.path.join(remote_directory,
+# os.path.relpath(os.path.join(root, dir_name), local_directory)).replace(
+# "\\", "/")
+# print(f"准备上传目录: {remote_dir_path}")
+# # 假设已确认远程目录存在
+#
+# # 上传文件
+# for filename in files:
+# local_file_path = os.path.join(root, filename) # 本地文件的完整路径
+# relative_path = os.path.relpath(local_file_path, local_directory) # 计算相对路径
+# remote_file_path = os.path.join(remote_directory, relative_path).replace("\\", "/") # 计算远程文件路径
+#
+# # 上传文件
+# ftp_upload_with_proxy(server, username, password, local_file_path, remote_file_path, proxy)
+#
+# except Exception as e:
+# print(f"上传目录时发生错误: {e}")
+
+def upload_file_to_ftp(server, username, password, file_path, remote_path):
+ try:
+ with ftplib.FTP(server) as ftp:
+ ftp.login(user=username, passwd=password)
+ with open(file_path, 'rb') as file:
+ ftp.storbinary(f'STOR {remote_path}', file)
+ print(f"文件 {file_path} 成功上传到 {remote_path}!")
+ except ftplib.all_errors as e:
+ print(f"FTP 错误: {e}")
+
+def upload_directory_to_ftp(server, username, password, local_directory, remote_directory):
+ """上传整个目录及其子目录到FTP服务器"""
+ try:
+ with ftplib.FTP(server) as ftp:
+ ftp.login(user=username, passwd=password)
+
+ # 确保远程目录存在
+ try:
+ ftp.cwd(remote_directory) # 改变到远程目录
+ except ftplib.error_perm:
+ ftp.mkd(remote_directory) # 如果远程目录不存在,则创建
+ ftp.cwd(remote_directory) # 再次进入远程目录
+
+ # 遍历本地目录树
+ for root, dirs, files in os.walk(local_directory):
+ # 上传子文件夹
+ for dir_name in dirs:
+ remote_dir_path = os.path.join(remote_directory, os.path.relpath(os.path.join(root, dir_name), local_directory)).replace("\\", "/")
+ try:
+ ftp.mkd(remote_dir_path) # 在FTP服务器上创建子目录
+ print(f"已创建远程目录: {remote_dir_path}")
+ except ftplib.error_perm:
+ pass # 如果目录已经存在则忽略
+
+ # 上传文件
+ for filename in files:
+ local_file_path = os.path.join(root, filename) # 本地文件的完整路径
+ relative_path = os.path.relpath(local_file_path, local_directory) # 计算相对路径
+ remote_file_path = os.path.join(remote_directory, relative_path).replace("\\", "/") # 计算远程文件路径
+ ftp_upload_with_proxy(server, username, password, local_file_path, remote_file_path, proxy_url) # 上传文件
+
+ except ftplib.all_errors as e:
+ print(f"上传目录时发生错误: {e}")
+
+def launch_proxy():
+ print("开启代理...")
+ cmd = "start ./Shadowsocks-4.4.1.0/Shadowsocks.exe"
+ os.system('chcp 65001')
+ os.system(cmd)
+
+def close_proxy():
+ print("杀死代理进程")
+ cmd = "taskkill /f /im Shadowsocks.exe"
+ os.system('chcp 65001')
+ os.system(cmd)
+ cmd = """
+ reg add "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f
+ """
+ print(cmd)
+ os.system(cmd)
+
+
+def shot(chromedriver_path ,chrome_path):
+
+ options = Options()
+ options.add_experimental_option("detach", True)
+ options.binary_location = chrome_path
+ options.add_argument("--no-sandbox")
+ # 初始化 WebDriver
+ service = Service(chromedriver_path)
+ driver = webdriver.Chrome(service=service, options=options)
+ driver.get("http://125.64.9.222:8022/login_exam.php")
+
+ try:
+
+ launch_proxy()
+ time.sleep(5)
+
+ exam_id = name_entry.get()
+ student_id = id_entry.get()
+ password = password_entry.get()
+
+ try:
+ # 创建文件夹
+ os.mkdir(folder_path) # 如果目录已存在,则会抛出OSError
+ print(f"文件夹 '{folder_path}' 创建成功!")
+
+ except FileExistsError:
+ print(f"文件夹 '{folder_path}' 已存在!")
+ except Exception as e:
+ print(f"创建文件夹时发生错误: {e}")
+
+ # 填写 exam_id, student_id 和 password
+ driver.find_element(By.ID, "exam_id").send_keys(exam_id) # exam_id
+ driver.find_element(By.ID, "student_id").send_keys(student_id) # student_id
+ driver.find_element(By.ID, "password").send_keys(password) # password
+
+ # 获取验证码图片
+ captcha_image = driver.find_element(By.CSS_SELECTOR, "img[src='./lib/image_code_1.php']")
+
+ # 截取验证码图片
+ captcha = captcha_image.screenshot_as_png
+
+ # 打开验证码图片
+ captcha = Image.open(io.BytesIO(captcha))
+ captcha.save("captcha.png") # 可选,保存图片以供调试
+ captcha_text = pytesseract.image_to_string(captcha, config="--psm 6")
+ print(f"识别到的验证码: {captcha_text}")
+
+ # 填写验证码
+ driver.find_element(By.ID, "imageCode").send_keys(captcha_text.strip())
+
+ # 提交表单
+ driver.find_element(By.ID, "ok").click() # 替换为实际的提交按钮 ID
+
+ # 获取页面 Cookies
+ cookies = driver.get_cookies()
+ session_cookies = {cookie['name']: cookie['value'] for cookie in cookies}
+
+ # 用 requests 请求目标 URL
+ url = "http://125.64.9.222:8022/paper/student_server_info.php"
+ response = requests.get(url, cookies=session_cookies)
+ response.raise_for_status() # 确保请求成功
+ print(response.text) # 打印响应内容
+
+ matches = [match.strip() for match in re.findall(r"(?<=:).*?(?=
)", response.text)]
+ print(matches)
+
+
+ with open("info.txt", "w", encoding="utf-8") as f:
+ for match in matches:
+ f.write(match + "\n") # 保存结果到文件
+
+ # command = "start result.txt"
+ # subprocess.Popen(command, shell=True) # 打开结果文件
+ # 等待页面加载或处理结果
+ # WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, "result"))) # 替换为实际的结果 ID
+ # print("登录成功!")
+
+ exam_config = f"""
+