-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate-account.php
More file actions
executable file
·157 lines (136 loc) · 6.32 KB
/
create-account.php
File metadata and controls
executable file
·157 lines (136 loc) · 6.32 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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>CuraConnect</title>
<link href="assets/css/style.css" rel="stylesheet" />
<link href="assets/css/style-common.css" rel="stylesheet" />
</head>
<body>
<!--header-->
<?php
include('includes/header.php');
include('includes/connection.php');
session_start();
$_SESSION['user'] = '';
$_SESSION['usertype'] = '';
// Set the new timezone
date_default_timezone_set('Asia/Kolkata');
$date = date('Y-m-d');
$_SESSION['date'] = $date;
if ($_POST) {
$result = $database->query('select * from users');
$fname = $_SESSION['personal']['fname'];
$lname = $_SESSION['personal']['lname'];
$name = $fname . ' ' . $lname;
$address = $_SESSION['personal']['address'];
$dob = $_SESSION['personal']['dob'];
$email = $_POST['newemail'];
$tele = $_POST['tele'];
$newpassword = $_POST['newpassword'];
$cpassword = $_POST['cpassword'];
if ($newpassword == $cpassword) {
$result = $database->query("select * from users where email='$email';");
if ($result->num_rows == 1) {
$error = '<label for="promter" class="form-label" style="color:rgb(255, 62, 62);text-align:center;">Already have an account for this Email address.</label>';
} else {
$database->query("insert into patient(pemail, pname, ppassword, paddress, pdob, ptel) values('$email', '$name', '$newpassword', '$address', '$dob', '$tele');");
$database->query("insert into users values('$email','p')");
print_r("insert into patient values($pid, '$email', '$fname', '$lname', '$newpassword', '$address', '$dob', '$tele');");
$_SESSION['user'] = $email;
$_SESSION['usertype'] = 'p';
$_SESSION['username'] = $fname;
header('Location: patient/index.php');
$error = '<label for="promter" class="form-label" style="color:rgb(255, 62, 62);text-align:center;"></label>';
}
} else {
$error = '<label for="promter" class="form-label" style="color:rgb(255, 62, 62);text-align:center;">Password does not match, Please Try again!</label>';
}
} else {
// header('location: signup.php');
$error = '<label for="promter" class="form-label"></label>';
}
?>
<!--header end-->
<!--create account section-->
<section class="login-section">
<center>
<div class="login-block">
<h2>Let's Get Started</h2>
<p class="sub-text">It's Okay, Now Create User Account.</p>
<div class="login-form">
<table border="0" style="width: 69%">
<form action="" method="POST">
<tr>
<td class="label-td" colspan="2">
<label for="newemail" class="form-label">Email: </label>
</td>
</tr>
<tr>
<td class="label-td" colspan="2">
<input type="email" name="newemail" class="input-text" placeholder="Email Address"
required />
</td>
</tr>
<tr>
<td class="label-td" colspan="2">
<label for="tele" class="form-label">Mobile Number: </label>
</td>
</tr>
<tr>
<td class="label-td" colspan="2">
<input type="tel" name="tele" class="input-text" placeholder="Ex: 9123456789" />
</td>
</tr>
<tr>
<td class="label-td" colspan="2">
<label for="newpassword" class="form-label">Create New Password:
</label>
</td>
</tr>
<tr>
<td class="label-td" colspan="2">
<input type="password" name="newpassword" class="input-text"
placeholder="New Password" required />
</td>
</tr>
<tr>
<td class="label-td" colspan="2">
<label for="cpassword" class="form-label">Conform Password:
</label>
</td>
</tr>
<tr>
<td class="label-td" colspan="2">
<input type="password" name="cpassword" class="input-text"
placeholder="Conform Password" required />
</td>
<tr>
<td colspan="2"><br><?php echo $error ?></td>
</tr>
<td class="td-btn">
<input type="reset" value="Reset" class="login-btn common-light-btn" />
</td>
<td class="td-btn">
<input type="submit" value="Next" class="login-btn common-btn" />
</td>
</tr>
<tr>
<td colspan="2">
<br />
<label for="" class="sub-text" style="font-weight: 280">Already have an account?
</label>
<a href="login.php" class="hover-link1 non-style-link">Login</a>
<br /><br /><br />
</td>
</tr>
</form>
</table>
</div>
</div>
</center>
</section>
<!--create account section end-->
</body>
</html>