-
Notifications
You must be signed in to change notification settings - Fork 7
/
lawyer_signup.php
111 lines (97 loc) · 4.22 KB
/
lawyer_signup.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Lawyer-signup</title>
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
crossorigin="anonymous">
<link rel="stylesheet" href="public/css/signup.css">
<link rel = "icon"
href = "public/images/statue.jpg"
type = "image/x-icon">
</head>
<body>
<?php
if(isset($_POST["lawyer-signup"])){
$firstname=($_POST["lawyer-firstname"]);
$lastname=($_POST["lawyer-lastname"]);
$email=($_POST["lawyer-email"]);
$password=($_POST["lawyer-password"]);
require_once("includes/db.php");
$con;
if ($con) {
$stmt = $con->prepare("SELECT * FROM lawyer_login WHERE lawyer_email = ?");
$stmt->bind_param('s', $email);
$stmt->execute();
$stmt->store_result();
$numRows = $stmt->num_rows;
if ($numRows > 0) {
echo "Email already used.";
}
else{
$hashedpwd = password_hash($password, PASSWORD_BCRYPT);
$stmt = $con->prepare("INSERT INTO lawyer_login(lawyer_first_name, lawyer_last_name, lawyer_email, lawyer_password)
VALUES (?,?,?,?)");
$stmt->bind_param('ssss', $firstname, $lastname, $email, $hashedpwd);
$stmt->execute();
if ($stmt->affected_rows === -1) {
echo "Error";
exit();
} else {
$stmt->close();
echo "signuped lawyer";
Header("Location: lawyer_login.php");
exit();
}
}
}
}
?>
<form action="lawyer_signup.php" method="post" style="border:1px solid #ccc">
<div class="container">
<h1>Sign Up for Lawyers</h1>
<p>Please fill in this form to create an account.</p>
<hr>
<label for="name"><b>First Name</b></label>
<input type="text" placeholder="First Name" name="lawyer-firstname" required>
<label for="name"><b>Last Name</b></label>
<input type="text" placeholder="Last Name" name="lawyer-lastname" required>
<label for="email"><b>Email</b></label>
<input type="text" placeholder="Enter Email" name="lawyer-email" required>
<label for="psw"><b>Password</b></label>
<input type="password" placeholder="Enter Password" name="lawyer-password" id="pass" required>
<label>
<input type="checkbox" checked="checked" name="remember" style="margin-bottom:15px"> Remember me
</label>
<u class="custom-switch btn" >
<input type="checkbox" class="custom-control-input" onclick="showPass()" id="customSwitches" >
<label class="custom-control-label" for="customSwitches">Show Password</label>
</u>
<p>By creating an account you agree to our <a href="#" style="color:dodgerblue">Terms & Privacy</a>.</p>
<div class="clearfix">
<button type="button" class="cancelbtn" onclick="window.location.href='index.php'">
Cancel
</button>
<button type="submit" name="lawyer-signup" class="signupbtn">Sign Up</button>
</div>
<a href="lawyer_login.php"> Have account? Login </a>
</div>
</form>
<script>
function showPass() {
var x = document.getElementById("pass");
if (x.type === "password") {
x.type = "text";
} else {
x.type = "password";
}
}
</script>
</body>
</html>