This repository has been archived by the owner on Nov 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
saveAccount.php
73 lines (60 loc) · 1.76 KB
/
saveAccount.php
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
<?php
include_once 'head.php';
if(isset($_POST['firstname']) && isset($_POST['lastname'])
&& isset($_POST['username']) && isset($_POST['password'])
&& isset($_POST['DOB']) && isset($_POST['doctorStatus'])
&& isset($_POST['email']))
{
$firstName = $_POST['firstname'];
$lastName = $_POST['lastname'];
$userName = $_POST['username'];
$passwordEntered = $_POST['password'];
$DOB = $_POST['DOB'];
$email = $_POST['email'];
$doctorStatus = $_POST['doctorStatus'];
}
else
{
echo "<div class = 'error'>There was an error when attempting to create your Account, please try again. <br />";
include_once 'createAccount.php';
die();
}
if($doctorStatus == 'yes')
{
$doctorStatus = true;
}
else
{
$doctorStatus = false;
}
if($doctorStatus)
{
if(isset($_POST['education']) && isset($_POST['hospital'])
&& isset($_POST['specialty']))
{
$education = $_POST['education'];
$hospital = $_POST['hospital'];
$specialty = $_POST['specialty'];
}
else
{
echo "<div class = 'error'>There was an error when attempting to create your Account, please try again. <br /></div>";
include_once 'createAccount.php';
die();
}
}
$passwordToSave = sha1($passwordEntered);
makeQuery("INSERT INTO members VALUES ('$userName', '$passwordToSave',
'$firstName', '$lastName', '$DOB', '$email', '$doctorStatus')");
if ($doctorStatus)
{
makeQuery("INSERT INTO doctors VALUES ('$userName', '$hospital',
'$specialty', '$education')");
}
echo "<h2>Congratulations, you have successfully created an account</h2>";
$_SESSION['user'] = $enteredUsername;
$_SESSION['pass'] = $enteredPass;
$logInStatus = TRUE;
header("Location: http://ec2-54-200-14-50.us-west-2.compute.amazonaws.com/DocConnect/index.php");
die("You are now logged in. Please <a href='index.php'>Click Here</a> To Continue");
?>