-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathregistration.php
More file actions
85 lines (81 loc) · 3.27 KB
/
registration.php
File metadata and controls
85 lines (81 loc) · 3.27 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
<?php
/**
* For PHP Bootstrap login.
*
* PHP version: 7.1.9
*
* Create a Sample of Bootstrap login for localhost
* pratice to learn how to use login.
* it not recomment to use online as security flaw on md5
* require auth.php file on all secure pages
*
* @category PHP
* @package Bootstrap_Login_PHP
* @author Steven Smith <jedistev@gmail.com>
* @copyright 2018 nah ltd
* @license https://github.com/jedistev/PHPmysqlBootstrapLogin/blob/master/LICENSE
* License
* @link https://github.com/jedistev/PHPmysqlBootstrapLogin
*/
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php include 'nav/meta.php'; ?>
<?php include 'nav/css.php'; ?>
<link href="css/signin.css" rel="stylesheet">
</head>
<body>
<?php
require('config/config.php');
// If form submitted, insert values into the database.
if (isset($_REQUEST['username'])){
// removes backslashes
$username = stripslashes($_REQUEST['username']);
//escapes special characters in a string
$username = mysqli_real_escape_string($conn,$username);
$email = stripslashes($_REQUEST['email']);
$email = mysqli_real_escape_string($conn,$email);
$password = stripslashes($_REQUEST['password']);
$password = mysqli_real_escape_string($conn,$password);
$trn_date = date("Y-m-d H:i:s");
$query = "INSERT into `users` (username, password, email, trn_date)
VALUES ('$username', '".md5($password)."', '$email', '$trn_date')";
$result = mysqli_query($conn,$query);
if($result){
echo "<div class='form text-center'>
<h3>You are registered successfully.</h3>
<br/>Click here to <a href='login.php'>Login</a></div>";
}
}else{
?>
<div class="container">
<form class="form-signin"
name="registration"
action=""
method="post">
<h2 class="form-signin-heading">Registration</h2>
<input class="form-control"
type="text"
name="username"
placeholder="Username" required />
<input class="form-control"
type="email"
name="email"
placeholder="Email" required />
<input class="form-control"
type="password"
name="password"
placeholder="Password" required />
<input class="btn btn-lg btn-primary btn-block"
type="submit"
name="submit"
value="Register" />
</form>
<p class="text-center">Already Registered
<a href='login.php'>Back to Login Pages</a>
</p>
</div>
<?php } ?>
</body>
</html>