-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRegistration.php
More file actions
70 lines (62 loc) · 2.57 KB
/
Copy pathRegistration.php
File metadata and controls
70 lines (62 loc) · 2.57 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
<!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>Registration Page</title>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css">
<link rel="stylesheet" href="assets/style.css">
</head>
<body>
<?php
session_start();
?>
<div id="wrapper">
<span class="form-container">
<span class="form-heading">Sign Up</span>
<form action="Registration.php" method="POST">
<div class="input-group">
<i class="fas fa-user"></i>
<input type="text" placeholder="Username" name="username" required>
<span class="bar"></span>
</div>
<div class="input-group">
<i class="fas fa-envelope"></i>
<input type="email" placeholder="Email" name="email" required>
<span class="bar"></span>
</div>
<div class="input-group">
<i class="fas fa-lock"></i>
<input type="password" placeholder="Password" name="password" required>
<span class="bar"></span>
</div>
<div class="input-group">
<input class="button" type="submit" name="submit" value="Register">
</div>
<div class="switch-login">
<a href="Login.php">Already have an account? <span>Login</span></a>
</div>
</form>
<?php
include_once ('./Crud.php');
$crud = new Crud();
if(isset($_POST['submit'])){
$username = $_POST['username'];
$email = $_POST['email'];
$password = md5($_POST['password']);
$result = $crud->execute("INSERT into registration(username, email, password) VALUES('$username','$email','$password')");
if($result){
$_SESSION['email'] = $email;
$_SESSION['username'] = $username;
header("Location:ViewAccountInfo.php");
}else{
echo "Insertion Problem!";
}
}
?>
</span>
</div>
</body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
</html>