-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd_user_action.php
More file actions
80 lines (60 loc) · 1.92 KB
/
add_user_action.php
File metadata and controls
80 lines (60 loc) · 1.92 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
<?
ini_set( "display_errors", 0);
include "utility_functions.php";
$sessionid =$_GET["sessionid"];
verify_session($sessionid);
$sql = "select type ".
"from myclientsession ".
"join myclient on myclient.clientid = myclientsession.clientid ".
"where sessionid='$sessionid'";
$result_array = execute_sql_in_oracle ($sql);
$result = $result_array["flag"];
$cursor = $result_array["cursor"];
if ($result == false){
display_oracle_error_message($cursor);
die("Client Query Failed.");
}
$values = oci_fetch_array ($cursor);
oci_free_statement($cursor);
$type = $values[0];
if ($type == "1" or $type == "2") {
$clientid = trim($_POST["clientid"]);
if ($clientid == "") $clientid = 'NULL';
$password = $_POST["password"];
if ($password == "") $password = 'NULL';
$type = $_POST["q_type"];
if ($type == "0") {
$typename = "student";
}
else if ($type == "1") {
$typename = "administrator";
}
else if ($type == "2") {
$typename = "student administrator";
}
$sql = "insert into myclient values ('$clientid', '$password', '$type', '$typename')";
$result_array = execute_sql_in_oracle ($sql);
$result = $result_array["flag"];
$cursor = $result_array["cursor"];
if ($result == false){
echo "<B>Insertion Failed.</B> <BR />";
display_oracle_error_message($cursor);
die("<i>
<form method=\"post\" action=\"dept_add?sessionid=$sessionid\">
<input type=\"hidden\" value = \"$dnumber\" name=\"dnumber\">
<input type=\"hidden\" value = \"$dname\" name=\"dname\">
<input type=\"hidden\" value = \"$location\" name=\"location\">
Read the error message, and then try again:
<form method=\"post\" action=\"manage_user.php?sessionid=$sessionid\">
<input type=\"submit\" value=\"Go Back\">
</form>
</i>
");
}
Header("Location:manage_user.php?sessionid=$sessionid");
}
else {
echo("Invalid User Type. Click ".
"<A HREF=\"welcomepage.php?sessionid=$sessionid\">here</A> to go back to Welcome Page.");
}
?>