-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcourse.php
188 lines (183 loc) · 5.31 KB
/
course.php
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<?php
error_reporting(E_ALL ^ E_NOTICE);
ini_set('display_errors', '1');
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>E-Learning</title>
<link href="e-learningCSS.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function showSubjects(str)
{
var xmlhttp;
if (str=="")
{
document.getElementById("destination").innerHTML="";
return;
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("destination").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","showsubjects.php?sid="+str,true);
xmlhttp.send();
}
</script>
<script language="javascript">
function doAjaxGet(dataSource) {
if(navigator.appName == "Microsoft Internet Explorer") {
objHTTP = new ActiveXObject("Microsoft.XMLHTTP");
} else {
objHTTP = new XMLHttpRequest();
}
objHTTP.open("POST", dataSource, true);
objHTTP.onreadystatechange = function()
{
if (objHTTP.readyState == 4 && objHTTP.status == 200) {
document.getElementById('live_time_clock').innerHTML = objHTTP.responseText;
}
}
objHTTP.send('null');
}
function startclock() {
doAjaxGet('getServerTime.php');
setTimeout('startclock()',1000);
}
<script type="text/javascript">
</script>
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="SpryAssets/SpryMenuBarVertical.css" rel="stylesheet" type="text/css" />
</head>
<body onload="startclock()" class="body">
<div class="container">
<div class="header">
<font size="+3"><b>Online School Site</b></font>
<p align="right">
<?php
if(isset($_SESSION['student'])){
$fname = $_SESSION['firstname'];
$lname = $_SESSION['lastname'];
$faname = $_SESSION['fathername'];
echo"Student<br>";
echo"You are Login as $fname $lname $faname <a href='logout.php'>Logout</a>";
}elseif(isset($_SESSION['instructor'])){
$fname = $_SESSION['firstname'];
$lname = $_SESSION['lastname'];
$faname = $_SESSION['fathername'];
echo"Instructor<br>";
echo"You are Login as $fname $lname $faname <a href='logout.php'>Logout</a>";
}
?>
</p>
</div>
<div class="left">
<ul id="MenuBar1" class="MenuBarVertical">
<li><a href="index.php">Home</a> </li>
<li><a href="schools.php">Schools</a></li>
<li><a class="MenuBarItemSubmenu" href="#">Courses</a>
<ul>
<li><a href="mycourses.php">My Courses</a> </li>
</ul>
</li>
</ul>
<p><hr color="#FF0000" /></p>
<div class="login">
<p align="center">Login</p>
<?php
if(isset($_SESSION['instructor']) || isset($_SESSION['student'])){
echo"You are log in.";
}else{
?>
<form method="post" action="login.php">
Username:
<input name="username" type="text" />
Password:
<input name="password" type="password" /><br />
<select name="previlages">
<option value="Staff">Staff</option>
<option value="Student">Student</option>
</select>
<p>
<input name="" type="submit" value="Login" />
</p>
<p><a href="singup.php?s=student">Student Singup</a></p>
</form>
<?php
}
?>
<p>
<?php
$errNum = $_REQUEST["err"];
if($errNum == 1) {
echo "<p style='color:red' align='center'><b>Wrong username or password!!!!</b></p>";
}
?>
</p>
</div>
</div>
<div class="main">
<h3>Course</h3>
<div class="maincontent">
<?php
$cid = $_REQUEST['cid'];
include("connectToDatabase.php");
$sql = "select * from tblsubject where courseid = $cid";
$result = mysql_query($sql);
$num = mysql_num_rows($result);
if($num > 0) {
echo"<table>";
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){
$subjectid = $row['subjectid'];
$subjectname = $row['subjectname'];
$subjectcode = $row['subjectcode'];
echo"<tr>";
echo"<td>$subjectcode - $subjectname</td> <td><input name='show' type='button' onclick='showSubjects($subjectid)' value='Show Subjects' /></td>";
echo"</tr>";
}
echo"</table>";
echo"<div id='destination'></div>";
}else{
echo"There are no subjects for this course category";
}
?>
</div>
<hr color="#FF0000" /></p>
<div class="maincontent">
<p><b>Search for available courses</b></p>
<form action="result.php" method="get">
<table width="400" border="0">
<tr>
<td>Search for Course:</td>
<td><input name="subjectcode" type="text" /></td>
</tr>
<tr>
<td><input name="" type="submit" value="Search" /></td>
<td></td>
</tr>
</table>
</form>
</div>
<p><b>School Events</b></p>
<?php include("loadschoolevents.php");?>
</div>
<div class="footer"></div>
</div>
<script type="text/javascript">
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
</script>
</body>
</html>