📄 uploadcourse.php.bak
字号:
<?php
session_start();
$Course_id1 = $_POST["Course_id"];
$Course_name1 = $_POST["Course_name"];
$week1 = $_POST["week"];
$time1 = $_POST["time"];
$Capacity1 = $_POST["Capacity"];
$Course_place1 = $_POST["Course_place"];
$credit1 = $_POST["credit"];
$Course_time1 = $week1." ".$time1;
$teacher_name = $HTTP_SESSION_VARS[name];
$teacher_id = $HTTP_SESSION_VARS[Teacher_id];
include("config.php");
//判断课程号是否合法
$Course_idChars = "^[0-9_-]";
$Course_idGood = true;
if(!ereg("$Course_idChars",$Course_id1))
{
$Course_idGood = false; //不合法设定为false
}
if($credit1<0||$credit1>10.0) {
echo "学分不符合要求";
}
$Capacity1Chars = "^[0-9_-]";
$Capacity1Good = true;
if(!ereg("$Capacity1Chars",$Course_id1))
{
$Capacity1Good = false; //不合法设定为false
}
$error = ""; //初始化错误为空
if ($Course_id1 == ""){$error = "$error<li>课程号不能为空<BR>\n";}
if ($Course_name1 == ""){$error = "$error<li>课程名不能为空<BR>\n";}
if ($Course_place1== ""){$error = "$error<li>上课地点不能为空<BR>\n";}
// 错误提示
if ($Course_idGood == false ){$error = "$error<li>The course id contains invalid chars.<BR>\n";}
if ($Capacity1Chars == false ){$error = "$error<li>The capacity contains invalid chars.<BR>\n";}
$query = "INSERT INTO Info_course (Course_id,Course_name,Teacher_name, Teacher_id, CollectedMan ,Capacity , Course_time,Course_place,credit) VALUES ('$Course_id1','$Course_name','$teacher_name','$teacher_id','0','$Capacity1','$Course_time1','$Course_place1','$credit1')";
$result = mysql_query($query);
if ($result == 1){
//$session_var1="$username1";
//session_register("session_var1");
header("Location: signsuc.php");
}
else{echo "发布课程出现错误";}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -