This repository was archived by the owner on Aug 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdisciplines.php
More file actions
75 lines (64 loc) · 2.27 KB
/
Copy pathdisciplines.php
File metadata and controls
75 lines (64 loc) · 2.27 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
<?php
require_once('globals.php');
include_once('classes/db.php');
session_start();
$db = dbConnect();
if (!isset($_SESSION['admin']))
die ("You are not logged in.");
if (isset($_POST['deleteDisc'])){
$query = $db->prepare("DELETE FROM Disciplines WHERE Disciplines=?");
$query->bind_param("s",$_POST['delete']);
if($query->execute()){
$msg = "<font color='#00FF00'><b>Item removed</font>";
} else{
$msg = "<font color='#FF0000'><b>Item removal failed!</font>";
}
$query->close();
}
if (isset($_POST['add'])) {
$q = $db->prepare("INSERT INTO Disciplines VALUES (?)");
$q->bind_param("s",htmlspecialchars(stripslashes($_POST['discName'])));
if($q->execute()){
$msg = "<font color='#00FF00'><b>Item added</font>";
} else {
$msg = "<font color='#00FF00'><b>Item add failed</font>";
}
$q->close();
}
$query = $db->query("SELECT * FROM Disciplines ORDER BY Disciplines");
$disc = array();
while($row = $query->fetch_row())
$disc[] = $row[0];
$query->close();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>IPRO Course Listings</title></head>
<body>
<div><img src="img/header.png" alt="IPRO"></div>
<h2>IPRO Course Listings</h2>
<h5>Content Management System Administration</h5>
<hr>
<p><a href="admin.php">Manage Projects</a> | <a href="faculty.php">Manage Faculty</a> | <a href="disciplines.php">Manage Disciplines</a> | <a href="instructions.php">Change Instructions</a></p>
<h5>Manage Disciplines</h5>
<?php
require_once('globals.php');
if(isset($msg))
echo $msg; ?>
<p>Add and Remove Items from Discipline Listing</p>
<form action="disciplines.php" method="post"><fieldset><legend>Manage Disciplines</legend>
<table width="60%"><tr>
<td><label><b>Remove Discipline</b><br><select name="delete" size="12">
<?php
require_once('globals.php');
foreach ($disc as $entry)
print "<option value=\"$entry\">$entry</option>";
?>
</select></label><br><input type="submit" name="deleteDisc" value="Remove"></td>
<td valign="top"><label><b>Add New Discipline</b><br><input type="text" name="discName"></label> <input type="submit" name="add" value="Add Discipline"></td></tr>
</table></fieldset>
</form>
</body>
</html>