-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreg.php
73 lines (68 loc) · 1.82 KB
/
reg.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
<?php
session_start();
$db=mysqli_connect("localhost","root","","authenticat");
if(isset($_POST['regbtn'])){
$username=mysql_real_escape_string($_POST['username']);
$email=mysql_real_escape_string($_POST['email']);
$password=mysql_real_escape_string($_POST['password']);
$password2=mysql_real_escape_string($_POST['password2']);
if($password==$password2){
$password=md5($password);//hash
$sql="INSERT INTO users(username,email,password) VALUES('$username','$email','$password')";
mysqli_query($db,$sql);
$_SESSION['message']="your logged in";
$_SESSION['username']=$username;
header("location:login10.php");
}
else{
$_SESSION['message']="The passwords does not match";
}
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>fitness training</title>
<link href="style12.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="header">
<h1 align="center">ACTIVE FITNESS </h1>
</div>
<?php
if (isset($_SESSION['message'])) {
echo "<div id='error_msg'>".$_SESSION['message']."</div>";
unset($_SESSION['message']);
}
?>
<div id="frm">
<form action="reg.php" method="post" >
<table>
<tr>
<td>Username:</td>
<td><input type="text" name="username" class="textInput" required></td>
</tr>
<tr>
<td>Email:</td>
<td><input type="email" name="email" class="textInput" required></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="password" class="textInput" required></td>
</tr>
<tr>
<td>re-Password:</td>
<td><input type="password" name="password2" class="textInput" required></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="regbtn" id="log" value="register"> <b><a class="ac" href="logout.php">Login</a></b></td>
</tr>
</table>
</form>
</div>
</div>
</body>
</html>
<?php