基于PHP5.4+MySQL高校实训室预约系统

声明:

此项目为本人2023年创建用于毕业设计,项目中的某些功能逻辑由于开题要求并未做到逻辑严谨和完善,页面样式简陋单调因开题内容并未过多要求不做过多完善。此项目内容仅用于学习和参考,未经授权禁止转载。

功能图示

登录页

注册页

教师用户页面

首页

我的预约

预约教室

日期选择

Ps:只供选择今日起往后一个星期的日期

预约界面

时间表

用户信息修改

管理员用户页面

首页

预约信息审核

教室信息修改

日期选择

Ps:选择范围同教师用户预约教室页面

修改界面

添加教室信息

教师用户信息修改

教师用户信息添加

功能模块图

用例图

教师管理模块用例

实训室管理模块用例

预约管理模块用例

系统管理模块用例

时间表管理模块用例

实体关系E-R图

用户

实训室

预约

总体

主要功能程序流程图

登录逻辑

注册逻辑

预约逻辑

数据库设计

用户表

教职工号表

预约状态信息表

实训室信息表

建表

# Host: localhost  (Version: 5.5.53)
# Date: 2024-10-24 16:14:06
# Generator: MySQL-Front 5.3  (Build 4.234)

/*!40101 SET NAMES utf8 */;

#
# Structure for table "classroom_info"
#

