-
Notifications
You must be signed in to change notification settings - Fork 0
/
_signup.php
99 lines (94 loc) · 4.44 KB
/
_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
<?php
$passNoM = "";
$emaiAllRead="";
if($_SERVER["REQUEST_METHOD"] == "POST"){
require("php/php_files/check_user_input.php");
require("php/php_files/dbHelper.php");
$userName = checkInput($_POST["name"]);
$userEmail = checkInput($_POST["email"]);
$pass1 = checkInput($_POST["pass1"]);
$pass2 = checkInput($_POST["pass2"]);
if($pass1 == $pass2){
$myDb = new DBaseHelper();
$con = $myDb->getConnection();
$queryOfNewUser = "INSERT INTO users VALUES('','$userName','$userEmail','$pass1',2)";
// $querOfUsers = "INSERT INTO users VALUES('','$userEmail','$pass1')";
// $queryOfTypeOfUsers = "INSERT INTO type_of_user VALUES('$userEmail',2)";
if($con->query($queryOfNewUser)){
session_start();
$_SESSION["auth_user"] = "true";
$_SESSION["user_name"] = $userName;
$_SESSION["welcome"] = "true";
header('location:php_user_login/welcome_user.php');
}else{
session_start();
session_unset();
session_destroy();
$emaiAllRead = "Email Already Exist Try New !";
}
$myDb->disconnect();
}else{
$passNoM = "Password Not Match";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>ONX SignUp</title>
<link type="x-icon" rel="icon" href="images/icons/x-icon.png">
<link type="text/css" rel="stylesheet" href="css/bootstrap.min.css">
<link type="text/css" rel="stylesheet" href="css/signup.css">
</head>
<body>
<div class="container">
<h1 id="user_icon" class="text-center"><span class="glyphicon glyphicon-user"></span></h1>
</div>
<div class="container">
<div class="row text-center">
<div class="col-md-4 col-lg-4 col-md-offset-4 col-lg-offset-4" id="login-box">
<h2>SignUp</h2>
<br>
<form role="form" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post">
<div class="form-group">
<h3>User name</h3>
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input type="text" class="form-control" placeholder="User_name" name="name">
</div>
</div>
<div class="form-group">
<h3>Email</h3>
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></span>
<input type="email" class="form-control" placeholder="[email protected]" name="email">
</div>
<p class="text-danger"><strong><?=$emaiAllRead; ?></strong></p>
</div>
<div class="form-group">
<h3>Password</h3>
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
<input type="password" class="form-control" placeholder="****" name="pass1">
</div>
</div>
<div class="form-group">
<h3>Retype Password</h3>
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
<input type="password" class="form-control" placeholder="****" name="pass2">
</div>
<p class="text-danger"><strong><?=$passNoM; ?></strong></p>
</div>
<div class="form-group">
<input type="submit" value="SignUp" class="btn btn-primary" id="submitbtn">
</div>
</form>
<p class="text-warning"><strong>Already Registerd ?</strong><a href="_login.php"> Click here</a></p>
</div>
</div>
</div>
</body>
</html>