-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddclasses.php
More file actions
148 lines (137 loc) · 4.32 KB
/
addclasses.php
File metadata and controls
148 lines (137 loc) · 4.32 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
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
<!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" />
<?php
$reqFields = 3; // How many rows
$groupFields = 8; // Must be increments of 4
$orFields = 8; // Must be increments of 4
// Connects to your Database
mysql_connect("localhost", "hackmu", "hackpass") or die(mysql_error());
mysql_select_db("hackmudb") or die(mysql_error());
//checks cookies to make sure they are logged in
if(isset($_COOKIE['ID_my_site']))
{
$username = $_COOKIE['ID_my_site'];
$pass = $_COOKIE['Key_my_site'];
$check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error());
while($info = mysql_fetch_array( $check ))
{
//if the cookie has the wrong password, they are taken to the login page
if ($pass != $info['password'])
{
header("Location: login.php");
}
//otherwise they are shown the admin area
else
{
?>
<title>SchedulePro - <?php echo $_COOKIE['ID_my_site']; ?></title>
<style type="text/css">
.auto-style1 {
border-style: solid;
border-width: 1px;
}
</style>
</head>
<body>
<?php //$id = isset($_GET['id']) ? $_GET['id'] : 1; ?>
<h1>Creat your course requirements <?php echo $_COOKIE['ID_my_site']; ?>!</h1>
<br>
<form action="addclasses.php" method="post">
<h3>Required Courses</h3>
<table border="1">
<?php
$elementCounter = 0;
for($i = 0; $i<$reqFields; $i++)
{
if($i == 0)
{
//header row
echo "<tr>\n";
echo '<td>Course</td>';
echo '<td>Course #</td>';
echo '<td> </td>';
echo '<td>Course</td>';
echo '<td>Course #</td>';
echo '<td> </td>';
echo '<td>Course</td>';
echo '<td>Course #</td>';
echo '<td> </td>';
echo '<td>Course</td>';
echo '<td>Course #</td>';
echo "</tr>\n";
}
echo "<tr>\n";
for($j = 0; $j < 4; $i++)
{
echo "<td><input type=\"text\" name\=\"A_course" . $elementCounter . "\" maxlength\=\"5\" size\=\"6\"><\/td>\n";
echo "<td><input type=\"text\" name\=\"A_crs_num" . $elementCounter . "\"maxlength\=\"5\" size\=\"6\"><\/td>\n";
echo "<td>\ \;<\/td>\n";
$elementCounter++;
}
echo "</tr>\n";
}
?>
<tr>
<td>Course</td>
<td>Course #</td>
<td> </td>
<td>Course</td>
<td>Course #</td>
</tr>
<tr>
<td><input type="text" name="A1_course01" maxlength="5" size="6"></td>
<td><input type="text" name="A1_crs_num01" maxlength="5" size="6"></td>
<td> </td>
<td><input type="text" name="A1_course02" maxlength="5" size="6"></td>
<td><input type="text" name="A1_crs_num02" maxlength="5" size="6"></td>
</tr>
<tr>
<td><input type="text" name="A1_course03" maxlength="5" size="6"></td>
<td><input type="text" name="A1_crs_num03" maxlength="5" size="6"></td>
<td> </td>
<td><input type="text" name="A1_course04" maxlength="5" size="6"></td>
<td><input type="text" name="A1_crs_num04" maxlength="5" size="6"></td>
</tr>
</table>
<br>
<h3>Group of Courses with required credit hours</h3>
<br>
Required credit hours needed for this group: <input type="text" name="B1_cred_hours" maxlength="2" size="3">
<table border="1">
<tr>
<td>Course</td>
<td>Course #</td>
<td> </td>
<td>Course</td>
<td>Course #</td>
</tr>
<tr>
<td><input type="text" name="B1_course01" maxlength="5" size="6"></td>
<td><input type="text" name="B1_crs_num01" maxlength="5" size="6"></td>
<td> </td>
<td><input type="text" name="B1_course02" maxlength="5" size="6"></td>
<td><input type="text" name="B1_crs_num02" maxlength="5" size="6"></td>
</tr>
<tr>
<td><input type="text" name="B1_course03" maxlength="5" size="6"></td>
<td><input type="text" name="B1_crs_num03" maxlength="5" size="6"></td>
<td> </td>
<td><input type="text" name="B1_course04" maxlength="5" size="6"></td>
<td><input type="text" name="B1_crs_num04" maxlength="5" size="6"></td>
</tr>
</table>
</form>
<a href="logout.php">Logout</a>
<?php
}
}
}
else //if the cookie does not exist, they are taken to the login screen
{
header("Location: index.php");
}
?>
</body>
</html>