-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjoinCourse.php
More file actions
69 lines (59 loc) · 2.06 KB
/
joinCourse.php
File metadata and controls
69 lines (59 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<!-- 加入課程確認頁面 -->
<?php
include_once('api/auth.php');
include_once('api/isLogin.php');
include_once("mysql.php");
$course_id = $_GET['course_id'];
session_start();
$_SESSION['url'] = $_SERVER['REQUEST_URI'];
$member_id = $_SESSION['member_id'];
//check this course have been saved in mysql
$countResult = mysql_query("SELECT COUNT(*) as exist FROM attendent WHERE course_id='$course_id' and member_id='$member_id'");
$existObj = mysql_fetch_assoc($countResult);
if($existObj['exist'] != 1){
//metadata from mysql
$sql = "SELECT * FROM course WHERE course_id='$course_id'";
$result = mysql_query($sql);
$courseMetadata_temp = array();
while($row = mysql_fetch_assoc($result)){
$courseMetadata_temp[] = $row;
}
foreach($courseMetadata_temp as $courseMetadata){
}
}
?>
<!doctype html>
<html>
<head>
<?php require("meta_com.php"); ?>
<link type="text/css" rel="stylesheet" href="css/newCourse.css">
<title>新增課程 - NUCourse</title>
</head>
<body>
<div class="totalWrapper">
<?php require("header.php"); ?>
<div class="container">
<div class="newCourseForm-wrap">
<?php if($existObj['exist'] == 1){ ?>
<div id="existData_wrap">
<a class="existData">您目前已加入此課程了!</a>
<button class="giveupBtn" type="button" onclick="location.href='courseIndex.php?course_id=<?php echo $course_id?>'">返 回</button>
</div>
<?php }else {?>
<div id="title"><a>您即將加入以下課程</a></div>
<form id="joinCourseForm" action="api/join_newCourse.php" method="POST">
<div class="join_courseInfo">
<a><?php echo $courseMetadata['course_name'];?></a>
<a>by <?php echo $courseMetadata['teacher_name'];?></a>
</div>
<input type="hidden" name="course_id" value="<?php echo $course_id;?>"/>
<button class="joinBtn" type="submit">確定加入</button>
<button class="giveupBtn" type="button" onclick="history.back()">取 消</button>
</form>
<?php }?>
</div>
</div>
<?php require("footer.php"); ?>
</div>
</body>
</html>