-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate-account.php
More file actions
208 lines (160 loc) · 6.76 KB
/
Copy pathcreate-account.php
File metadata and controls
208 lines (160 loc) · 6.76 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<!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
//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");
$doc = $_SESSION["date"];
$file = 'signup.json';
$jsonData = file_get_contents($file);
$personalData = json_decode($jsonData, true);
$fname = $personalData['fname'];
$lname = $personalData['lname'];
$name=$fname." ".$lname;
$contact = $personalData['contact_no'];
$address = $personalData['address'];
$company_type = $personalData['company_type'];
$company_name = $personalData['company_name'];
$company_position = $personalData['company_position'];
$client_status = $personalData['client_status'];
//$profile_pic = $personalData['profile-pic'];
$profile_pic = $_FILES["profile-pic"]["name"];
//$profile_pic_tempname = ['profile-pic-tempname'];
//$profile_pic_folder = "img" . $profile_pic;
$email=$_POST['newemail'];
$newpassword=$_POST['newpassword'];
$cpassword=$_POST['cpassword'];
if ($newpassword==$cpassword){
$result= $database->query("select * from webuser where email='$email';");
if($result->num_rows==1){
$error='<label for="prompt" class="form-label" style="color:rgb(255, 62, 62);text-align:center;">Already have an account for this Email address.</label>';
}else{
if (is_uploaded_file($_FILES['profile-pic']['tmp_name'])) {
$profile_pic = $_FILES['profile-pic']['name'];
$profile_pic_folder = "img/profile_pic/" . $profile_pic;
if (move_uploaded_file($_FILES['profile-pic']['tmp_name'], $profile_pic_folder)) {
// File uploaded successfully
$database->query("insert into client(cemail,cname,cpassword,cdoc,ccontact,caddress,ctype,cstatus,ccompany_name,ccompany_position,cprofile_pic) values('$email','$name','$newpassword','$doc','$contact','$address','$company_type','$client_status','$company_name','$company_position','$profile_pic')");
$database->query("insert into webuser values('$email','c')");
$_SESSION["user"]=$email;
$_SESSION["usertype"]="c";
$_SESSION["username"]=$fname;
header('Location: client/index.php');
} else {
// Error uploading file
$error='<label for="prompt" class="form-label" style="color:rgb(255, 62, 62);text-align:center;">Error uploading file.</label>';
}
} else {
// File not uploaded
$error='<label for="prompt" class="form-label" style="color:rgb(255, 62, 62);text-align:center;">File not uploaded.</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" enctype="multipart/form-data" >
<!--profile pic-->
<tr>
<td class="label-td" colspan="2">
<label for="profile-pic" class="form-label">Upload your photo </label>
</td>
</tr>
<td class="label-td" colspan="2">
<input type="file" name="profile-pic" class="input-text" placeholder="upload picture" required>
</td>
</tr>
<td class="label-td" colspan="2">
<label for="newemail" class="form-label">Email: </label>
</td>
</tr>
<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="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>
<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="client_login.php" class="hover-link1 non-style-link">Login</a>
<br><br><br>
</td>
</tr>
</form>
</tr>
</table>
</div>
</center>
</body>
</html>