-
Notifications
You must be signed in to change notification settings - Fork 0
/
signup.php
158 lines (139 loc) · 5.08 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<?php
require_once "db_connection/link.php";
if ($link->connect_error) {
die("Connection failed: " . $link->connect_error);
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1">
<title>PSG | Sign up</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="css\font-awesome.min.css">
<script src="js/javascript.js"></script>
<style>
body{
background-color: #131929;
}
.container{
width: 500px;
height: 450px;
text-align: center;
margin: 0 auto;
background-color: rgba(44, 62, 80, 1);
margin-top: 100px;
margin-bottom: 100px;
}
.container img{
width: 150px;
height: 150px;
margin-top: -60px;
}
input[type="text"], input[type="password"], input[type="date"], input[type="email"]{
margin-top: 15px;
height: 25px;
width: 200px;
font-size: 16px;
margin-bottom: 5px;
background-color: #fff;
padding-left: 10px;
}
label, h3{
color: white;
}
</style>
</head>
<body>
<!-- Header START-->
<div class="header">
<a id="logo" class="logo" href="index.php"><img src='img/logo.png' width="85px" height="85px"></a>
<div class="topnav" id="myTopnav">
<a href="index.php">Home</a>
<a href="history.php">History</a>
<a href="players-page.php">Players</a>
<a href="tickets.php">Buy tickets</a>
<a href="about-us.php">About us</a>
<?php
if($_SESSION["user"] == "admin") {
?>
<a href="admin-page.php">Admin page</a>
<?php } ?>
<?php
if(empty($_SESSION["user"])) {
?>
<form action="login.php"><a href="login.php">Login</a></form>
<form action="signup.php"><a class="active" href="signup.php">Sign up</a></form>
<?php }else { ?>
<form action="cartshow.php"><a href="cartshow.php">Cart</a></form>
<form action="exit.php"><a href="exit.php">Logout<?php echo " (". $_SESSION["user"] . ")" ?></a></form>
<?php } ?>
<a href="javascript:void(0);" class="icon" onclick="responsive()">
<i class="fa fa-bars"></i>
</a>
</div>
<span class="quote">ICI C'EST PARIS</span>
</div>
<!-- Header END-->
<!--Sign in START-->
<div class="row">
<div class="container">
<img src="img/login-ava.png">
<form method="post" action="<?php echo $_SERVER["PHP_SELF"];?>">
<label for="fname">First name:</label>
<input type="text" name="fname" placeholder="First name..." required><br>
<label for="lname">Last name:</label>
<input type="text" name="lname" placeholder="Last name..." required><br>
<label for="date_of_birth">Date of birth:</label>
<input type="date" name="date_of_birth" placeholder="Date of birth..." required><br>
<label for="email">Email:</label>
<input type="email" name="email" placeholder="Email..." required><br>
<label for="username">Username:</label>
<input type="text" name="username" placeholder="Username..." required><br>
<label for="password">Password:</label>
<input type="password" name="password" placeholder="Password..." required><br><br>
<input type="submit" name="Submit" value="SIGN UP" class="btn btn-primary">
</form>
</div>
</div>
<!--Sign in END-->
<?php
require_once "db_connection/link.php";
if(isset($_POST['Submit'])){
$username = $_POST['username'];
$password = $_POST['password'];
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$date = $_POST['date_of_birth'];
$email = $_POST['email'];
$sql = "SELECT * FROM users WHERE username='$username'";
$result = mysqli_query($link, $sql);
if(mysqli_num_rows($result) == 1){
echo '<script language="javascript">';
echo 'alert("This username already exists!")';
echo '</script>';
}
else{
$reg = "INSERT INTO users(fname, lname, date_of_birth, email, username, password) VALUES ('$fname', '$lname', '$date', '$email', '$username', '$password')";
mysqli_query($link, $reg);
echo '<script language="javascript">';
echo 'alert("You are registered successfully!")';
echo '</script>';
}
}
?>
<!--Footer START-->
<div class="footer">
<div class="footerimg">
<img src="https://billetterie.psg.fr/sites/psg7.ap2s.fr/themes/psg7/images/logo-footer.png" style="text-align:center;">
</div>
<div class="footertext">
<p>Author: Azimkhan Kuat ©</p>
<p>Group: IT-1901</p>
</div>
</div>
<!--Footer END-->
</body>
</html>