-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsign.php
70 lines (53 loc) · 2.07 KB
/
sign.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
<?php
$con=mysqli_connect("localhost:3308","root","","ecommerce1") or die(mysqli_error($con));
session_start();
if (isset($_POST['button'])) {
$name=mysqli_real_escape_string($con, $_POST['name']);
$email=mysqli_real_escape_string($con, $_POST['email']);
$password=mysqli_real_escape_string($con, $_POST['password']);
$contact=mysqli_real_escape_string($con, $_POST['contact']);
$city=mysqli_real_escape_string($con, $_POST['city']);
$address=mysqli_real_escape_string($con, $_POST['address']);
$pass=md5($password);
$email_pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$";
$query1="select * from users where email = '$email'";
$result1=mysqli_query($con, $query1) or die(mysqli_error($con));
// $row1=mysqli_fetch_array($result1);
$total_s=mysqli_num_rows($result1);
if($total_s == 0)
{
$user_reg="insert into users(name,email,password,contact,city,address) values('$name','$email','$pass','$contact','$city','$address')";
$result=mysqli_query($con, $user_reg) or die(mysqli_error($con));
$_SESSION['email']=$email;
$_SESSION['name']=$name;
$_SESSION['password']=$pass;
$_SESSION['contact']=$contact;
//$_SESSION['message']="you are successfully signed in";
$_SESSION['id']=mysqli_insert_id($con);
header("location:index.php");
}
else{
echo "<center>Account Already Exists</center><br>";
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
<style type="text/css">
</style>
</head>
<body>
<div align="center">
<a href="signup.php" class="btn btn-primary" type="submit" name="button">Try Signing Up again</a>
</div>
</body>
</html>
<?php
//header('location: signup.php?exist_error=This email exists, Please login.');
}
}
?>