Repository navigation
Expand file tree
/
Copy pathsettings.php
More file actions
188 lines (162 loc) · 6.16 KB
/
Copy pathsettings.php
File metadata and controls
188 lines (162 loc) · 6.16 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
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 include("header.php"); ?>
<div class="container">
<h1>User Information</h1>
<hr/>
<?php
if ($db_conn=OCILogon("ora_p1t7", "a36959104", "ug")){
//user documents query
$email = $_SESSION['email'];
$cmdstr = "select document_id, document_name, institution, dept, course_num, document_time from document where email= '$email'";
$parsed = OCIParse($db_conn, $cmdstr);
if (!$parsed){
$e = OCIError($db_conn);
echo htmlentities($e['message']);
exit;
}
$r=OCIExecute($parsed, OCI_DEFAULT);
if (!$r){
$e = oci_error($parsed);
echo htmlentities($e['message']);
exit;
}
//first document fetch
$areDocuments = TRUE;
$row = OCI_Fetch_Array($parsed, OCI_NUM);
if (empty($row)) {
$_SESSION['doc0'] = "No documents posted.";
$areDocuments = FALSE;
}
//echo document table
echo '<h3>Your Documents</h3>';
echo "<table width=\"100%\" border=\"1\">";
echo "<tr>
<th>Document Id</th>
<th>Name</th>
<th>Institution</th>
<th>Department</th>
<th>Course Number</th>
<th>TimeStamp</th>
<th>Delete?</th>
<tr>";
if (!empty($row)) {
echo "<tr>
<td bgcolor=\"#COCOCO\">" . $row[0] . "</td>
<td bgcolor=\"#COCOCO\">" . $row[1] . "</td>
<td bgcolor=\"#COCOCO\">" . $row[2] . "</td>
<td bgcolor=\"#COCOCO\">" . $row[3] . "</td>
<td bgcolor=\"#COCOCO\">" . $row[4] . "</td>
<td bgcolor=\"#COCOCO\">" . $row[5] . "</td>
<td bgcolor=\"#COCOCO\"> <form name='delete_form' action='deletedoc.php' method='POST'>
<input type='hidden' name='dotodelete' value='$row[0]'>
<button class=\"btn-small\" type=\"submit\">Delete</button><form></td>
</tr>";
while ($row = OCI_Fetch_Array($parsed, OCI_NUM)) {
echo "<tr>
<td bgcolor=\"#COCOCO\">" . $row[0] . "</td>
<td bgcolor=\"#COCOCO\">" . $row[1] . "</td>
<td bgcolor=\"#COCOCO\">" . $row[2] . "</td>
<td bgcolor=\"#COCOCO\">" . $row[3] . "</td>
<td bgcolor=\"#COCOCO\">" . $row[4] . "</td>
<td bgcolor=\"#COCOCO\">" . $row[5] . "</td>
<td bgcolor=\"#COCOCO\"> <form name='delete_form' action='deletedoc.php' method='POST'>
<input type='hidden' name='dotodelete' value='$row[0]'>
<button class=\"btn-small\" type=\"submit\">Delete</button><form></td>
</tr>";
}
}
echo "</table>";
if (isset($_SESSION["deldocres"] )) {
echo $_SESSION["deldocres"];
unset( $_SESSION["deldocres"] );
}
//user comments
$cmdstr = "select comment_id, text, comment_time from ns_comment where email = '$email'";
$parsed = OCIParse($db_conn, $cmdstr);
if (!$parsed){
$e = OCIError($db_conn);
echo htmlentities($e['message']);
exit;
}
$r=OCIExecute($parsed, OCI_DEFAULT);
if (!$r){
$e = oci_error($parsed);
echo htmlentities($e['message']);
exit;
}
//echo couse table
echo '<br/>';
echo '<h3>Your Comments</h3>';
echo "<table width=\"100%\" border=\"1\">";
echo "<tr>
<th>ID</th>
<th>Text</th>
<th>Time</th>
<th>Delete?</th>
<tr>";
while ($row = OCI_Fetch_Array($parsed, OCI_NUM)) {
echo "<tr>
<td bgcolor=\"#COCOCO\">" . $row[0] . "</td>
<td bgcolor=\"#COCOCO\">" . $row[1] . "</td>
<td bgcolor=\"#COCOCO\">" . $row[2] . "</td>
<td bgcolor=\"#COCOCO\"> <form name='delete_form' action='deletecomment.php' method='POST'>
<input type='hidden' name='comtodelete' value='$row[0]'>
<button class=\"btn-small\" type=\"submit\">Delete</button><form></td>
</tr>";
}
echo "</table>";
}
if ($areDocuments || $areComments) {
//user course query interation query (two JOINs with union)
$cmdstr = "select course_is_in.course_num, course_is_in.course_name from course_is_in, document where document.email = '$email' and course_is_in.course_num = document.course_num union select course_is_in.course_num, course_is_in.course_name from course_is_in, ns_comment where ns_comment.email = '$email' and course_is_in.course_num = ns_comment.course_num";
$parsed = OCIParse($db_conn, $cmdstr);
if (!$parsed){
$e = OCIError($db_conn);
echo htmlentities($e['message']);
exit;
}
$r=OCIExecute($parsed, OCI_DEFAULT);
if (!$r){
$e = oci_error($parsed);
echo htmlentities($e['message']);
exit;
}
//echo couse table
echo '<br/>';
echo '<h3>Courses You Have Added Content To</h3>';
echo "<table width=\"100%\" border=\"1\">";
echo "<tr>
<th>Course Number</th>
<th>Name</th>
<tr>";
while ($row = OCI_Fetch_Array($parsed, OCI_NUM)) {
echo "<tr>
<td bgcolor=\"#COCOCO\">" . $row[0] . "</td>
<td bgcolor=\"#COCOCO\">" . $row[1] . "</td>
</tr>";
}
echo "</table>";
//logoff
OCILogoff($db_conn);
}
//error on connection
else {
$e = OCIError();
echo htmlentities($e['message']);
}
?>
<hr/>
<h1>Change Password</h1>
<form method="POST" action="change_password.php">
<p><h3>Old Password</h3><input type="password" name="old_password" size="18"/></p>
<p><h3>New Password</h3><input type="password" name="new_password" size="18"/></p>
<p><input class="btn-large" type="submit" value="submit" name="insertsubmit"></p>
<?php
if (isset($_SESSION['pw_change_result'])) {
echo "<b>" . $_SESSION['pw_change_result'] . "</b>";
unset($_SESSION['pw_change_result']);
}
?>
</form>
<button class="btn-large" type="submit" onclick="location.href ='deleteuser.php';">Delete Your Account :(</button></br>
</div> <!-- /container -->
<?php include("footer.php"); ?>