-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathregistration.php
More file actions
106 lines (86 loc) · 3.18 KB
/
registration.php
File metadata and controls
106 lines (86 loc) · 3.18 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
<?php
session_start();
require_once("config.php");
?>
<html>
<head>
<title>Registration</title>
<link rel="stylesheet" type="text/css" href="registration.css">
</head>
<body>
<?php
if(isset($_POST['signup']))
{
$db_host="localhost";
$db_user="root";
$db_pass="";
$db_name="project";
$conn = mysqli_connect($db_host,$db_user,$db_pass,$db_name);
$email=$_POST['email'];
$password=$_POST['password'];
$firstname=$_POST['firstname'];
$lastname = $_POST['lastname'];
$gender = $_POST['gender'];
$msgFlag = "Error";
$_SESSION['reg_msg'] = "Form submitted successfully.";
$_SESSION['reg_location'] = "registration.php";
$_SESSION['reg_msgFlag'] = "Error";
$sql ="select * from registration where email='".$email."' ";
$result= mysqli_query($conn,$sql);
$row=mysqli_fetch_array($result);
$count=mysqli_num_rows($result);
if($count==0)
{
$qry = "INSERT into registration(firstname,lastname,email,password,gender) values(?,?,?,?,?)";
$stmtinsert = $db->prepare($qry);
$result = $stmtinsert->execute([$firstname,$lastname,$email,$password,$gender]);
if($result)
{
$_SESSION['reg_msgFlag'] = "Success";
$_SESSION['reg_location'] = "login.php";
}
else
{
$_SESSION['reg_msg'] = "There were errors saving the data.";
}
}
else
{
$_SESSION['reg_msg'] = "The entered email id is already registered with us.";
}
header('location:registration_act.php');
}
?>
<div class="container">
<form method="post">
<h1>Registration</h1>
<div class="inputs">
<label for="firstname" class="labels"><b>Firstname</b></label><br>
<input class="select" type="text" placeholder="Enter Firstname" name="firstname" autocomplete="off" required>
<br>
<label for="lastname" class="labels"><b>Lastname</b></label><br>
<input class="select" type="text" placeholder="Enter Lastname" name="lastname" autocomplete="off" required>
<br>
<label for="email" class="labels"><b>Email Address</b></label><br>
<input class="select" type="email" placeholder="Enter Email" name="email" autocomplete="off" required>
<br>
<label for="password" class="labels"><b>Password</b></label><br>
<input class="select" type="password" placeholder="Enter Password" name="password" autocomplete="off" required>
<br>
<label class="labels"><b>Gender :</b>
<input type="radio" name="gender" value="male">Male
<input type="radio" name="gender" value="female">Female
<input type="radio" name="gender" value="other">Other
</label>
</div>
<div class="btn">
<button class="btn-success" type="submit" name="signup" id="register" >Sign Up</button>
</div>
</form>
<div class="bottom">
<p class="line"><b>Already a member ?</b>
<button type="button" onclick="window.location.href='login.php'" class="cancelbtn" >Signin</button></p>
</div>
</div>
</body>
</html>