-
Notifications
You must be signed in to change notification settings - Fork 1
/
create-account.php
180 lines (146 loc) · 5.6 KB
/
create-account.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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/animations.css">
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/signup.css">
<title>Create Account</title>
<style>
.container{
animation: transitionIn-X 0.5s;
}
</style>
</head>
<body>
<?php
//learn from w3schools.com
//Unset all the server side variables
session_start();
$_SESSION["user"]="";
$_SESSION["usertype"]="";
// Set the new timezone
date_default_timezone_set('Asia/Kolkata');
$date = date('Y-m-d');
$_SESSION["date"]=$date;
//import database
include("connection.php");
if($_POST){
$result= $database->query("select * from webuser");
$fname=$_SESSION['personal']['fname'];
$lname=$_SESSION['personal']['lname'];
$name=$fname." ".$lname;
$address=$_SESSION['personal']['address'];
$nic=$_SESSION['personal']['nic'];
$dob=$_SESSION['personal']['dob'];
$email=$_POST['newemail'];
$tele=$_POST['tele'];
$newpassword=$_POST['newpassword'];
$cpassword=$_POST['cpassword'];
if ($newpassword==$cpassword){
$sqlmain= "select * from webuser where email=?;";
$stmt = $database->prepare($sqlmain);
$stmt->bind_param("s",$email);
$stmt->execute();
$result = $stmt->get_result();
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{
//TODO
$database->query("insert into patient(pemail,pname,ppassword, paddress, pnic,pdob,ptel) values('$email','$name','$newpassword','$address','$nic','$dob','$tele');");
$database->query("insert into webuser values('$email','p')");
//print_r("insert into patient values($pid,'$email','$fname','$lname','$newpassword','$address','$nic','$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 Conformation Error! Reconform Password</label>';
}
}else{
//header('location: signup.php');
$error='<label for="promter" class="form-label"></label>';
}
?>
<center>
<div class="container">
<table border="0" style="width: 69%;">
<tr>
<td colspan="2">
<p class="header-text">Let's Get Started</p>
<p class="sub-text">It's Okey, Now Create User Account.</p>
</td>
</tr>
<tr>
<form action="" method="POST" >
<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: 0712345678" pattern="[0]{1}[0-9]{9}" >
</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">Confirm Password: </label>
</td>
</tr>
<tr>
<td class="label-td" colspan="2">
<input type="password" name="cpassword" class="input-text" placeholder="Confirm Password" required>
</td>
</tr>
<tr>
<td colspan="2">
<?php echo $error ?>
</td>
</tr>
<tr>
<td>
<input type="reset" value="Reset" class="login-btn btn-primary-soft btn" >
</td>
<td>
<input type="submit" value="Sign Up" class="login-btn btn-primary 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>
</tr>
</table>
</div>
</center>
</body>
</html>