-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathregistration.php
More file actions
47 lines (30 loc) · 1.29 KB
/
Copy pathregistration.php
File metadata and controls
47 lines (30 loc) · 1.29 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
<?php
session_start();
require_once 'php/connect.php';
$email=$_POST["email"];
$fname=$_POST["fname"];
$lname=$_POST["lname"];
$street=$_POST["street"];
$city=$_POST["city"];
$zipcode=$_POST["zipcode"];
$zipcode=(int)$zipcode;
$isAdmin=0;
$password = $_POST["password"];
$dob = $_POST["dob"];
$password = sha1($password);
if(isset($_POST["email"]) and isset($_POST["fname"]) and isset($_POST["lname"]) and isset($_POST["password"]) and isset($_POST["street"]) and isset($_POST["city"]) and isset($_POST["zipcode"]) and isset($_POST["dob"]) )
{
$sql = "INSERT INTO user(email_id,password,first_name,last_name,address,dob,city,zipcode,admin) VALUES('$email','$password','$fname','$lname','$street','$dob','$city',$zipcode,$isAdmin);";
$result = $conn->query($sql);
if ($result) {
echo "<script>alert('Congratulations, you have registered successfully');window.location.href = 'login.html';</script>";
}
else
{
echo "<script>alert('registration unsuccessful,fill all fields with valid data');window.location.href = 'registration.html';</script>";
}
}
else
{ echo "<script>alert('unable to register, fill all fields with valid data');window.location.href = 'registration.html';</script>";
}
?>