forked from howardpchen/capricorn
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfind_user.php
More file actions
124 lines (101 loc) · 4 KB
/
find_user.php
File metadata and controls
124 lines (101 loc) · 4 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
<?php
/*
Capricorn - Open-source analytics tool for radiology residents.
Copyright (C) 2014 (Howard) Po-Hao Chen
This file is part of Capricorn.
Capricorn is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
include 'capricornLib.php';
// Must find resident first
$db_name="localhost"; // Database name
$tbl_name="LoginMember"; // Table name
$res_tbl_name="ResidentIDDefinition";
$myfirstname = $_POST['myfirstname'] or exit();
$mylastname = $_POST['mylastname'];
//$myaccession= $_POST['myaccession'];
$myusername = "";
$db = $resdbConn;
$myfirstname = $db->real_escape_string($myfirstname);
$mylastname = $db->real_escape_string($mylastname);
$myresidentid = -1;
// $sqlquery = "SELECT ResidentFirstName, ResidentLastName, ResidentID FROM ResidentIDDefinition WHERE ResidentFirstName=\"$myfirstname\" AND ResidentLastName=\"$mylastname\";";
$sqlquery = "SELECT COUNT(*) as count FROM $res_tbl_name WHERE FirstName LIKE \"$myfirstname\" AND LastName LIKE \"$mylastname\" AND IsCurrentTrainee=1;";
$results = $db->query($sqlquery);
$row = $results->fetch_array();
if ($row['count'] > 1) {
echo "Please note that there are more than one radiologists by the same name in our system. Contact system administrator for more details.";
// Have to manage duplicate names.
exit();
} else if ($row['count'] == 0) {
echo "An active resident by this exact name is not found in our system. Please note that you must be an active resident and that you must enter the first name as shown in your interpreted radiologic reports." ;
exit();
}
else {
$sqlquery = "SELECT TraineeID FROM $res_tbl_name WHERE FirstName LIKE \"$myfirstname\" AND LastName LIKE \"$mylastname\";";
$results = $db->query($sqlquery);
$row = $results->fetch_array();
$myresidentid = $row['TraineeID'];
$sqlquery = "SELECT COUNT(*) as count FROM $tbl_name WHERE TraineeID=$myresidentid;";
$results = $db->query($sqlquery);
$row = $results->fetch_array();
if ($row['count'] > 0) {
echo "Our records indicate that you already have an account. Contact the administrator to reset your password with any problems.";
exit();
}
}
?>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form name="form1" method="post" action="add_user.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="3"><strong>Capricorn - Create User</strong></td>
</tr>
<tr>
<td colspan="3">
<?php
echo "Welcome, <strong>Dr. $myfirstname $mylastname.</strong> Your records have been identified.<br>";
?>
Please enter a desired username and password.</td>
</tr>
<tr>
<td width="120">Username</td>
<td> </td>
<td><input name="myusername" type="text" id="myusername"></td>
</tr>
<tr>
<td width="120">Password</td>
<td> </td>
<td><input name="mypassword" type="password" id="mypassword"></td>
</tr>
<tr>
<td width="120">Confirm Password</td>
<td> </td>
<td><input name="mypasswordconfirm" type="password" id="mypasswordconfirm"></td>
<?php
echo "<input name='myresidentid' type='hidden' id='myresidentid' value='$myresidentid'>";
echo "<input name='myfirstname' type='hidden' id='myfirstname' value='$myfirstname'>";
echo "<input name='mylastname' type='hidden' id='mylastname' value='$mylastname'>";
?>
</tr>
<tr>
<td colspan=3 align=center><input type="Submit" value="Submit">
</tr>
</table>
</td>
</form>
</tr>
</table>
<?php
include "footer.php"
?>