CREATE TABLE `classroom_info` (
  `Id` int(10) NOT NULL AUTO_INCREMENT,
  `name` char(10) DEFAULT NULL,
  `availability` char(5) DEFAULT NULL,
  `time_type` int(4) DEFAULT NULL,
  `date` datetime DEFAULT NULL,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=139 DEFAULT CHARSET=utf8;

#
# Structure for table "reservation_info"
#

CREATE TABLE `reservation_info` (
  `teacher` char(10) DEFAULT NULL,
  `classroom_name` char(10) DEFAULT NULL,
  `status` char(10) DEFAULT NULL,
  `date` datetime DEFAULT NULL,
  `time_type` int(4) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

#
# Structure for table "teacher_id"
#

CREATE TABLE `teacher_id` (
  `tId` char(12) NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

#
# Structure for table "users"
#

CREATE TABLE `users` (
  `user_id` int(11) NOT NULL AUTO_INCREMENT,
  `type_id` int(11) NOT NULL,
  `name` varchar(15) DEFAULT NULL,
  `password` char(15) DEFAULT NULL,
  `profession` char(15) DEFAULT NULL,
  `title` char(10) DEFAULT NULL,
  `sex` char(2) DEFAULT NULL,
  `education` char(5) DEFAULT NULL,
  `tel` char(15) DEFAULT NULL,
  `tid` char(12) DEFAULT NULL,
  PRIMARY KEY (`type_id`,`user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;

开发实现

配置包含文件函数

数据库配置

database.php

<?php  
$database_connection = null; 

function get_connection()
{ 

     $hostname = "127.0.0.1"; 						//数据库服务器主机名,可以用IP代替 
     $username = "root"; 							//数据库服务器用户名 
     $password = "root"; 		 					//数据库服务器密码 
	 $database = "classroom management"; 			//数据库名 
	 
     global $database_connection;   //应用到全局(整个PHP)

     $database_connection = @mysql_connect($hostname, $username, $password) or die(mysql_error());//连接数据库服务器 

     mysql_query("set names 'utf-8'");//设置字符集 

     mysql_select_db($database, $database_connection) or die(mysql_error()); 
} 

function close_connection()
{ 
     global $database_connection; 

     if($database_connection)
     { 
     		mysql_close($database_connection) or die(mysql_error()); 
	} 
} 

?> 

阻止未登录情况下进入所有功能界面

forbid.php

<?php
session_start();
$id=$_SESSION['name'];

if(empty($id)){
    echo '<script >alert("请登录");</script>';
    header("refresh:0;url=../login.html");
}

CSS(非专业仅参考)

addteacherid.css

* {
	margin: 0;
	padding: 0;
}

body {
	height: auto;
	width: auto;
	background-color: #ececec;
}

.head {
	display: flex;
	/* justify-content: center; */
	justify-content: space-around;
	align-items: center;
	background: #414141;
	height: 50px;
}

nav ul li {
	list-style: none;
	display: inline-block;
}

nav ul li a {
	padding: 10px;
	color: #ffffff;
	text-decoration: none;
}

.title {
	color: #FFFFFF;
	cursor: pointer;
}

.btn {
	width: 100%;
	position: absolute;
	bottom: 0;
	margin-top: auto;
}

footer {
	display: flex;
	justify-content: center;
	align-items: center;
	background-color: #414141;
	height: 45px;
	color: white;
}

.container {
	height: 90vh;
	display: flex;
	justify-content: center;
	align-items: center;
	flex-direction: row;
	gap: 30px;
}

.box {
	text-align: center;
	height: 140px;
	width: 200px;
	padding-top: 50px;
	padding-bottom: 20px;
	padding-right: 90px;
	padding-left: 90px;
	border-radius: 10px;
	border-style: solid;
	border-color: #c6c6c6;
	border-width: 0px;
	box-shadow: 5px 5px 15px 1px rgba(0, 0, 0, 0.3);
	background-color: #ffffff;
	transition: 0.5s;



	animation: fadeInAnimation ease 1s;
	animation-iteration-count: 1;
	animation-fill-mode: forwards;
}

@keyframes fadeInAnimation {
	0% {
		opacity: 0;
	}

	100% {
		opacity: 1;
	}
}

.box:hover {
	/* 	color: white;
	background-color: #43bab6; */

}

.titletext {
	padding: 5px;
	text-decoration: none;
	border-width: 0px;
	color: white;
	background-color: #00ac8a;
	border-style: solid;
	border-radius: 3px;

}

span {
	color: #00AC8A;
	padding: 10px;
}

.uptext {
	display: flex;
	position: relative;
	left: 13px;
}

.inputstyle {
	border-bottom: 1px solid #dbdbdb;
	border-top: none;
	border-left: none;
	border-right: none;
	font-size: 18px;
	outline: none;
	background: transparent;
	outline: medium;
	width: 180px;
}

.select {
	padding: 5px;
	display: flex;
	justify-content: center
}

.select_list {
	text-align: center;
	display: block;
	width: 173px;
	
	padding: 5px;
	font-size: 16px;
	color: #333;
	line-height: 1.3;
	border: 1px solid #ccc;
	border-radius: 5px;
	box-sizing: border-box;
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	background-size: 20px;
}

.select_list::after{
	content: '';
	position: absolute;
	top: 50%;
	right: 10px;
	transform: translateY(-50%);
	width: 0;
	height: 0;
	border-style: solid;
	border-width: 8px 6px 0;
	border-color: #333 transparent transparent transparent;
}


.select_list option {
	font-size: 16px;
}

.loginbtn {
	cursor: pointer;
	border: 0;
	border-radius: 5px;
	width: 80px;
	height: 30px;
	background-color: #8049cc;
	color: white;
}

.systitle{
	color: white;
	cursor: pointer;
}

edit_classroom_info.css

* {
    margin: 0;
    padding: 0;

}

.main_content {
    height: 858px;
}

.main_content_1{
    height: auto;
}


body {
    height: auto;
    width: auto;
    background-color: #ececec;
}

.head {
    display: flex;
    /* justify-content: center; */
    justify-content: space-around;
    align-items: center;
    background: #414141;
    height: 50px;
}

nav ul li {
    list-style: none;
    display: inline-block;
}

nav ul li a {
    padding: 10px;
    color: #ffffff;
    text-decoration: none;
}


.page_title {
    text-align: center;
    /*position: relative;*/
    /*top: 10px;*/
    color: #000000;
}

h2 {
    color: #FFFFFF;
    cursor: pointer;
}

.btn {
    width: 100%;
    display: flex;
    justify-content: center;
    background-color: #414141;
    list-style: none;
    position: fixed;
    z-index: 999;
    bottom: 0;
}

footer {
    display: flex;
    justify-content: center;
    align-items: center;

    height: 45px;
    color: white;
}

.container {
    position: relative;
    top: 20px;
    height: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 25px;
    flex-direction: row;
    flex-wrap: wrap;
}

.container-week {
    position: relative;
    top: 20px;
    height: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 25px;
    flex-direction: column;
    flex-wrap: wrap;
}

.box {

    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 40px;
    width: 564px;
    padding: 20px;
    border-radius: 10px;
    border-style: solid;
    border-color: #c6c6c6;
    border-width: 0px;
    box-shadow: 5px 5px 15px 1px rgba(0, 0, 0, 0.3);
    background-color: #ffffff;
    transition: 0.5s;

    animation: fadeInAnimation ease 1s;
    animation-iteration-count: 1;
    animation-fill-mode: forwards;
}

@keyframes fadeInAnimation {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

.reservation_info_box {

    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 40px;
    width: auto;
    padding: 20px;
    border-radius: 10px;
    border-style: solid;
    border-color: #c6c6c6;
    border-width: 0px;
    box-shadow: 5px 5px 15px 1px rgba(0, 0, 0, 0.3);
    background-color: #ffffff;
    transition: 0.5s;

    animation: fadeInAnimation1 ease 1s;
    animation-iteration-count: 1;
    animation-fill-mode: forwards;
}

@keyframes fadeInAnimation1 {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}


.box:hover {
    /* 	color: white;
    background-color: #43bab6; */

}

.titletext {
    margin-left: 35px;
    height: auto;
    padding: 3px;
    text-decoration: none;
    border-width: 0px;
    color: white;
    background-color: #00ac8a;
    border-style: solid;
    border-radius: 3px;
    font-size: 20px;
}

span {
    color: #ffffff;
    font-weight: bold;
    font-size: 20px;
    text-align: center;
}

.uptext {
    display: flex;
    position: relative;
    left: 13px;
}

.inputstyle {
    border-bottom: 1px solid #dbdbdb;
    border-top: none;
    border-left: none;
    border-right: none;
    font-size: 18px;
    outline: none;
    background: transparent;
    outline: medium;
    width: 70px;
}

.select {
    padding: 5px;
    display: flex;
    justify-content: center
}

.select_list {
    text-align: center;
    display: block;
    width: 100px;

    padding: 5px;
    font-size: 16px;
    color: #333;
    line-height: 1.3;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-size: 20px;
}

.select_list_1 {
    text-align: center;
    display: block;
    width: 65px;
    padding: 5px;
    font-size: 16px;
    color: #333;
    line-height: 1.3;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-size: 20px;
}


.select_list::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 6px 0;
    border-color: #333 transparent transparent transparent;
}


.select_list option {
    font-size: 16px;
}

.page {
    position: fixed;
    text-align: center;
    bottom: 6%;
}

.pageBT {
    height: auto;
    padding: 3px;
    margin: 10px;
    text-decoration: none;
    border-width: 0;
    color: white;
    background-color: #00ac8a;
    border-style: solid;
    border-radius: 3px;
    font-size: 17px;
    cursor: pointer;
}

.editBT {
    font-family: 等线;
    height: auto;
    padding: 3px;
    text-decoration: none;
    border-width: 0px;
    color: white;
    background-color: #00ac8a;
    border-style: solid;
    border-radius: 3px;
    font-size: 20px;
    cursor: pointer;
}

.search_text {
    border: 0;
    border-radius: 5px;
    font-size: 15px;
    outline: none;
    /*background: transparent;*/
    outline: medium;
    width: 100px;
    height: auto;
    white-space: nowrap;
    font-family: inherit;
    padding: 4px 6px !important;
    box-sizing: border-box;
}

.search_img {
    height: 30px;
    width: 30px;
    position: relative;
    left: 3%;
    margin-top: 5px;
}

.search_content {
    display: flex;
    align-items: center;
}

.add_classroom_info_box {
    display: flex;
    align-items: center;
    height: 40px;
    width: auto;
    padding: 20px;
    border-radius: 10px;
    border-style: solid;
    border-color: #c6c6c6;
    border-width: 0px;
    box-shadow: 5px 5px 15px 1px rgba(0, 0, 0, 0.3);
    background-color: #ffffff;
    transition: 0.5s;

    animation: fadeInAnimation1 ease 1s;
    animation-iteration-count: 1;
    animation-fill-mode: forwards;
}

@keyframes fadeInAnimation1 {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

.addBT {
    height: auto;
    padding: 3px;
    text-decoration: none;
    border-width: 0px;
    color: white;
    background-color: #00ac8a;
    border-style: solid;
    border-radius: 3px;
    font-size: 20px;
    cursor: pointer;
    position: relative;
    left: 37.5%;
}

.top_content {
    display: flex;
    justify-content: center;
    position: relative;
    top: 10px;
}

.classroom_name {
    color: #00AC8A;
    position: relative;
    top: 1.4px;
}

.count{
    color: #ffffff;
    background: #006756;
    font-size: 20px;
}

.count-all{
    color: #ffffff;
    background: #00deaf;
    font-size: 20px;
}

editallinfo.css

* {
    margin: 0;
    padding: 0;
}

.main_content {
    height: 858px;
}

body {
    height: auto;
    width: auto;
    background-color: #ececec;
}

.head {
    display: flex;
    /* justify-content: center; */
    justify-content: space-around;
    align-items: center;
    background: #414141;
    height: 50px;
}

nav ul li {
    list-style: none;
    display: inline-block;
}

nav ul li a {
    padding: 10px;
    color: #ffffff;
    text-decoration: none;
}


.page_title {
    text-align: center;
    /*position: relative;*/
    /*top: 10px;*/
    color: #000000;
}

h2 {
    color: #FFFFFF;
    cursor: pointer;
}

.btn {
    width: 100%;
    display: flex;
    justify-content: center;
    background-color: #414141;
    list-style: none;
    position: fixed;
    z-index: 999;
    bottom: 0;
}

footer {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 45px;
    color: white;
}

.container {
    position: relative;
    top: 20px;
    height: auto;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 25px;
    flex-direction: column;
}

.box {
    display: flex;
    align-items: center;
    height: 40px;
    width: 1630px;
    padding: 20px;
    border-radius: 10px;
    border-style: solid;
    border-color: #c6c6c6;
    border-width: 0px;
    box-shadow: 5px 5px 15px 1px rgba(0, 0, 0, 0.3);
    background-color: #ffffff;
    transition: 0.5s;

    animation: fadeInAnimation ease 1s;
    animation-iteration-count: 1;
    animation-fill-mode: forwards;
}

@keyframes fadeInAnimation {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

.box:hover {
    /* 	color: white;
    background-color: #43bab6; */

}

.titletext {
    margin-left: 35px;
    height: auto;
    padding: 3px;
    text-decoration: none;
    border-width: 0px;
    color: white;
    background-color: #00ac8a;
    border-style: solid;
    border-radius: 3px;
    font-size: 20px;
}

span {
    color: #ffffff;
    font-weight: bold;
    font-size: 20px;
}

.uptext {
    display: flex;
    position: relative;
    left: 13px;
}

.inputstyle {
    border-bottom: 1px solid #dbdbdb;
    border-top: none;
    border-left: none;
    border-right: none;
    font-size: 18px;
    outline: none;
    background: transparent;
    outline: medium;
    width: 150px;
}

.select {
    padding: 5px;
    display: flex;
    justify-content: center
}

.select_list {
    text-align: center;
    display: block;
    width: 80px;

    padding: 5px;
    font-size: 16px;
    color: #333;
    line-height: 1.3;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-size: 20px;
}

.select_list_1 {
    text-align: center;
    display: block;
    width: 160px;
    padding: 5px;
    font-size: 16px;
    color: #333;
    line-height: 1.3;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-size: 20px;
}


.select_list::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 6px 0;
    border-color: #333 transparent transparent transparent;
}


.select_list option {
    font-size: 16px;
}

.page {
    position: fixed;
    bottom: 6%;
    text-align: center;

}

.pageBT {
    height: auto;
    padding: 3px;
    margin: 10px;
    text-decoration: none;
    border-width: 0;
    color: white;
    background-color: #00ac8a;
    border-style: solid;
    border-radius: 3px;
    font-size: 17px;
    cursor: pointer;
}

.editBT {
    margin-left: 5px;
    height: auto;
    padding: 3px;
    text-decoration: none;
    border-width: 0px;
    color: white;
    background-color: #00ac8a;
    border-style: solid;
    border-radius: 3px;
    font-size: 20px;
    cursor: pointer;
}

.search_text {
    border: 0;
    border-radius: 5px;
    font-size: 15px;
    outline: none;
    /*background: transparent;*/
    outline: medium;
    width: 100px;
    height: auto;
    white-space: nowrap;
    font-family: inherit;
    padding: 4px 6px !important;
    box-sizing: border-box;
}

.search_img {
    height: 30px;
    width: 30px;
    position: relative;
    left: 3%;
    margin-top: 5px;
}

.search_content {
    display: flex;
    align-items: center;
}

.add_teacher_info_box{
    display: flex;
    align-items: center;
    height: 40px;
    width: 1590px;
    padding: 20px;
    border-radius: 10px;
    border-style: solid;
    border-color: #c6c6c6;
    border-width: 0px;
    box-shadow: 5px 5px 15px 1px rgba(0, 0, 0, 0.3);
    background-color: #ffffff;
    transition: 0.5s;

    animation: fadeInAnimation1 ease 1s;
    animation-iteration-count: 1;
    animation-fill-mode: forwards;
}

@keyframes fadeInAnimation1 {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

.addBT{
    height: auto;
    padding: 3px;
    text-decoration: none;
    border-width: 0px;
    color: white;
    background-color: #00ac8a;
    border-style: solid;
    border-radius: 3px;
    font-size: 20px;
    cursor: pointer;
    position: relative;
    left: 37.5%;
}

.top_content{
    display: flex;
    justify-content: center;
    position: relative;
    top:10px;
}

editinfo.css

* {
	margin: 0;
	padding: 0;
}

body {
	height: auto;
	width: auto;
	background-color: #ececec;
}

.head {
	display: flex;
	/* justify-content: center; */
	justify-content: space-around;
	align-items: center;
	background: #414141;
	height: 50px;
}

nav ul li {
	list-style: none;
	display: inline-block;
}

nav ul li a {
	padding: 10px;
	color: #ffffff;
	text-decoration: none;
}

.title {
	color: #FFFFFF;
	cursor: pointer;
}

.btn {
	width: 100%;
	position: absolute;
	bottom: 0;
	margin-top: auto;
}

footer {
	display: flex;
	justify-content: center;
	align-items: center;
	background-color: #414141;
	height: 45px;
	color: white;
}

.container {
	height: 90vh;
	display: flex;
	justify-content: center;
	align-items: center;
	flex-direction: row;
	gap: 30px;
}

.box {
	text-align: center;
	height: 470px;
	width: 200px;
	padding-top: 20px;
	padding-bottom: 20px;
	padding-right: 90px;
	padding-left: 90px;
	border-radius: 10px;
	border-style: solid;
	border-color: #c6c6c6;
	border-width: 0px;
	box-shadow: 5px 5px 15px 1px rgba(0, 0, 0, 0.3);
	background-color: #ffffff;
	transition: 0.5s;
	/* 	z-index: 1; */
}

.box:hover {
	/* 	color: white;
	background-color: #43bab6; */

}

.titletext {
	padding: 5px;
	text-decoration: none;
	border-width: 0px;
	color: white;
	background-color: #00ac8a;
	border-style: solid;
	border-radius: 3px;

}

span {
	color: #00AC8A;
	padding: 10px;
}

.uptext {
	display: flex;
	position: relative;
	left: 13px;
}

.inputstyle {
	height: 20px;
}

.select {
	padding: 5px;
	display: flex;
	justify-content: center
}

.select_list {
	text-align: center;
	display: block;
	width: 173px;
	
	padding: 5px;
	font-size: 16px;
	color: #333;
	line-height: 1.3;
	border: 1px solid #ccc;
	border-radius: 5px;
	box-sizing: border-box;
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	background-size: 20px;
}

.select_list::after{
	content: '';
	position: absolute;
	top: 50%;
	right: 10px;
	transform: translateY(-50%);
	width: 0;
	height: 0;
	border-style: solid;
	border-width: 8px 6px 0;
	border-color: #333 transparent transparent transparent;
}


.select_list option {
	font-size: 16px;
}

.loginbtn {
	cursor: pointer;
	border: 0;
	border-radius: 5px;
	width: 80px;
	height: 30px;
	background-color: #8049cc;
	color: white;
}

.main-page{
	color: white;
	cursor: pointer;
}

INDEX.css

* {
	margin: 0;
	padding: 0;
}

body {
	height: auto;
	width: auto;
	background-color: #ececec;
}

.head {
	display: flex;
	/* justify-content: center; */
	justify-content: space-around;
	align-items: center;
	background: #414141;
	height: 50px;
}

nav ul li {
	list-style: none;
	display: inline-block;
}

nav ul li a {
	padding: 10px;
	color: #ffffff;
	text-decoration: none;
}

h1{
	text-align: center;
	position: relative;
	top: 150px;
}

h2 {
	color: #FFFFFF;
	cursor: pointer;
}

.btn {
	width: 100%;
	position: absolute;
	bottom: 0;
	margin-top: auto;
}

footer {
	display: flex;
	justify-content: center;
	align-items: center;
	background-color: #414141;
	height: 45px;
	color: white;
}

.container {
	height: 90vh;
	display: flex;
	justify-content: center;
	align-items: center;
	flex-direction: row;
	gap: 30px;
}

.box {
	text-align: center;
	height: 80px;
	width: 120px;
	padding: 20px;
	border-radius: 10px;
	border-style: solid;
	border-color: #c6c6c6;
	border-width: 0px;
	box-shadow: 5px 5px 15px 1px rgba(0, 0, 0, 0.3);
	background-color: #ffffff;
	transition: 0.5s;

	animation: fadeInAnimation ease 1s;
	animation-iteration-count: 1;
	animation-fill-mode: forwards;
}

.box-clean {
	text-align: center;
	height: 80px;
	width: auto;
	padding: 20px;
	border-radius: 10px;
	border-style: solid;
	border-color: #c6c6c6;
	border-width: 0px;
	box-shadow: 5px 5px 15px 1px rgba(0, 0, 0, 0.3);
	background-color: #ffffff;
	transition: 0.5s;

	animation: fadeInAnimation ease 1s;
	animation-iteration-count: 1;
	animation-fill-mode: forwards;
}

.box-search {
	text-align: center;
	height: 150px;
	width: 300px;
	padding: 20px;
	border-radius: 10px;
	border-style: solid;
	border-color: #c6c6c6;
	border-width: 0px;
	box-shadow: 5px 5px 15px 1px rgba(0, 0, 0, 0.3);
	background-color: #ffffff;
	transition: 0.5s;

	animation: fadeInAnimation ease 1s;
	animation-iteration-count: 1;
	animation-fill-mode: forwards;
}

@keyframes fadeInAnimation {
	0% {
		opacity: 0;
	}

	100% {
		opacity: 1;
	}
}

.box:hover {
	/* 	color: white;
	background-color: #43bab6; */

}

.titletext {
	padding: 5px;
	text-decoration: none;
	border-width: 0px;
	color: white;
	background-color: #00ac8a;
	border-style: solid;
	border-radius: 3px;

}

.title-text-search {
	padding: 5px;
	text-decoration: none;
	border-width: 0px;
	color: white;
	background-color: #00ac8a;
	border-style: solid;
	border-radius: 3px;
	font-size: 20px;
	cursor: pointer;
}

span {
	color: #000000;
	font-weight: bold;
}

.uptext {
	display: flex;
	position: relative;
	left: 13px;
}

.inputstyle {
	height: 20px;
}

.search_box{
	position: absolute;
	top: 37%;

	text-align: center;
	height: 32px;
	width: auto;
	padding: 25px;
	border-radius: 10px;
	border-style: solid;
	border-color: #c6c6c6;
	border-width: 0px;
	box-shadow: 5px 5px 15px 1px rgba(0, 0, 0, 0.3);
	background-color: #ffffff;
	transition: 0.5s;

	animation: fadeInAnimation ease 1s;
	animation-iteration-count: 1;
	animation-fill-mode: forwards;
}

.search_text{
	border-bottom: 1px solid #dbdbdb;
	border-top: none;
	border-left: none;
	border-right: none;
	font-size: 17px;
	outline: none;
	background: transparent;
	outline: medium;
	width: 80px;
	white-space: nowrap;
}

.search_img{
	height: 25px;
	width: 25px;
	position: relative;
	top: 7px;
}

.date{
	height: 30px;
	width: 180px;
	border-radius: 3px;
	font-size: 25px;
	font-family: initial;
}

login.css

* {
	margin: 0;
	padding: 0;
}

body {
	height: 100%;
	width: auto;
	background-color: #5bd7c0;
}

.head {
	display: flex;
	justify-content: space-around;
	align-items: center;
	background: #414141;
	height: 50px;
}

nav ul li {
	list-style: none;
	display: inline-block;
}

nav ul li a {
	padding: 10px;
	color: #ffffff;
	text-decoration: none;
}

h2 {
	color: #FFFFFF;
	cursor: pointer;
}

.btn {
	width: 100%;
	position: absolute;
	bottom: 0;

}


footer {
	display: flex;
	justify-content: center;
	align-items: center;
	background-color: #414141;
	height: 45px;
	color: white;
}

.container {

	height: 90vh;
	display: flex;
	justify-content: space-evenly;
	align-items: center;
	flex-direction: column;
}

.box {
	text-align: center;
	padding: 30px;
	height: 190px;
	width: 200px;
	border-radius: 10px;
	border-style: solid;
	border-color: #c6c6c6;
	border-width: 0px;
	box-shadow: 5px 5px 15px 1px rgba(0, 0, 0, 0.3);
	background-color: #ffffff;
	transition: 0.5s;
	
	animation: fadeInAnimation ease 1s;
	animation-iteration-count: 1;
	animation-fill-mode: forwards;

}

@keyframes fadeInAnimation {
	0% {
		opacity: 0;
	}

	100% {
		opacity: 1;
	}
}

.titletext {
	padding: 5px;
	text-decoration: none;
	border-width: 0px;
	color: white;
	background-color: #00ac8a;
	border-style: solid;
	border-radius: 3px;

}

span {
	color: #00AC8A;
	padding: 10px;

	transition: 0.5s ease;
	overflow: hidden;
}

span:hover {
	color: #FFFFFF;
	background-color: #00AC8A;

}

.uptext {
	display: flex;
	position: relative;
	left: 13px;

}

.inputstyle {
	height: 20px;
}

.loginbtn {
	cursor: pointer;
	border: 0;
	border-radius: 5px;
	width: 80px;
	height: 30px;
	background-color: #8049cc;
	color: white;
	margin: 5px;
}

sign.css

* {
	margin: 0;
	padding: 0;
}

body {
	height: 100%;
	width: auto;
	background-color: #009376;
}

.head {
	display: flex;
	justify-content: space-around;
	align-items: center;
	background: #414141;
	height: 50px;
}

nav ul li {
	list-style: none;
	display: inline-block;
}

nav ul li a {
	padding: 10px;
	color: #ffffff;
	text-decoration: none;
}

h2 {
	color: #FFFFFF;
	cursor: pointer;
}

.btn {
	width: 100%;
	position: absolute;
	bottom: 0;

}


footer {
	display: flex;
	justify-content: center;
	align-items: center;
	background-color: #414141;
	height: 45px;
	color: white;
}

.container {

	height: 90vh;
	display: flex;
	justify-content: space-evenly;
	align-items: center;
	flex-direction: column;
}

.box {
	text-align: center;
	height: 520px;
	width: 200px;
	padding-top: 20px;
	padding-bottom: 20px;
	padding-right: 70px;
	padding-left: 70px;
	border-radius: 10px;
	border-style: solid;
	border-color: #c6c6c6;
	border-width: 0px;
	box-shadow: 5px 5px 15px 1px rgba(0, 0, 0, 0.3);
	background-color: #ffffff;
	transition: 0.5s;
	
	animation: fadeInAnimation ease 1s;
	animation-iteration-count: 1;
	animation-fill-mode: forwards;


}


@keyframes fadeInAnimation {
	0% {
		opacity: 0;
	}

	100% {
		opacity: 1;
	}
}

.titletext {
	padding: 5px;
	text-decoration: none;
	border-width: 0px;
	color: white;
	background-color: #00ac8a;
	border-style: solid;
	border-radius: 3px;

}

span {
	color: #00AC8A;
	padding: 10px;
	transition: 0.5s ease;
	overflow: hidden;
}

span:hover {
	color: #FFFFFF;
	background-color: #00AC8A;

}

.uptext {
	display: flex;
	position: relative;
	left: 13px;

}

.inputstyle {
	height: 20px;
}

.loginbtn {
	cursor: pointer;
	border: 0;
	border-radius: 5px;
	width: 80px;
	height: 30px;
	background-color: #8049cc;
	color: white;
	margin: 5px;
}

.select {
	padding: 5px;
	display: flex;
	justify-content: center
}

.select_list {
	text-align: center;
	display: block;
	width: 173px;

	padding: 5px;
	font-size: 16px;
	color: #333;
	line-height: 1.3;
	border: 1px solid #ccc;
	border-radius: 5px;
	box-sizing: border-box;
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	background-size: 20px;
}

.select_list::after{
	content: '';
	position: absolute;
	top: 50%;
	right: 10px;
	transform: translateY(-50%);
	width: 0;
	height: 0;
	border-style: solid;
	border-width: 8px 6px 0;
	border-color: #333 transparent transparent transparent;
}


.select_list option {
	font-size: 16px;
}

teacherinfo.css

* {
	margin: 0;
	padding: 0;
}

body {
	height: auto;
	width: auto;
	background-color: #ececec;
}

.head {
	display: flex;
	/* justify-content: center; */
	justify-content: space-around;
	align-items: center;
	background: #414141;
	height: 50px;
}

nav ul li {
	list-style: none;
	display: inline-block;
}

nav ul li a {
	padding: 10px;
	color: #ffffff;
	text-decoration: none;
}

.title {
	color: #FFFFFF;
	cursor: pointer;
}

.btn {
	width: 100%;
	position: absolute;
	bottom: 0;
	margin-top: auto;
}

footer {
	display: flex;
	justify-content: center;
	align-items: center;
	background-color: #414141;
	height: 45px;
	color: white;
}

.container {
	height: 90vh;
	display: flex;
	justify-content: center;
	align-items: center;
	flex-direction: row;
	gap: 30px;
}

.box {
	text-align: center;
	height: 470px;
	width: 255px;
	padding-top: 10px;
	padding-bottom: 1px;
	padding-right: 90px;
	padding-left: 90px;
	border-radius: 10px;
	border-style: solid;
	border-color: #c6c6c6;
	border-width: 0px;
	box-shadow: 5px 5px 15px 1px rgba(0, 0, 0, 0.3);
	background-color: #ffffff;
	transition: 0.5s;
	/* 	z-index: 1; */
}

.box:hover {
	/* 	color: white;
	background-color: #43bab6; */

}

.titletext {
	padding: 5px;
	text-decoration: none;
	border-width: 0px;
	color: white;
	background-color: #00ac8a;
	border-style: solid;
	border-radius: 3px;

}

span {
	color: #00AC8A;
	padding: 10px;
}

.uptext {
	display: flex;
	position: relative;
	justify-content: flex-start;
	top: 25px;
	font-family: '仿宋';
	font-size: 21px;
}

.inputstyle {
	height: 20px;
}

.loginbtn {
	cursor: pointer;
	border: 0;
	border-radius: 5px;
	width: 80px;
	height: 30px;
	background-color: #8049cc;
	color: white;
}

button {
	width: 70px;
	position: relative;
	top: 70px;
	font-size: 15px;
	padding: 10px 0;
	background: #ffffff;
	border: 0;
	border-radius: 10px;
	outline: none;

	margin-left:10px ;
	margin-right:10px ;
	cursor: pointer;
	border-width: 0px;
	box-shadow: 5px 5px 15px 1px rgba(0, 0, 0, 0.3);

	overflow: hidden;
}


.main-page{
	color: white;
	cursor: pointer;
}

登录

登录界面

login.html

<!DOCTYPE html>
<html>
	<head>
		<link rel="stylesheet" type="text/css" href="css/login.css" />
		<meta charset="utf-8" />
		<title>欢迎使用高效实训室预约系统</title>
	</head>
	<body>
		<div class="head">
			<h2>高校实训室预约系统</h2>
		</div>

		<div class="container">
			<div class="box">
				<a class="titletext">欢&emsp;迎&emsp;使&emsp;用</a>
				<br>
				<br>
				<form action="set+userinfo+query.php" method="post">
					<p class="uptext">账&emsp;号:</p><input class="inputstyle" type="text" name="name" value="" placeholder="请输入您的账号" />
					<br>
					<p class="uptext">密&emsp;码:</p><input class="inputstyle" type="password" name="password" value="" placeholder="请输入您的密码"/>
					<br><br>
					<input type="submit" value="登&emsp;录" class="loginbtn">
					<button class="loginbtn" type="button" onclick=window.location.href='sign.html'>注&emsp;册</button>
				</form>
			</div>
		</div>

		<div class="btn">
			<footer>
				<h4>HOSTED@D3SK1NG-PROJECT+2023</h4>
			</footer>
		</div>
	</body>
</html>

接收登录信息判断

set+userinfo+query.php

<?php
@header("content-Type: text/html; charset=utf-8");
include_once("functions/database.php");

session_start();
$name = $_POST['name'];
$password = $_POST['password'];

get_connection();

$search_info = mysql_query("select * from users where name='" . $name . "'");

$implement = mysql_fetch_assoc($search_info);

if ($name == "" && $password == "") {
    echo '<script >alert("请填写完整信息");</script>';
    header("refresh:0;url=login.html");
} else {
    if ($implement > 0) {
        if ($implement['password'] == $password) {
            echo '<script >alert("登录成功");</script>';

            $_SESSION['name'] = $name;

            if ($implement['type_id'] == 2)
                header('refresh:0;url=admin_page/admin.php');
            else
                header('refresh:0;url=teacher_page/teacher.php?type_id=' . $implement['type_id'] . '&user_id=' . $implement['user_id']);
        } else {
            echo '<script >alert("密码错误,如忘记密码请联系管理员");</script>';
            header("refresh:0;url=login.html");
        }
    } else {
        echo '<script >alert("不存在此账号,请联系管理员添加");</script>';
        header("refresh:0;url=login.html");
    }
}

close_connection();

注册

注册界面

sign.html

<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" type="text/css" href="css/sign.css" />
    <meta charset="utf-8" />
    <title>WELCOME LOGIN</title>
</head>
<body>
<div class="head">
    <h2 >高校实训室预约系统</h2>
</div>

<div class="container">
    <div class="box">
        <a class="titletext">注册</a>
        <br><br>
        <form action="sign.php" method="post">
            <p class="uptext">账号:</p><input class="inputstyle" type="text" name="name" value="" placeholder="" />
            <br>
            <p class="uptext">密码:</p><input class="inputstyle" type="password" name="password" value="" />
            <br>
            <p class="uptext">专业:</p><input class="inputstyle" type="text" name="profession" value="" />
            <br>
            <p class="uptext">电话:</p><input class="inputstyle" type="text" name="tel" value="" />
            <br>
            <p class="uptext">职称:</p>
            <div class="select">
                <select class="select_list" name="title">
                    <option value="">请选择</option>
                    <option value="教授">教授</option>
                    <option value="副教授">副教授</option>
                    <option value="讲师<">讲师</option>
                    <option value="助教">助教</option>
                </select>
            </div>
            <p class="uptext">性别:</p>
            <div class="select">
                <select class="select_list" name="sex">
                    <option value="">请选择</option>
                    <option value="男">男</option>
                    <option value="女">女</option>
                </select>
            </div>
            <p class="uptext">学历:</p>
            <div class="select">
                <select class="select_list" name="education">
                    <option value="">请选择</option>
                    <option value="本科">本科</option>
                    <option value="硕士">硕士</option>
                    <option value="博士">博士</option>
                    <option value="院士">院士</option>
                </select>
            </div>
            <p class="uptext">教职工号:</p><input class="inputstyle" type="text" name="teacher_id" value="" />
            <br><br>
            <input type="submit" value="确定" class="loginbtn">
        </form>
    </div>
</div>

<div class="btn">
    <footer>
        <h4>HOSTED@D3SK1NG-PROJECT+2023</h4>
    </footer>
</div>
</body>
</html>

接收注册信息判断

sign.php

<?php
@header("content-Type: text/html; charset=utf-8");
include_once("functions/database.php");

$name = $_POST['name'];
$password = $_POST['password'];
$profession = $_POST['profession'];
$title = $_POST['title'];
$sex = $_POST['sex'];
$education = $_POST['education'];
$tel = $_POST['tel'];

$tid = $_POST['teacher_id'];

get_connection();

$search_t_tid = mysql_query("select * from teacher_id where tid='" . $tid . "'");
$search_u_tid = mysql_query("select * from users where tid='" . $tid . "'");

$implement_1 = mysql_fetch_assoc($search_t_tid);
$implement_2 = mysql_fetch_assoc($search_u_tid);

$sql = "insert into users values(null,1,'$name','$password','$profession','$title','$sex','$education','$tel','$tid')";

if ($tid == "") {
    echo '<script >alert("请输入教职工号");</script>';
    header("refresh:0;url=sign.html");
} else {
    if ($implement_1 > 0) {
        if ($implement_2 > 0) {
            echo '<script >alert("该教职工账号已注册");</script>';
            header("refresh:0;url=sign.html");
        } else {
            if
            ($name == "" || $password == "" || $profession == "" || $title == "" || $sex == "" || $education == "" || $tel == "") {
                echo '<script >alert("请填写完整信息");</script>';
                header("refresh:0;url=sign.html");
            } else {
                mysql_query($sql);
                echo '<script >alert("注册成功");</script>';
                header("refresh:0;url=login.html");
            }
        }
    } else {
        echo '<script >alert("教职工账号不存在或输入错误");</script>';
        header("refresh:0;url=sign.html");
    }
}
close_connection();

?>

退出登录

logout.php

<?php
session_start();

if (isset($_SESSION['name'])) ;
{
    session_unset();
    session_destroy();
}
header("refresh:0;url=login.html");

教师用户

用户主界面

teacher.php

<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" type="text/css" href="../css/INDEX.css"/>
    <meta charset="utf-8"/>
    <title>高校实训室管理系统</title>
</head>
<body>
<div class="head">
    <h2>高校实训室管理系统</h2>
    <div class="dhl">
        <nav>

            <ul>
                <?php include_once("../functions/forbid.php");
                $tid = $_GET["type_id"];
                $uid = $_GET["user_id"];

                echo '
                <li><a href="../teacher_page/us+show+reservation+info.php?type_id=' . $tid . '&user_id=' . $uid . '">我的预约</a></li>
                <li><a href="us_search_date.php?type_id=' . $tid . '&user_id=' . $uid . '">预约教室</a></li>
                <li><a href="../week_list/week_list_review.php?type_id=' . $tid . '&user_id=' . $uid . '">时间表</a></li>
                <li><a href="editinfo.php?type_id=' . $tid . '&user_id=' . $uid . '">信息修改</a></li>
                ';
                echo '<li><a href="teacherinfo.php?type_id=' . $tid . '&user_id=' . $uid . '">' . '欢迎登录,' . @$_SESSION['name'] . '</a></li>'; ?>
                <li><a href="../logout.php">退出</a></li>
            </ul>
        </nav>
    </div>
</div>


<div class="main_content">

    <h1>欢迎使用高校实训室预约系统</h1>
    <div class="container">
        <div class="box">
            <h3>我的预约</h3>
            <br>
            <?php
            echo '<a class=' . '"titletext"' . 'href="us+show+reservation+info.php?type_id=' . $tid . '&user_id=' . $uid . '"' . '>' . '查看' . '</a>';
            ?>
        </div>
        <div class="box">
            <h3>预约教室</h3>
            <br>
            <?php
            echo '<a class=' . '"titletext"' . 'href="us_search_date.php?type_id=' . $tid . '&user_id=' . $uid . '"' . '>' . '查看' . '</a>';
            ?>
        </div>
        <div class="box">
            <h3>时间表</h3>
            <br>
            <?php
            echo '<a class=' . '"titletext"' . 'href="../week_list/week_list_review.php?type_id=' . $tid . '&user_id=' . $uid . '"' . '>' . '查看' . '</a>';
            ?>
        </div>
        <div class="box">
            <h3>信息修改</h3>
            <br>
            <?php
            echo '<a class=' . '"titletext"' . 'href="editinfo.php?type_id=' . $tid . '&user_id=' . $uid . '"' . '>' . '进入' . '</a>';
            ?>
        </div>

    </div>

</div>

<div class="btn">
    <footer>
        <h4>HOSTED@D3SK1NG-PROJECT+2023</h4>
    </footer>
</div>
</body>
</html>

个人信息

界面

teacherinfo.php

<?php
include_once("../functions/database.php");
include_once("../functions/forbid.php");
$tid = $_GET["type_id"];
$uid = $_GET["user_id"];
?>

<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" type="text/css" href="../css/teacherinfo.css"/>
    <meta charset="utf-8"/>
    <title>高校实训室管理系统</title>
</head>
<body>
<div class="head">
    <h2 class="main-page" onclick=window.location.href='teacher.php?type_id=<?php echo $tid ?>&user_id=<?php echo $uid ?>'>
        高校实训室管理系统</h2>
        <div class="dhl">
            <nav>
                <ul>
                    <?php echo '<li><a href="editinfo.php?type_id=' . $tid . '&user_id=' . $uid . '">' . '登录账户:' . @$_SESSION['name'] . '</a></li>'; ?>
                    <li><a href="../logout.php">退出</a></li>
                </ul>
            </nav>
        </div>
</div>

<div class="main_content">
    <div class="container">
        <div class="box">
            <h2>个人信息</h2>
            <?php

            $sql = "select * from users where type_id=$tid and user_id=$uid";

            get_connection();

            $result_set = mysql_query($sql);

            close_connection();

            $row = mysql_fetch_array($result_set);

            echo '<p class="uptext">姓名:';
            echo $row['name'];
            echo '</p>';
            echo '</br>';

            echo '<p class="uptext">专业:';
            echo $row['profession'];
            echo '</p>';
            echo '</br>';

            echo '<p class="uptext">职称:';
            echo $row['title'];
            echo '</p>';
            echo '</br>';

            echo '<p class="uptext">性别:';
            echo $row['sex'];
            echo '</p>';
            echo '</br>';

            echo '<p class="uptext">学历:';
            echo $row['education'];
            echo '</p>';
            echo '</br>';

            echo '<p class="uptext">电话:';
            echo $row['tel'];
            echo '</p>';
            echo '</br>';

            echo '<button type="button"' . "onclick=window.location.href='editinfo.php?type_id=$tid&user_id=$uid'>修改</button>";

            ?>
            <button type="button" onclick=click_1()>注销</button>

            <script>
                function click_1() {
                    var confirmation = confirm('警告:是否确定注销?');
                    if (confirmation) {
                        <?php
                        echo 'window.location.href=';
                        echo '"../teacher_query/us+delete+user+query.php?type_id=' . $tid . '&user_id=' . $uid . '"';
                        ?>
                    }
                }
            </script>
            
        </div>
    </div>

</div>

<div class="btn">
    <footer>
        <h4>HOSTED@D3SK1NG-PROJECT+2023</h4>
    </footer>
</div>
</body>
</html>
注销逻辑

us+delete+user+query.php

<?php
@header("content-Type: text/html; charset=utf-8");
include_once("functions/database.php");

    $tid = $_GET["type_id"];
    $uid = $_GET["user_id"];

    $sql = "delete from users where type_id=$tid and user_id=$uid ";

get_connection();

$result_set = mysql_query($sql);

echo '<script >alert("已注销账号");</script>';
header('refresh:0;url=login.html');

close_connection();

我的预约

界面

us+show+reservation+info.php

<?php
$tid = $_GET["type_id"];
$uid = $_GET["user_id"];
include_once("../functions/database.php");
include_once("../functions/forbid.php");
?>

<!DOCTYPE html>
<html lang="ch">
<head>
    <link rel="stylesheet" type="text/css" href="../css/edit_classroom_info.css"/>
    <meta charset="utf-8"/>
    <title>高校实训室管理系统</title>
</head>
<body>
<div class="head">
    <h2 onclick=window.location.href='teacher.php?type_id=<?php echo $tid ?>&user_id=<?php echo $uid ?>'>
        高校实训室管理系统</h2>
    <div class="dhl">
        <nav>
            <ul>
                <?php echo '<li><a href="editinfo.php?type_id=' . $tid . '&user_id=' . $uid . '">' . '登录账户:' . @$_SESSION['name'] . '</a></li>'; ?>
                <li><a href="../logout.php">退出</a></li>
            </ul>
        </nav>
    </div>
</div>

<div class="main_content_1">

    <div class="top_content">
        <h2 class="page_title">预约信息</h2>
    </div>

    <div class="container">
        <?php
        @header("content-Type: text/html; charset=utf-8");
        $teacher = @$_SESSION['name'];

        get_connection();

        $result_set = mysql_query("select * from reservation_info where teacher='" . $teacher . "'");

        close_connection();

        while ($row = mysql_fetch_array($result_set)) {

            echo '<form action="../teacher_query/us+delete+reservation_info_query.php?type_id=' . $tid . '&user_id=' . $uid . '"';
            echo 'method="post">';

            echo '<div class="reservation_info_box">';

            echo '<table border="0">';

            echo '<tr>';

            echo '<td>';

            echo '<h3>实训室:<span class="classroom_name">' . $row['classroom_name'] . '</span></h3>  ';

            echo '</td>';

            echo '<td>';

            if ($row['time_type'] == 1)
                $time_period = '08:20-10:00';
            elseif ($row['time_type'] == 2)
                $time_period = '10:20-12:00';
            elseif ($row['time_type'] == 3)
                $time_period = '14:30-16:10';
            elseif ($row['time_type'] == 4)
                $time_period = '16:30-18:00';

            echo '<h3>时间段:<span class="classroom_name">' . $time_period . '</span></h3>  ';

            echo '</td>';
            
            echo '<td>';

            $week_array=array("一","二","三","四","五","六","日");
            $week=$week_array[date("w",strtotime($row['date']))];
            echo '<h3>日期:<span class="classroom_name">' .  '星期'.$week . '</span></h3>  ';

            echo '</td>';

            echo '<td>';

            if ($row['status'] == 'PASS') {
                $status = '通&emsp;过';
                $color = 'mediumseagreen';
            } elseif ($row['status'] == 'FAIL') {
                $status = '未通过';
                $color = 'red';
            } elseif ($row['status'] == 'APPLYING') {
                $status = '申请中';
                $color = 'gold';
            }

            echo '<h3>&emsp;状态:<span  style="color:';
            echo ' ' . $color . '" >';
            echo $status;
            echo '</span></h3>';

            echo '</td>';
            echo '</tr>';
            echo '</table>';

            echo '<input type="hidden" name="classroom_name" value="' . $row['classroom_name'] . '">';
            echo '<input type="hidden" name="teacher" value="' . $row['teacher'] . '">';
            echo '<input type="hidden" name="status" value="' . $status . '">';
            echo '<input type="hidden" name="date" value="' . $row['date']. '">';


            if ($status == '未通过')
                echo ' <br >&emsp; <input type="submit" value="删除" onclick="return confirm(' . "'是否确定删除该预约?'" . ')" class="editBT">';
            else
                echo ' <br >&emsp; <input type="submit" value="取消" onclick="return confirm(' . "'是否确定取消该预约?'" . ')" class="editBT">';

            echo '</div >
            </form>';

        }

        ?>
    </div>
</div>
<div class="btn">
    <footer>
        <h4>HOSTED@D3SK1NG-PROJECT+2023</h4>
    </footer>
</div>
</body>
</html>
取消通过或申请中的预约,删除未通过的预约

us+delete+reservation_info_query.php

<?php
@header("content-Type: text/html; charset=utf-8");
include_once("../functions/database.php");

$tid = $_GET["type_id"];
$uid = $_GET["user_id"];

$classroom_name = $_POST["classroom_name"];
$teacher = $_POST["teacher"];
$status = $_POST["status"];
$date=$_POST['date'];

$delete_sql = "delete from reservation_info where classroom_name='$classroom_name' and teacher='$teacher' and date='$date' ";

$update_sql = "update classroom_info set availability='YES' where name='$classroom_name' and date='$date'";

get_connection();

mysql_query($update_sql);
mysql_query($delete_sql);

if ($status == '未通过')
    echo '<script >alert("已删除预约");</script>';
else
    echo '<script >alert("已取消预约");</script>';

header('refresh:0;url=../teacher_query/check+reservation+info+query.php?type_id=' . $tid . '&user_id=' . $uid . '');

close_connection();


判断有无预约信息

check+reservation+info+query.php

<?php

session_start();

@header("content-Type: text/html; charset=utf-8");
include_once("../functions/database.php");
$tid = $_GET['type_id'];
$uid = $_GET['user_id'];

$teacher = @$_SESSION['name'];

get_connection();

$search_teacher_r_info = mysql_query("select * from reservation_info where teacher='" . $teacher . "'");

$implement_1 = mysql_fetch_assoc($search_teacher_r_info);

close_connection();

if ($implement_1 < 1) {
    echo '<script >alert("您并未预约教室");</script>';
    header("refresh:0;url=teacher_page/teacher.php?type_id=$tid&user_id=$uid");
} else {
    header("refresh:0;url=teacher_page/us+show+reservation+info.php?type_id=$tid&user_id=$uid");
}

预约教室

日期选择

us_search_date.php

<?php
include_once("../functions/forbid.php");
$tid = $_GET["type_id"];
$uid = $_GET["user_id"];
?>
<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" type="text/css" href="../css/INDEX.css"/>
    <meta charset="utf-8"/>
    <title>高校实训室管理系统</title>
</head>
<body>
<div class="head">
    <h2 onclick=window.location.href='teacher.php?type_id=<?php echo $tid ?>&user_id=<?php echo $uid ?>'>
        高校实训室管理系统</h2>
    <div class="dhl">
        <nav>
            <ul>
                <?php
                echo '<li><a href="teacherinfo.php?type_id=' . $tid . '&user_id=' . $uid . '">' . '登录账户:' . @$_SESSION['name'] . '</a></li>';
                ?>
                <li><a href="../logout.php">退出</a></li>
            </ul>
        </nav>
    </div>
</div>

<div class="main_content">

    <h1>请输入预约日期</h1>
    <div class="container">
        <div class="box-search">
           <?php
            echo '<form method="POST" action="../teacher_query/us_set+date+query.php?type_id=' . $tid . '&user_id=' . $uid . '&page=1">';
            ?>
            <h3>日期选择</h3>
            <br>
            <label>
                <?php
            // 获取当前日期
            $current_date = date("Y-m-d");

            // 计算 min 日期(当前日期)
            $min_date = $current_date;

            // 计算 max 日期(当前日期 + 6天)
            $max_date = date("Y-m-d", strtotime($current_date . "+6 days"));
            ?>
                <input type="date" name="date" value="<?php echo $current_date; ?>" class="date"
                       min="<?php echo $min_date; ?>" max="<?php echo $max_date; ?>">
            </label>
            <br><br>
            <input type="submit" value="查询" class="title-text-search">
            <?php
            echo '</form>';
            ?>
        </div>
    </div>
</div>

<div class="btn">
    <footer>
        <h4>HOSTED@D3SK1NG-PROJECT+2023</h4>
    </footer>
</div>
</body>
</html>
接收所选日期判断跳转

us_set+date+query

<?php
@header("content-Type: text/html; charset=utf-8");
include_once("../functions/database.php");

$tid = $_GET["type_id"];
$uid = $_GET["user_id"];
$date = $_POST["date"];

get_connection();

$result_set = mysql_query("select * from classroom_info where date='$date'");

close_connection();

$implement = mysql_fetch_assoc($result_set);
if ($implement > 0) {
    header('refresh:0;url=../teacher_page/show+all+classroom+info.php?date=' . $date . '&type_id=' . $tid . '&user_id=' . $uid . '&page=1');
} else {
    echo '<script >alert("暂无实训室信息");</script>';
    header('refresh:0;url=../teacher_page/teacher.php?type_id=' . $tid . '&user_id=' . $uid);
}
预约界面

show+all+classroom+info.php

<?php
include_once("../functions/forbid.php");
$tid = $_GET["type_id"];
$uid = $_GET["user_id"];
$date = $_GET["date"];

?>
<!DOCTYPE html>
<html lang="ch">
<head>
    <link rel="stylesheet" type="text/css" href="../css/edit_classroom_info.css"/>
    <meta charset="utf-8"/>
    <title>高校实训室管理系统</title>
</head>
<body>
<div class="head">
    <h2 onclick=window.location.href='teacher.php?type_id=<?php echo $tid ?>&user_id=<?php echo $uid ?>'>
        高校实训室管理系统</h2>

    <?php echo '<form action="../teacher_page/us+search+classroom_name+query.php?date='.$date.'&type_id='.$tid.'&user_id='.$uid.'" method="post">' ?>
        <div class="search_content">
            <span>搜索教室:</span>
            <input class="search_text" type="text" name="result" id="">
            <input class="search_img" type="image" src="../img/search_1.png" alt="submit">
        </div>
    </form>
    
    <div class="dhl">
        <nav>
            <ul>
                <?php
                echo '<li><a href="teacherinfo.php?type_id=' . $tid . '&user_id=' . $uid . '">' . '登录账户:' . @$_SESSION['name'] . '</a></li>';
                ?>
                <li><a href="../logout.php">退出</a></li>
            </ul>
        </nav>
    </div>
</div>


<div class="main_content">

    <div class="top_content">

        <h1><?php
            $week_array=array("日","一","二","三","四","五","六");
            $week=$week_array[date("w",strtotime($date))];

            echo  '本周星期'.$week ?>的实训室信息</h1>

    </div>

    <div class="container">
        <?php
        include_once("../functions/database.php");


        @$page = $_GET['page'];
        if ($page == 0 && empty($page)) {
            $page = 1;
        }
        $page_size = 21;
        $page_set = ($page - 1) * $page_size;

        get_connection();

        $result_set = mysql_query("select * from classroom_info where date='$date' order by availability='YES' DESC,name limit {$page_set},{$page_size}");

        $count_query = mysql_query("select count(1) from classroom_info where date='$date'");

        close_connection();

        while ($row = mysql_fetch_array($result_set)) {


            echo '<form action="../teacher_query/submit+reservation+info+query.php?classroom_name=' . $row['name'] . '&teacher=' . @$_SESSION['name'] . '"';
            echo 'method="post">';

            echo '<div class="box">';

            echo '<table border="0">';

            echo '<tr>';

            echo '<td>';

            echo '<h3>实训室:<span class="classroom_name">' . $row['name'] . '</span></h3>  ';

            echo '</td>';

            if ($row['availability'] == 'YES')
                $availability = '可&emsp;用';
            elseif ($row['availability'] == 'NO')
                $availability = '不可用';

            echo '<input type="hidden" name="ava" value="' . $row['availability'] . '">';
            echo '<input type="hidden" name="tid" value="' . $tid . '">';
            echo '<input type="hidden" name="uid" value="' . $uid . '">';
            echo '<input type="hidden" name="time_type" value="' . $row['time_type'] . '">';
            echo '<input type="hidden" name="date" value="' . $date. '">';

            echo '<td>';

            if ($availability == '可&emsp;用')
                $color = 'mediumseagreen';
            elseif ($availability == '不可用')
                $color = 'red';

            echo '<h3>&emsp;状态:<span  style="color:';
            echo ' ' . $color . '" >';
            echo $availability;
            echo '</span></h3>';

            echo '</td>';

            if ($row['time_type'] == 1)
                $time_period = '08:20-10:00';
            elseif ($row['time_type'] == 2)
                $time_period = '10:20-12:00';
            elseif ($row['time_type'] == 3)
                $time_period = '14:30-16:10';
            elseif ($row['time_type'] == 4)
                $time_period = '16:30-18:00';

            echo '<td>';

            echo '<h3>&emsp;时间段:<span class="classroom_name">' . $time_period . '</span></h3>';

            echo '</td>';

            echo '<td>';

            echo '</td>';

            echo '</tr>';
            echo '</table>';

            echo ' <br >&nbsp; &nbsp; <input type="submit" value="预约" class="editBT">';

            echo '</div >
            </form>';

        }

        $row_1 = mysql_fetch_row($count_query);

        $record_count = $row_1[0];

        if ($record_count == 0) {
            $page_count = 0;
        } else if ($record_count < $page_size || $record_count == $page_size) {
            $page_count = 1;
        } else if ($record_count % $page_size == 0) {
            $page_count = $record_count / $page_size;
        } else {
            $page_count = (int)($record_count / $page_size) + 1;
        }

        echo '<div class="page">';

        echo "<h4>当前" . $page . "/" . $page_count . "</h4></br>";

        if ($page == 1) {
            echo("<a class='pageBT' onclick=" . "alert('已经是最新一页')" . ">第一页</a>");
        } else
            echo("<a class='pageBT' href=show+all+classroom+info.php?date=$date&type_id=$tid&user_id=$uid&page=1>第一页</a>");
        //设置上一页连接

        if ($page == 1) {
            echo("<a class='pageBT' onclick=" . "alert('已经是最新一页')" . ">上一页</a>");
        } else
            echo("<a class='pageBT' href=show+all+classroom+info.php?date=$date&type_id=$tid&user_id=$uid&page=" . ($page - 1) . ">上一页</a>");

        //设置下一页链接
        if ($page == $page_count) {
            echo("<a class='pageBT' onclick=" . "alert('已经是最后一页')" . ">下一页</a>");
        } else
            echo("<a class='pageBT' href=show+all+classroom+info.php?date=$date&type_id=$tid&user_id=$uid&page=" . ($page + 1) . ">下一页</a>");
        //设置最后一页
        if ($page == $page_count) {
            echo("<a class='pageBT' onclick=" . "alert('已经是最后一页')" . ">末尾页</a>");
        } else
            echo("<a class='pageBT' href=show+all+classroom+info.php?date=$date&type_id=$tid&user_id=$uid&page=" . $page_count . ">末尾页</a>");

        echo '</div>';

        ?>
    </div>
</div>
<div class="btn">
    <footer>
        <h4>HOSTED@D3SK1NG-PROJECT+2023</h4>
    </footer>
</div>
</body>
</html>
接收预约申请信息判断

submit+reservation+info+query.php

<?php
@header("content-Type: text/html; charset=utf-8");
include_once("../functions/database.php");

$classroom_name = $_GET['classroom_name'];
$teacher = $_GET['teacher'];
$availability = $_POST['ava'];
$type_id = $_POST['tid'];
$user_id = $_POST['uid'];
$time_type = $_POST['time_type'];
$date = $_POST['date'];

$insert_sql = "insert into reservation_info values('$teacher','$classroom_name','APPLYING','$date',$time_type)";

get_connection();

$select_sql = mysql_query("select * from reservation_info where classroom_name='$classroom_name' and date='$date'");

$implement_1 = mysql_num_rows($select_sql);

$row = mysql_fetch_array($select_sql);

if ($availability == 'NO') {
    echo '<script >alert("该教室已被预约或维护中");</script>';
} else {
    if ($implement_1 > 0) {
        if ($teacher == $row['teacher']) {
            echo '<script >alert("您已预约过此教室,预约状态请在主页查看");</script>';
        } else {
            echo '<script >alert("此教室已被' . $row['teacher'] . '老师预约");</script>';
        }
    } else {
        mysql_query($insert_sql);
        echo '<script >alert("预约成功,请等待管理员审核");</script>';
    }
}
close_connection();
header('refresh:0;url=../teacher_page/show+all+classroom+info.php?date='.$date.'&type_id=' . $type_id . '&user_id=' . $user_id . '&page=1');
搜索并显示相应教室信息

us+search+classroom_name+query.php

<?php
include_once("../functions/database.php");
include_once("../functions/forbid.php");
$tid = $_GET['type_id'];
$uid = $_GET['user_id'];
$date = $_GET['date'];
?>
<!DOCTYPE html>
<html lang="ch">
<head>
    <link rel="stylesheet" type="text/css" href="../css/edit_classroom_info.css"/>
    <meta charset="utf-8"/>
    <title>高校实训室管理系统</title>
</head>
<body>
<div class="head">
    <h2 onclick=window.location.href='../teacher_page/teacher.php?type_id=<?php echo $tid ?>&user_id=<?php echo $uid ?>'>
        高校实训室管理系统</h2>


    <?php echo '<form action="us+search+classroom_name+query.php?date=' . $date . '&type_id=' . $tid . '&user_id=' . $uid . '" method="post">' ?>
    <div class="search_content">
        <span>搜索教室:</span>
        <input class="search_text" type="text" name="result" id="">
        <input class="search_img" type="image" src="../img/search_1.png" alt="submit">
    </div>
    </form>

    <div class="dhl">
        <nav>
            <ul>
                <?php echo '<li><a href="editinfo.php?type_id=' . $tid . '&user_id=' . $uid . '">' . '登录账户:' . @$_SESSION['name'] . '</a></li>'; ?>
                <li><a href="../logout.php">退出</a></li>
            </ul>
        </nav>
    </div>
</div>


<div class="main_content">
    <div class="top_content">
        <h2 class="page_title">搜索结果</h2>
    </div>
    <div class="container">
        <?php

        @header("content-Type: text/html; charset=utf-8");

        $search_result = $_POST['result'];

        if ($search_result == '') {
            echo '<script >alert("信息不能为空");</script>';
            header("refresh:0;url=../teacher_page/show+all+classroom+info.php?date=$date&type_id=$tid&user_id=$uid&page=1");
        } else {

            get_connection();

            $result = mysql_query("select * from classroom_info where name like  '$search_result%' and date like '$date%' ");

            if (mysql_num_rows($result) < 1) {
                echo '<script >alert("教室信息不存在");</script>';
                header("refresh:0;url=../teacher_page/show+all+classroom+info.php?date=$date&type_id=$tid&user_id=$uid&page=1");
            } else {
                while ($row = mysql_fetch_array($result)) {

                    echo '<form action="../teacher_query/submit+reservation+info+query.php?classroom_name=' . $row['name'] . '&teacher=' . @$_SESSION['name'] . '"';
                    echo 'method="post">';

                    echo '<div class="box">';

                    echo '<table border="0">';

                    echo '<tr>';

                    echo '<td>';

                    echo '<h3>实训室:<span class="classroom_name">' . $row['name'] . '</span></h3>  ';

                    echo '</td>';

                    if ($row['availability'] == 'YES')
                        $availability = '可&emsp;用';
                    elseif ($row['availability'] == 'NO')
                        $availability = '不可用';

                    echo '<input type="hidden" name="ava" value="' . $row['availability'] . '">';
                    echo '<input type="hidden" name="tid" value="' . $tid . '">';
                    echo '<input type="hidden" name="uid" value="' . $uid . '">';
                    echo '<input type="hidden" name="time_type" value="' . $row['time_type'] . '">';
                    echo '<input type="hidden" name="date" value="' . $date . '">';

                    echo '<td>';


                    if ($availability == '可&emsp;用')
                        $color = 'mediumseagreen';
                    elseif ($availability == '不可用')
                        $color = 'red';

                    echo '<h3>&emsp;状态:<span  style="color:';
                    echo ' ' . $color . '" >';
                    echo $availability;
                    echo '</span></h3>';

                    echo '</td>';

                    if ($row['time_type'] == 1)
                        $time_period = '08:20-10:00';
                    elseif ($row['time_type'] == 2)
                        $time_period = '10:20-12:00';
                    elseif ($row['time_type'] == 3)
                        $time_period = '14:30-16:10';
                    elseif ($row['time_type'] == 4)
                        $time_period = '16:30-18:00';

                    echo '<td>';

                    echo '<h3>&emsp;时间段:<span class="classroom_name">' . $time_period . '</span></h3>';

                    echo '</td>';

                    echo '<td>';
                    
                    echo '</td>';

                    echo '</tr>';
                    echo '</table>';

                    echo ' <br >&nbsp; &nbsp; <input type="submit" value="预约" class="editBT">';

                    echo '</div >
            </form>';

                }
            }
            close_connection();
        }
        ?>
    </div>
</div>

<div class="btn">
    <footer>
        <h4>HOSTED@D3SK1NG-PROJECT+2023</h4>
    </footer>
</div>
</body>
</html>

时间表

week_list_review.php

<?php
include_once("../functions/forbid.php");
$tid = $_GET["type_id"];
$uid = $_GET["user_id"];
?>

<!DOCTYPE html>
<html lang="ch">
<head>
    <link rel="stylesheet" type="text/css" href="../css/edit_classroom_info.css"/>
    <meta charset="utf-8"/>
    <title>高校实训室管理系统</title>
</head>
<body>
<div class="head">
    <h2 onclick=window.location.href='../teacher_page/teacher.php?type_id=<?php echo $tid ?>&user_id=<?php echo $uid ?>'>
        高校实训室管理系统</h2>

    <div class="dhl">
        <nav>
            <ul>
                <?php echo '<li><a href="../teacher_page/editinfo.php?type_id=' . $tid . '&user_id=' . $uid . '">' . '登录账户:' . @$_SESSION['name'] . '</a></li>'; ?>
                <li><a href="../logout.php">退出</a></li>
            </ul>
        </nav>
    </div>
</div>


<div class="main_content_1">

    <div class="top_content">
        <h2 class="page_title">时间表</h2>
    </div>

    <div class="container-week">
        <?php
        @header("content-Type: text/html; charset=utf-8");
        include_once("../functions/database.php");
        include_once("../functions/forbid.php");

        $teacher = @$_SESSION['name'];

        $start_date = date("Y-m-d");//9999-99-99
        $end_date = date("Y-m-d", strtotime("+6 days"));//9999-99-99+6

        $start_time = strtotime($start_date);//string
        $end_time = strtotime($end_date);//string

        $middle = $start_time;

        $current_week_start = strtotime('this week');
        $next_week_start = strtotime('next week');

        while ($middle <= $end_time) {
            $week_array = array("日", "一", "二", "三", "四", "五", "六");
            $week_num = date('w', $middle);//1234567
            $week_num_day = date('Y-m-d', $middle);//9999-99-99
            $chinese_week = $week_array[$week_num];

            get_connection();

            $result_set = mysql_query("select count(1) from classroom_info where date = '$week_num_day' and availability='YES'");
            $result_set_all = mysql_query("select count(1) from classroom_info where date = '$week_num_day'");

            close_connection();


            echo '<form action="../teacher_query/us_set+date+query.php?type_id=' . $tid . '&user_id=' . $uid . '&page=1"';
            echo 'method="post">';

            echo '<div class="reservation_info_box">';

            echo '<table border="0">';
            echo '<tr>';
            echo '<td>';


            echo '日期:', $week_num_day, ' 星期', $chinese_week, ' ';
            $middle = strtotime('+1 day', $middle);

            if ($middle > $current_week_start && $middle < $next_week_start) {
                echo '本周';
            } else {
                echo '下周';
            }

            echo '<td>';

            while ( $row = mysql_fetch_row($result_set)){
                $count=$row[0];
                $format_count=str_pad($count,2,"0",STR_PAD_LEFT);
                echo '&emsp;可用/总量→&emsp;';
                echo '<span class='.'count'.'>'.  $format_count.'</span>';
            }
            while ( $row_all = mysql_fetch_row($result_set_all)){
                $count_all=$row_all[0];
                $format_count_all=str_pad($count_all,2,"0",STR_PAD_LEFT);
                echo '<span class='.'count-all'.'>'.'/'.$format_count_all.'</span>';
            }

            echo '</td>';

            echo '<td>';
            echo '<input type="hidden" name="date" value="' . $week_num_day . '">';
            echo '&emsp;<input type="submit" value="详情" class="editBT">';
            echo '</td>';

            echo '<td>';

            echo '</td>';

            echo '</td>';
            echo '</tr>';
            echo '</table>';

            echo '</div >
            </form>';

        }

        ?>
    </div>
</div>
<div class="btn">
    <footer>
        <h4>HOSTED@D3SK1NG-PROJECT+2023</h4>
    </footer>
</div>
</body>
</html>

信息修改

界面

editinfo.php

<?php
include_once("../functions/forbid.php");
$tid = $_GET["type_id"];
$uid = $_GET["user_id"];
?>
<!DOCTYPE html>
<html lang="CN">
<head>
    <link rel="stylesheet" type="text/css" href="../css/editinfo.css"/>
    <meta charset="utf-8"/>
    <title>高校实训室管理系统</title>
</head>
<body>
<div class="head">
    <h2 class="main-page" onclick=window.location.href='teacher.php?type_id=<?php echo $tid ?>&user_id=<?php echo $uid ?>'>
        高校实训室管理系统</h2>
    <div class="dhl">
        <nav>
            <ul>
                <?php echo '<a style="color: white">登录账户:' . @$_SESSION['name'] . ' </a>'; ?>
                <li><a href="../logout.php">退出</a></li>
            </ul>
        </nav>
    </div>
</div>


<div class="main_content">
    <div class="container">
        <div class="box">
            <h2>信息编辑</h2>
            <?php

            echo '<form action="teacher+edit+query.php?type_id=' . $tid . '&user_id=' . $uid . '" method="post">';
            ?>
            <p class="uptext">姓名:</p><input class="inputstyle" type="text" name="name" value=""/>
            <br>
            <p class="uptext">密码:</p><input class="inputstyle" type="password" name="password" value=""/>
            <br>
            <p class="uptext">专业:</p><input class="inputstyle" type="text" name="profession" value=""/>
            <br>
            <p class="uptext">电话:</p><input class="inputstyle" type="text" name="tel" value=""/>
            <br>
            <p class="uptext">职称:</p>
            <div class="select">
                <select class="select_list" name="title">
                    <option value="">请选择</option>
                    <option value="教授">教授</option>
                    <option value="副教授">副教授</option>
                    <option value="讲师<">讲师</option>
                    <option value="助教">助教</option>
                </select>
            </div>
            <p class="uptext">性别:</p>
            <div class="select">
                <select class="select_list" name="sex">
                    <option value="">请选择</option>
                    <option value="男">男</option>
                    <option value="女">女</option>
                </select>
            </div>
            <p class="uptext">学历:</p>
            <div class="select">
                <select class="select_list" name="education">
                    <option value="">请选择</option>
                    <option value="本科">本科</option>
                    <option value="硕士">硕士</option>
                    <option value="博士">博士</option>
                    <option value="院士">院士</option>
                </select>
            </div>
            <br>
            <input type="submit" value="保存" class="loginbtn">
            </form>
        </div>
    </div>

</div>

<div class="btn">
    <footer>
        <h4>HOSTED@D3SK1NG-PROJECT+2023</h4>
    </footer>
</div>
</body>
</html>
接收信息后执行修改

teacher+edit+query.php

	<?php
        @header("content-Type: text/html; charset=utf-8");
        include_once("functions/database.php");

            $tid=$_GET["type_id"];
            $uid=$_GET["user_id"];

            $name=$_POST['name'];
            $password=$_POST['password'];
            $profession=$_POST['profession'];
            $title=$_POST['title'];
            $sex=$_POST['sex'];
            $education=$_POST['education'];
			$tel=$_POST['tel'];

        $sql = "update users set name='$name',password='$password',profession='$profession',title='$title',sex='$sex',education='$education',tel='$tel' where type_id=$tid and user_id=$uid";

		get_connection();

		mysql_query($sql);
		    echo '<script >alert("修改成功,请重新登录");</script>';
			header('refresh:0;url=logout.php');
		close_connection();

管理员用户

用户主界面

admin.php

<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" type="text/css" href="../css/INDEX.css"/>
    <meta charset="utf-8"/>
    <title>高校实训室管理系统</title>
</head>
<body>
<div class="head">
    <h2>高校实训室管理系统</h2>
    <div class="dhl">
        <nav>
            <ul>
                <?php
                include_once("../functions/forbid.php");
                echo '<a style="color: white">欢迎登录,' . @$_SESSION['name'].' </a>';
                ?>
                <li><a href="../logout.php">退出</a></li>
            </ul>
        </nav>
    </div>
</div>


<div class="main_content">

    <h1>欢迎使用高校实训室预约系统</h1>
    <div class="container">
        
        <div class="box">
            <h3>预约信息审核</h3>
            <br>
            <a class="titletext" href="../admin_page/ad+all+reservation+info+review.php">进入</a>
        </div>
        <div class="box">
            <h3>教室信息修改</h3>
            <br>
            <a class="titletext" href="../admin_page/ad_search_date.php">进入</a>
        </div>
        <div class="box-clean">
            <h3>清除过期实训室信息</h3>
            <br>
            <a class="titletext" href="../admin_query/clean+expiration+info+query.php">执行</a>
        </div>
        <div class="box">
            <h3>教师信息修改</h3>
            <br>
            <a class="titletext" href="../admin_page/edit+all+user+info.php?page=1">进入</a>
        </div>
        <div class="box">
            <h3>教职工号添加</h3>
            <br>
            <a class="titletext" href="add+teacher+id.php">进入</a>
        </div>
        
    </div>

</div>

<div class="btn">
    <footer>
        <h4>HOSTED@D3SK1NG-PROJECT+2023</h4>
    </footer>
</div>
</body>
</html>

预约信息审核

界面

ad+all+reservation+info+review.php

<!DOCTYPE html>
<html lang="ch">
<head>
    <link rel="stylesheet" type="text/css" href="../css/edit_classroom_info.css"/>
    <meta charset="utf-8"/>
    <title>高校实训室管理系统</title>
</head>
<body>
<div class="head">
    <h2 onclick=window.location.href='admin.php'>
        高校实训室管理系统</h2>

    <form action="../admin_page/ad+search+reservation+info+review.php" method="post">
        <div class="search_content">
            <span>搜索教室/教师:</span>
            <input class="search_text" type="text" name="result" id="">
            <input class="search_img" type="image" src="../img/search_1.png" alt="submit">
        </div>
    </form>

    <div class="dhl">
        <nav>
            <ul>
                <?php
                include_once("../functions/forbid.php");
                echo '<a style="color: white">登录账户:' . @$_SESSION['name'].' </a>';
                ?>
                <li><a href="../logout.php">退出</a></li>
            </ul>
        </nav>
    </div>
</div>

<div class="main_content">

    <div class="top_content">
        <h2 class="page_title">预约信息审核</h2>
    </div>

    <div class="container">
        <?php
        @header("content-Type: text/html; charset=utf-8");

        include_once("../functions/database.php");
        include_once("../functions/forbid.php");

        get_connection();

        $result_set = mysql_query("select * from reservation_info where status='APPLYING'");

        $content_result_set = mysql_num_rows($result_set);

        close_connection();

        if ($content_result_set > 0) {

            while ($row = mysql_fetch_array($result_set)) {

                echo '<form action="../admin_query/pass+query.php"';
                echo 'method="post">';

                echo '<div class="reservation_info_box">';

                echo '<table border="0">';

                echo '<tr>';

                echo '<td>';

                echo '<h3>实训室:<span class="classroom_name">' . $row['classroom_name'] . '</span></h3>  ';

                echo '</td>';

                echo '<td>';

                echo '<h3>申请人:<span class="classroom_name">' . $row['teacher'] . '</span></h3>  ';

                echo '</td>';

                echo '<td>';

                $week_array=array("一","二","三","四","五","六","日");
                $week=$week_array[date("w",strtotime($row['date']))];
                echo '<h3>日期:<span class="classroom_name">' .  '星期'.$week . '</span></h3>  ';

                echo '</td>';

                echo '<td>';

                if ($row['time_type'] == 1)
                    $time_period = '08:20-10:00';
                elseif ($row['time_type'] == 2)
                    $time_period = '10:20-12:00';
                elseif ($row['time_type'] == 3)
                    $time_period = '14:30-16:10';
                elseif ($row['time_type'] == 4)
                    $time_period = '16:30-18:00';

                echo '<h3>&emsp;时间段:<span class="classroom_name">' . $time_period . '</span></h3>  ';

                echo '</td>';

                echo '</tr>';
                echo '</table>';

                echo '<input type="hidden" name="classroom_name" value="' . $row['classroom_name'] . '">';
                echo '<input type="hidden" name="teacher" value="' . $row['teacher'] . '">';
                echo '<input type="hidden" name="date" value="' . $row['date'] . '">';
                echo '<input type="hidden" name="time_type" value="' . $row['time_type'] . '">';

                echo ' <br >&emsp; <input type="submit" value="通过" class="editBT">';

                echo '&emsp;<button type="submit" formaction="../admin_query/fail+query.php" class="editBT" onclick="return confirm(' . "'是否确定拒绝该预约申请?'" . ')">拒绝</button>';

                echo '</div >
            </form>';

            }
        } else {
            echo '<script >alert("暂无预约信息");</script>';
            header("refresh:0;url=admin.php");
        }

        ?>
    </div>
</div>
<div class="btn">
    <footer>
        <h4>HOSTED@D3SK1NG-PROJECT+2023</h4>
    </footer>
</div>
</body>
</html>
通过预约

pass+query.php

<?php
@header("content-Type: text/html; charset=utf-8");
include_once("../functions/database.php");

$classroom_name=$_POST['classroom_name'];
$teacher=$_POST['teacher'];
$date=$_POST['date'];
$time_type=$_POST['time_type'];

get_connection();

mysql_query("update reservation_info set status='PASS' where classroom_name='$classroom_name' and teacher='$teacher' and date='$date' and time_type=$time_type");

mysql_query("update classroom_info set availability='NO' where name='$classroom_name' and date='$date'");

echo '<script >alert("执行成功");</script>';

header('refresh:0;url=../admin_page/ad+all+reservation+info+review.php');

close_connection();

拒绝预约

fail+query.php

<?php
@header("content-Type: text/html; charset=utf-8");
include_once("../functions/database.php");

$classroom_name=$_POST['classroom_name'];
$teacher=$_POST['teacher'];
$date=$_POST['date'];
$time_type=$_POST['time_type'];

get_connection();

mysql_query("update reservation_info set status='FAIL' where classroom_name='$classroom_name' and teacher='$teacher' and date='$date' and time_type=$time_type");

mysql_query("update classroom_info set availability='YES' where name='$classroom_name' and date='$date'");

echo '<script >alert("执行成功");</script>';

header('refresh:0;url=../admin_page/ad+all+reservation+info+review.php');

close_connection();

教室信息修改

日期选择

ad_search_date.php

<?php
include_once("../functions/forbid.php");
?>
<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" type="text/css" href="../css/INDEX.css"/>
    <meta charset="utf-8"/>
    <title>高校实训室管理系统</title>
</head>
<body>
<div class="head">
    <h2 onclick=window.location.href='admin.php'>
        高校实训室管理系统</h2>
    <div class="dhl">
        <nav>
            <ul>
                <?php
                include_once("../functions/forbid.php");
                echo '<a style="color: white">登录账户:' . @$_SESSION['name'].' </a>';
                ?>
                <li><a href="../logout.php">退出</a></li>
            </ul>
        </nav>
    </div>
</div>


<div class="main_content">

    <h1>请输入预约日期</h1>
    <div class="container">
        <div class="box-search">
           <?php
            echo '<form method="POST" action="../admin_query/ad_set+date+query.php">';
            ?>
            <h3>日期选择</h3>
            <br>
            <?php
            // 获取当前日期
            $current_date = date("Y-m-d");

            // 计算 min 日期(当前日期)
            $min_date = $current_date;

            // 计算 max 日期(当前日期 + 6天)
            $max_date = date("Y-m-d", strtotime($current_date . "+6 days"));
            ?>
            <!-- 在 input 中使用动态生成的 min 和 max -->
            <input type="date" name="date" value="<?php echo $current_date; ?>" class="date" min="<?php echo $min_date; ?>" max="<?php echo $max_date; ?>">

            <br>
            <br>
            <input type="submit" value="查询" class="title-text-search">
            <?php
            echo '</form>';
            ?>
        </div>

    </div>

</div>

<div class="btn">
    <footer>
        <h4>HOSTED@D3SK1NG-PROJECT+2023</h4>
    </footer>
</div>
</body>
</html>
接收所选日期判断跳转

ad_set+date+query.php

<?php
@header("content-Type: text/html; charset=utf-8");
include_once("../functions/database.php");


$date = $_POST["date"];

get_connection();

$result_set = mysql_query("select * from classroom_info where date='$date'");

close_connection();


$implement = mysql_fetch_assoc($result_set);
if ($implement > 0) {
    header('refresh:0;url=../admin_page/edit+classroom+info.php?date=' . $date . '&page=1');
} else {
    echo '<script >alert("暂无实训室信息,请添加");</script>';
    header('refresh:0;url=../admin_page/ad+add+classroom+info.php');
}
界面

edit+classroom+info.php

<!DOCTYPE html>
<html lang="ch">
<head>
    <link rel="stylesheet" type="text/css" href="../css/edit_classroom_info.css"/>
    <meta charset="utf-8"/>
    <title>高校实训室管理系统</title>
</head>
<body>
<div class="head">
    <h2 onclick=window.location.href='admin.php'>高校实训室管理系统</h2>

    <form action="ad+search+classroom_name+query.php" method="post">
        <div class="search_content">
            <span>搜索教室:</span>
            <input class="search_text" type="text" name="result" id="">
            <?php  $date = $_GET["date"];
            echo '<input type="hidden" name="date" value="' . $date. '">';
            ?>
            <input class="search_img" type="image" src="../img/search_1.png" alt="submit">
        </div>
    </form>

    <div class="dhl">
        <nav>
            <ul>
                <?php
                include_once("../functions/forbid.php");
                echo '<a style="color: white">登录账户:' . @$_SESSION['name'].' </a>';
                ?>
                <li><a href="../logout.php">退出</a></li>
            </ul>
        </nav>
    </div>
</div>


<div class="main_content">

    <div class="top_content">

        <h2 class="page_title"><?php
            $week_array=array("一","二","三","四","五","六","日");
            $week=$week_array[date("w",strtotime($date))];
            echo  '本周星期'.$week ?>的实训室信息</h2>
        <a class="addBT" href='ad+add+classroom+info.php'>添加</a>

    </div>

    <div class="container">
        <?php
        include_once("../functions/database.php");
        include_once("../functions/forbid.php");


        @$page = $_GET['page'];
        if ($page == 0 && empty($page)) {
            $page = 1;
        }
        $page_size = 21;
        $page_set = ($page - 1) * $page_size;

        get_connection();

        $result_set = mysql_query("select * from classroom_info where date='$date'  limit {$page_set},{$page_size}");

        $count_query = mysql_query("select count(1) from classroom_info where date='$date'");

        close_connection();

        while ($row = mysql_fetch_array($result_set)) {

            echo '<form action="../admin_query/update+classroom_info+query.php?name=' . $row['name'] . '"';
            echo 'method="post">';

            echo '<div class="box">';

            echo '<h3>实训室:<span class="classroom_name">' . $row['name'] . '</span></h3>  ';


            if ($row['availability'] == 'YES')
                $availability = '可用';
            elseif ($row['availability'] == 'NO')
                $availability = '不可用';

            echo '<h3>&nbsp状态:</h3>
                        <div class="select">
                            <select class="select_list_1" name="availability">';
            echo '<option value="' . $availability . '">
                       ' . $availability . '</option>';
            echo '            <option value="YES">可用</option>
                              <option value="NO">不可用</option>
                            </select>
                        </div>';

            if ($row['time_type'] == 1)
                $time_period = '8:20-10:00';
            elseif ($row['time_type'] == 2)
                $time_period = '10:20-12:00';
            elseif ($row['time_type'] == 3)
                $time_period = '14:30-16:10';
            elseif ($row['time_type'] == 4)
                $time_period = '16:30-18:00';

            echo '<h3>&nbsp时间段:</h3>
                        <div class="select">
                            <select class="select_list" name="time_period">';
            echo '<option value="' . $time_period . '">
                       ' . $time_period . '</option>';
            echo '<option value="1">8:20-10:00</option>
                              <option value="2">10:20-12:00</option>
                              <option value="3">14:30-16:10</option>
                              <option value="4">16:30-18:00</option>
                            </select>
                        </div>';


            echo ' <br >
 
                            &nbsp <input type="submit" value="修改" class="editBT">';
            echo '<input type="hidden" name="date" value="' . $date. '">';

            echo '<a class="editBT" href=../admin_query/ad+delete+classroom+info+query.php?name=' . $row['name'] . '&date='.$row['date'].' onclick="return confirm(' . "'警告:是否删除'" . ')"';
            echo '>删除</a>';

            echo '</div >
            </form>';

        }

        $row_1 = mysql_fetch_row($count_query);

        $record_count = $row_1[0];

        if ($record_count == 0) {
            $page_count = 0;
        } else if ($record_count < $page_size || $record_count == $page_size) {
            $page_count = 1;
        } else if ($record_count % $page_size == 0) {
            $page_count = $record_count / $page_size;
        } else {
            $page_count = (int)($record_count / $page_size) + 1;
        }

        echo '<div class="page">';

        echo "<h4>当前" . $page . "/" . $page_count . "</h4></br>";

        if ($page == 1) {
            echo("<a class='pageBT' onclick=" . "alert('已经是最新一页')" . ">第一页</a>");
        } else
            echo("<a class='pageBT' href=edit+classroom+info.php?date=$date&page=1>第一页</a>");
        //设置上一页连接

        if ($page == 1) {
            echo("<a class='pageBT' onclick=" . "alert('已经是最新一页')" . ">上一页</a>");
        } else
            echo("<a class='pageBT' href=edit+classroom+info.php?date=$date&page=" . ($page - 1) . ">上一页</a>");

        //设置下一页链接
        if ($page == $page_count) {
            echo("<a class='pageBT' onclick=" . "alert('已经是最后一页')" . ">下一页</a>");
        } else
            echo("<a class='pageBT' href=edit+classroom+info.php?date=$date&page=" . ($page + 1) . ">下一页</a>");
        //设置最后一页
        if ($page == $page_count) {
            echo("<a class='pageBT' onclick=" . "alert('已经是最后一页')" . ">末尾页</a>");
        } else
            echo("<a class='pageBT' href=edit+classroom+info.php?date=$date&page=" . $page_count . ">末尾页</a>");

        echo '</div>';

        ?>
    </div>
</div>

<div class="btn">
    <footer>
        <h4>HOSTED@D3SK1NG-PROJECT+2023</h4>
    </footer>
</div>

</body>
</html>
添加教室信息
界面

ad+add+classroom+info.php

<!DOCTYPE html>
<html lang="ch">
<head>
    <link rel="stylesheet" type="text/css" href="../css/edit_classroom_info.css"/>
    <meta charset="utf-8"/>
    <title>高校实训室管理系统</title>
</head>

<body>

<div class="head">
    <h2 onclick=window.location.href='admin.php'>高校实训室管理系统</h2>
    <div class="dhl">
        <nav>
            <ul>
                <?php
                include_once("../functions/forbid.php");
                echo '<a style="color: white">登录账户:' . @$_SESSION['name'].' </a>';
                ?>
                <li><a href="../logout.php">退出</a></li>
            </ul>
        </nav>
    </div>
</div>


<div class="main_content">

    <h2 class="page_title">教室信息添加</h2>
    <div class="container">

        <form action="../admin_query/ad+add+classroom_info+query.php" method="post">

            <div class="add_classroom_info_box">

                <h3>实训室:</h3><input class="inputstyle" type="text" name="name" value=""/>

                <h3>&nbsp状态:</h3>
                <div class="select">
                    <label>
                        <select class="select_list_1" name="availability">
                            <option value="">请选择</option>
                            <option value="YES">可用</option>
                            <option value="NO">不可用</option>
                        </select>
                    </label>
                </div>

                <h3>&nbsp时间段:</h3>
                <div class="select">
                    <label>
                        <select class="select_list" name="time_period">
                            <option value="">请选择</option>
                            <option value="1">8:20-10:00</option>
                            <option value="2">10:20-12:00</option>
                            <option value="3">14:00-16:10</option>
                            <option value="4<">16:30-18:00</option>
                        </select>
                    </label>
                </div>

                <br>
                <?php
                // 获取当前日期
                $current_date = date("Y-m-d");

                // 计算 min 日期(当前日期)
                $min_date = $current_date;

                // 计算 max 日期(当前日期 + 6天)
                $max_date = date("Y-m-d", strtotime($current_date . "+6 days"));
                ?>
                <h3>&nbsp日期:</h3>
                <input type="date" name="date" value="<?php echo $current_date; ?>" class="date" min="<?php echo $min_date; ?>" max="<?php echo $max_date; ?>">
                &nbsp<input type="submit" value="添加" class="editBT">

            </div>

        </form>

    </div>

</div>

<div class="btn">
    <footer>
        <h4>HOSTED@D3SK1NG-PROJECT+2023</h4>
    </footer>
</div>

</body>
</html>
添加教室信息

ad+add+classroom_info+query.php

<?php
@header("content-Type: text/html; charset=utf-8");
include_once("../functions/database.php");

$name = $_POST['name'];
$availability = $_POST['availability'];
$time_period = $_POST['time_period'];
$date=$_POST["date"];


get_connection();

$search_classroom_name = mysql_query("select * from classroom_info where name='" . $name . "' and date='" . $date . "'");

$implement_1 = mysql_fetch_assoc($search_classroom_name);


$sql = "insert into classroom_info values(null,'$name','$availability','$time_period','$date')";


    if ($implement_1 > 0) {
        echo '<script >alert("该教室已存在");</script>';
        header("refresh:0;url=../admin_page/ad+add+classroom+info.php");
    } else {
        if ($name == "" || $availability == "" || $time_period == ""||$date=="") {
            echo '<script >alert("请填写完整信息");</script>';
            header("refresh:0;url=../admin_page/ad+add+classroom+info.php");
        } else {
            mysql_query($sql);
            echo '<script >alert("添加成功");</script>';
            header("refresh:0;url=../admin_page/ad+add+classroom+info.php");
        }

}
close_connection();

修改教室信息

update+classroom_info+query.php

<?php
@header("content-Type: text/html; charset=utf-8");
include_once("../functions/database.php");

$name = $_GET['name'];
$availability = $_POST['availability'];
$time_period = $_POST['time_period'];
$date=$_POST['date'];


if ($availability == '可用')
    $availability = 'YES';
elseif ($availability == '不可用')
    $availability = 'NO';

if ($time_period == '8:20-10:00')
    $time_period = 1;
elseif ($time_period == '10:20 -12:00')
    $time_period = 2;
elseif ($time_period == '14:30-16:10')
    $time_period = 3;
elseif ($time_period == '16:30-18:00')
    $time_period = 4;

get_connection();

mysql_query("update classroom_info set availability='$availability',time_type=$time_period where name='$name' and date='$date'");

echo '<script >alert("修改成功");</script>';

header("refresh:0;url=../admin_page/edit+classroom+info.php?date=$date&page=1");

close_connection();

删除教室信息

ad+delete+classroom+info+query.php

<?php
@header("content-Type: text/html; charset=utf-8");
include_once("../functions/database.php");

$name = $_GET['name'];
$date=$_GET['date'];

get_connection();

mysql_query("delete from classroom_info where name='$name' and date='$date'");
echo '<script >alert("删除成功");</script>';
header('refresh:0;url=../admin_page/edit+classroom+info.php?date='.$date.'page=1');

close_connection();


清除过期实训室信息

clean+expiration+info+query.php

<?php
@header("content-Type: text/html; charset=utf-8");
include_once("../functions/database.php");

get_connection();

$get_info = mysql_query("select * from classroom_info where date < curdate()");
$info = mysql_fetch_assoc($get_info);

if ($info > 0) {
    mysql_query("delete from classroom_info where date < curdate()");
    echo '<script >alert("清除成功");</script>';
} else {
    echo '<script >alert("暂无过期实训室信息");</script>';
}

header('refresh:0;url=../admin_page/admin.php');

close_connection();

教师信息修改

界面

edit+all+user+info.php

<!DOCTYPE html>
<html lang="ch">
<head>
    <link rel="stylesheet" type="text/css" href="../css/editallinfo.css"/>
    <meta charset="utf-8"/>
    <title>高校实训室管理系统</title>
</head>
<body>
<div class="head">
    <h2 onclick=window.location.href='admin.php'>高校实训室管理系统</h2>


    <form action="../admin_page/search+name+query.php" method="post">
        <div class="search_content">
            <span>搜索教师:</span>
            <input class="search_text" type="text" name="result" id="">
            <input class="search_img" type="image" src="../img/search_1.png" alt="submit">
        </div>
    </form>


    <div class="dhl">
        <nav>
            <ul>
                <?php
                include_once("../functions/forbid.php");
                echo '<a style="color: white">登录账户:' . @$_SESSION['name'] . ' </a>';
                ?>
                <li><a href="../logout.php">退出</a></li>
            </ul>
        </nav>
    </div>
</div>


<div class="main_content">

    <div class="top_content">

        <h2 class="page_title">教师信息</h2>
        <a class="addBT" href='ad+add+teacherinfo.php'>添加</a>

    </div>

    <div class="container">

        <?php
        include_once("../functions/database.php");
        include_once("../functions/forbid.php");

        @$page = $_GET['page'];
        if ($page == 0 && empty($page)) {
            $page = 1;
        }
        $page_size = 7;
        $page_set = ($page - 1) * $page_size;

        get_connection();

        $result_set = mysql_query("select * from users where type_id=1 limit {$page_set},{$page_size}");

        $count_query = mysql_query("select count(1) from users where type_id=1");

        close_connection();

        while ($row = mysql_fetch_array($result_set)) {


            echo '<form action="../admin_query/update+tinfo+query.php?user_id=' . $row['user_id'] . '" method="post">';

            echo '<div class="box">';


            echo '<h3>姓名:</h3><input class="inputstyle" type="text" name="name"';
            echo 'value="' . $row['name'] . '"/>';

            echo '<h3>密码:</h3><input class="inputstyle" type="text" name="password"';
            echo 'value="' . $row['password'] . '"/>';

            echo '<h3>专业:</h3>
                        <div class="select">
                            <select class="select_list_1" name="profession" default="">';
            echo '<option value="' . $row['profession'] . '">
                       ' . $row['profession'] . '</option>';
            $array = array("计算机科学与技术", "计算机网络", "软件工程", "网络工程");
            foreach ($array as $value) {
                if ($row['profession'] != $value) {
                    echo '<option value="计算机科学与技术">' . $value . '</option>';
                }
            }
            echo '</select>
                        </div>';


            echo '<h3>职称:</h3>
                        <div class="select">
                            <select class="select_list" name="title">';
            echo '<option value="' . $row['title'] . '">
                       ' . $row['title'] . '</option>';
            echo '<option value="教授">教授</option>
                              <option value="副教授">副教授</option>
                              <option value="讲师">讲师</option>
                              <option value="助教">助教</option>
                            </select>
                        </div>';


            echo '<h3> 性别:</h3 >
                        <div class="select" >
                            <select class="select_list" name = "sex" >';
            echo '<option value = "' . $row['sex'] . '" > ' . $row['sex'] . '</option >';
            echo '<option value = "男" > 男</option >
                              <option value = "女" > 女</option >
                            </select >
                        </div >';


            echo '<h3> 学历:</h3 >
                        <div class="select" >
                            <select class="select_list" name = "education" >';
            echo '<option value = "' . $row['education'] . '" > ' . $row['education'] . '</option >';

            echo '<option value = "本科" > 本科</option >
                              <option value = "硕士" > 硕士</option >
                              <option value = "博士" > 博士</option >
                              <option value = "院士" > 院士</option >
                            </select >
                        </div >';

            echo '<h3>电话:</h3><input class="inputstyle" type="text" name="tel"';
            echo 'value="' . $row['tel'] . '"/>';
            echo '<h3>教职工号:</h3><input class="inputstyle" type="text" name="tid"';
            echo 'value="' . $row['tid'] . '"/>';
            echo ' <br >
                             <input type="submit" value="修改" class="editBT">';
            echo '<a class="editBT" href=ad+delete+user+query.php?user_id=' . $row['user_id'] . ' onclick="return confirm(' . "'警告:是否删除'" . ')"';
            echo '>删除</a>';

            echo '</div >
            </form>';


        }

        $row_1 = mysql_fetch_row($count_query);

        $record_count = $row_1[0];

        if ($record_count == 0) {
            $page_count = 0;
        } else if ($record_count < $page_size || $record_count == $page_size) {
            $page_count = 1;
        } else if ($record_count % $page_size == 0) {
            $page_count = $record_count / $page_size;
        } else {
            $page_count = (int)($record_count / $page_size) + 1;
        }

        echo '<div class="page">';

        echo "<h4>当前" . $page . "/" . $page_count . "</h4></br>";

        if ($page == 1) {
            echo("<a class='pageBT' onclick=" . "alert('已经是最新一页')" . ">第一页</a>");
        } else
            echo("<a class='pageBT' href=edit+all+user+info.php?page=1>第一页</a>");
        //设置上一页连接

        if ($page == 1) {
            echo("<a class='pageBT' onclick=" . "alert('已经是最新一页')" . ">上一页</a>");
        } else
            echo("<a class='pageBT' href=edit+all+user+info.php?page=" . ($page - 1) . ">上一页</a>");

        //设置下一页链接
        if ($page == $page_count) {
            echo("<a class='pageBT' onclick=" . "alert('已经是最后一页')" . ">下一页</a>");
        } else
            echo("<a class='pageBT' href=edit+all+user+info.php?page=" . ($page + 1) . ">下一页</a>");
        //设置最后一页
        if ($page == $page_count) {
            echo("<a class='pageBT' onclick=" . "alert('已经是最后一页')" . ">末尾页</a>");
        } else
            echo("<a class='pageBT' href=edit+all+user+info.php?page=" . $page_count . ">末尾页</a>");


        echo '</div>';

        ?>
    </div>
</div>

<div class="btn">
    <footer>
        <h4>HOSTED@D3SK1NG-PROJECT+2023</h4>
    </footer>
</div>
</body>
</html>
添加教师
界面

ad+add+teacherinfo.php

<!DOCTYPE html>
<html lang="ch">
<head>
    <link rel="stylesheet" type="text/css" href="../css/editallinfo.css"/>
    <meta charset="utf-8"/>
    <title>高校实训室管理系统</title>
</head>

<body>

<div class="head">
    <h2 onclick=window.location.href='admin.php'>高校实训室管理系统</h2>

    <div class="dhl">
        <nav>
            <ul>
                <?php
                include_once("../functions/forbid.php");
                echo '<a style="color: white">登录账户:' . @$_SESSION['name'].' </a>';
                ?>
                <li><a href="../logout.php">退出</a></li>
            </ul>
        </nav>
    </div>
</div>


<div class="main_content">

    <h2 class="page_title">教师信息添加</h2>
    <div class="container">

        <form action="../admin_query/ad+add+teacherinfo+query.php" method="post">

            <div class="add_teacher_info_box">

                <h3>姓名:</h3><input class="inputstyle" type="text" name="name" value=""/>

                <h3>密码:</h3><input class="inputstyle" type="text" name="password" value=""/>

                <h3>专业:</h3>
                <div class="select">

                    <label>
                        <select class="select_list_1" name="profession">
                            <option value=""></option>
                            <option value="计算机科学与技术">计算机科学与技术</option>
                            <option value="计算机网络">计算机网络</option>
                            <option value="软件工程<">软件工程</option>
                            <option value="网络安全">网络安全</option>
                        </select>
                    </label>
                </div>


                <h3>职称:</h3>
                <div class="select">
                    <label>
                        <select class="select_list" name="title">
                            <option value=""></option>
                            <option value="教授">教授</option>
                            <option value="副教授">副教授</option>
                            <option value="讲师<">讲师</option>
                            <option value="助教">助教</option>
                        </select>
                    </label>
                </div>


                <h3> 性别:</h3>
                <div class="select">
                    <label>
                        <select class="select_list" name="sex">
                            <option value=""></option>
                            <option value="男"> 男</option>
                            <option value="女"> 女</option>
                        </select>
                    </label>
                </div>


                <h3> 学历:</h3>
                <div class="select">
                    <label>
                        <select class="select_list" name="education">
                            <option value=""></option>
                            <option value="本科"> 本科</option>
                            <option value="硕士"> 硕士</option>
                            <option value="博士"> 博士</option>
                            <option value="院士"> 院士</option>
                        </select>
                    </label>
                </div>

                <h3>电话:</h3><label>
                <input class="inputstyle" type="text" name="tel" value=""/>
            </label>
                <h3>教职工号:</h3><label>
                <input class="inputstyle" type="text" name="tid" value=""/>
            </label>
                <br>
                <input type="submit" value="添加" class="editBT">

            </div>

        </form>

    </div>

</div>

<div class="btn">
    <footer>
        <h4>HOSTED@D3SK1NG-PROJECT+2023</h4>
    </footer>
</div>

</body>
</html>
接收添加信息执行

ad+add+teacherinfo+query.php

<?php
@header("content-Type: text/html; charset=utf-8");
include_once("functions/database.php");

$name = $_POST['name'];
$password = $_POST['password'];
$profession = $_POST['profession'];
$title = $_POST['title'];
$sex = $_POST['sex'];
$education = $_POST['education'];
$tel = $_POST['tel'];
$tid = $_POST['tid'];

get_connection();

$search_t_tid = mysql_query("select * from teacher_id where tid='" . $tid . "'");
$search_u_tid = mysql_query("select * from users where tid='" . $tid . "'");

$implement_1 = mysql_fetch_assoc($search_t_tid);
$implement_2 = mysql_fetch_assoc($search_u_tid);

$sql = "insert into users values(null,1,'$name','$password','$profession','$title','$sex','$education','$tel','$tid')";

if ($tid == "") {
    echo '<script >alert("请输入教职工号");</script>';
    header("refresh:0;url=ad+add+teacherinfo.php");
} else {
    if ($implement_1 > 0) {
        if ($implement_2 > 0) {
            echo '<script >alert("该教职工账号已注册");</script>';
            header("refresh:0;url=ad+add+teacherinfo.php");
        } else {
            if($name == "" || $password == "" || $profession == "" || $title == "" || $sex == "" || $education == "" || $tel == "")
            {
                echo '<script >alert("请填写完整信息");</script>';
                header("refresh:0;url=ad+add+teacherinfo.php");
            } else {
                mysql_query($sql);
                echo '<script >alert("添加成功");</script>';
                header("refresh:0;url=ad+add+teacherinfo.php");
            }
        }
    } else {
        echo '<script >alert("教职工账号不存在或输入错误");</script>';
        header("refresh:0;url=ad+add+teacherinfo.php");
    }
}
close_connection();

修改教师信息

update+tinfo+query.php

<?php
@header("content-Type: text/html; charset=utf-8");
include_once("../functions/database.php");

$uid = $_GET["user_id"];

$name = $_POST['name'];
$password = $_POST['password'];
$profession = $_POST['profession'];
$title = $_POST['title'];
$sex = $_POST['sex'];
$education = $_POST['education'];
$tel = $_POST['tel'];
$tid = $_POST['tid'];

get_connection();

mysql_query("update users set name='$name',password='$password',profession='$profession',title='$title',sex='$sex',education='$education',tel='$tel',tid='$tid' where type_id=1 and user_id=$uid");
echo '<script >alert("修改成功");</script>';
header("refresh:0;url=../admin_page/edit+all+user+info.php?page=1");

close_connection();
删除教师信息

ad+delete+user+query.php

<?php
@header("content-Type: text/html; charset=utf-8");
include_once("functions/database.php");

$id = $_GET['user_id'];

get_connection();

mysql_query("delete from users where type_id=1 and user_id='$id'");
echo '<script >alert("删除成功");</script>';
header('refresh:0;url=edit+all+user+info.php?page=1');

close_connection();
搜索并显示相应教师信息

search+name+query.php

<!DOCTYPE html>
<html lang="ch">
<head>
    <link rel="stylesheet" type="text/css" href="../css/editallinfo.css"/>
    <meta charset="utf-8"/>
    <title>高校实训室管理系统</title>
</head>
<body>
<div class="head">
    <h2 onclick=window.location.href='admin.php'>高校实训室管理系统</h2>


    <form action="../admin_page/search+name+query.php" method="post">
        <div class="search_content">
            <span>搜索教师:</span>
            <input class="search_text" type="text" name="result" id="">
            <input class="search_img" type="image" src="../img/search_1.png" alt="submit">
        </div>
    </form>


    <div class="dhl">
        <nav>
            <ul>
                <?php
                include_once("../functions/forbid.php");
                echo '<a style="color: white">登录账户:' . @$_SESSION['name'].' </a>';
                ?>
                <li><a href="../logout.php">退出</a></li>
            </ul>
        </nav>
    </div>
</div>


<div class="main_content">
    <div class="top_content">
        <h2 class="page_title">教师信息</h2>
    </div>
    <div class="container">
        <?php

        @header("content-Type: text/html; charset=utf-8");
        include_once("../functions/database.php");

        $search_result = $_POST['result'];

        if ($search_result == '') {
            echo '<script >alert("信息不能为空");</script>';
            header("refresh:0;url=edit+all+user+info.php");
        } else {

            get_connection();

            $result = mysql_query("select * from users where name like  '$search_result' ");


            if (mysql_num_rows($result) < 1) {
                echo '<script >alert("教师信息不存在");</script>';
                header("refresh:0;url=edit+all+user+info.php?page=1");
            } else {
                $row = mysql_fetch_array($result);

                echo '<form action="update+tinfo+query.php?user_id=' . $row['user_id'] . '" method="post">';

                echo '<div class="box">';

                echo '<h3>姓名:</h3><input class="inputstyle" type="text" name="name"';
                echo 'value="' . $row['name'] . '"/>';

                echo '<h3>密码:</h3><input class="inputstyle" type="text" name="password"';
                echo 'value="' . $row['password'] . '"/>';

                echo '<h3>专业:</h3>
                        <div class="select">
                            <select class="select_list_1" name="profession">';
                echo '<option value="' . $row['profession'] . '">
                       ' . $row['profession'] . '</option>';
                echo '<option value="计算机科学与技术">计算机科学与技术</option>
                              <option value="计算机网络">计算机网络</option>
                              <option value="软件工程<">软件工程</option>
                              <option value="网络安全">网络安全</option>
                            </select>
                        </div>';


                echo '<h3>职称:</h3>
                        <div class="select">
                            <select class="select_list" name="title">';
                echo '<option value="' . $row['title'] . '">
                       ' . $row['title'] . '</option>';
                echo '<option value="教授">教授</option>
                              <option value="副教授">副教授</option>
                              <option value="讲师<">讲师</option>
                              <option value="助教">助教</option>
                            </select>
                        </div>';


                echo '<h3> 性别:</h3 >
                        <div class="select" >
                            <select class="select_list" name = "sex" >';
                echo '<option value = "' . $row['sex'] . '" > ' . $row['sex'] . '</option >';
                echo '<option value = "男" > 男</option >
                              <option value = "女" > 女</option >
                            </select >
                        </div >';


                echo '<h3> 学历:</h3 >
                        <div class="select" >
                            <select class="select_list" name = "education" >';
                echo '<option value = "' . $row['education'] . '" > ' . $row['education'] . '</option >';

                echo '<option value = "本科" > 本科</option >
                              <option value = "硕士" > 硕士</option >
                              <option value = "博士" > 博士</option >
                              <option value = "院士" > 院士</option >
                            </select >
                        </div >';

                echo '<h3>电话:</h3><input class="inputstyle" type="text" name="tel"';
                echo 'value="' . $row['tel'] . '"/>';
                echo '<h3>教职工号:</h3><input class="inputstyle" type="text" name="tid"';
                echo 'value="' . $row['tid'] . '"/>';
                echo ' <br >
                             <input type="submit" value="修改" class="editBT">';
                echo '<a class="editBT" href=ad+delete+user+query.php?user_id=' . $row['user_id'] . ' onclick="return confirm(' . "'警告:是否删除'" . ')"';
                echo '>删除</a>';

                echo '</div >
            </form>';

            }

            close_connection();
        }
        ?>
    </div>
</div>
<div class="btn">
    <footer>
        <h4>HOSTED@D3SK1NG-PROJECT+2023</h4>
    </footer>
</div>
</body>
</html>

教职工号添加

界面

add+teacher+id.php

<?php
include_once("../functions/forbid.php");
?>
<!DOCTYPE html>
<html lang="CN">
<head>
    <link rel="stylesheet" type="text/css" href="../css/addteacherid.css"/>
    <meta charset="utf-8"/>
    <title>高校实训室管理系统</title>
</head>
<body>
<div class="head">
    <h2 class="systitle" onclick=window.location.href='admin.php'>高校实训室管理系统</h2>
    <div class="dhl">
        <nav>
            <ul>
                <?php
                include_once("../functions/forbid.php");
                echo '<a style="color: white">登录账户:' . @$_SESSION['name'].' </a>';
                ?>
                <li><a href="../logout.php">退出</a></li>
            </ul>
        </nav>
    </div>
</div>


<div class="main_content">
    <div class="container">
        <div class="box">
            <h2>教职工账号添加</h2>
            <br>
            <form action="../admin_query/ad+add+tid+query.php" method="post">
                <input class="inputstyle" type="text" name="tid" value="" placeholder="请输入账号"/>
                <br>
                <br>
                <input type="submit" value="添加" class="loginbtn">
            </form>
        </div>
    </div>
</div>

<div class="btn">
    <footer>
        <h4>HOSTED@D3SK1NG-PROJECT+2023</h4>
    </footer>
</div>

</body>
</html>
接收信息后添加

ad+add+tid+query.php

<?php
@header("content-Type: text/html; charset=utf-8");
include_once("../functions/database.php");

$tid=$_POST['tid'];

if ($tid == '') {
    echo '<script >alert("信息不能为空");</script>';
    header("refresh:0;url=../admin_page/add+teacher+id.php");
} else {

    get_connection();

    $select_tid = mysql_query("select * from teacher_id where tid=$tid");

    $implement_1 = mysql_fetch_assoc($select_tid);

    if ($implement_1 > 0) {
        echo '<script >alert("教职工账号已存在");</script>';

    } else {
        mysql_query("insert into teacher_id(tid) values ($tid)");
        echo '<script >alert("添加成功");</script>';

    }
    header("refresh:0;url=../admin_page/add+teacher+id.php");
    close_connection();
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值