-
Notifications
You must be signed in to change notification settings - Fork 1
/
registrarse.php
65 lines (65 loc) · 2.29 KB
/
registrarse.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
<?php
// require_once ("Includes/simplecms-config.php");
// require_once ("Includes/connectDB.php");
// include("Includes/header.php");
//
// if (isset($_POST['submit'])){
// $username = $_POST['username'];
// $password = $_POST['password'];
// $query = "INSERT INTO users (username, password) VALUES (?, SHA(?))";
//
// $statement = $databaseConnection->prepare($query);
// $statement->bind_param('ss', $username, $password);
// $statement->execute();
// $statement->store_result();
//
// $creationWasSuccessful = $statement->affected_rows == 1 ? true : false;
// if ($creationWasSuccessful)
// {
// $userId = $statement->insert_id;
//
// $addToUserRoleQuery = "INSERT INTO users_in_roles (user_id, role_id) VALUES (?, ?)";
// $addUserToUserRoleStatement = $databaseConnection->prepare($addToUserRoleQuery);
//
// // TODO: Extract magic number for the 'user' role ID.
// $userRoleId = 2;
// $addUserToUserRoleStatement->bind_param('dd', $userId, $userRoleId);
// $addUserToUserRoleStatement->execute();
// $addUserToUserRoleStatement->close();
//
// $_SESSION['userid'] = $userId;
// $_SESSION['username'] = $username;
// header ("Location: index.php");
// }
// else
// {
// echo "Failed registration";
// }
// }
?>
<div id="main">
<h2>Register an account</h2>
<form action="register.php" method="post">
<fieldset>
<legend>Register an account</legend>
<ol>
<li>
<label for="username">Username:</label>
<input type="text" name="username" value="" id="username" required/>
</li>
<li>
<label for="password">Password:</label>
<input type="password" name="password" value="" id="password" required/>
</li>
</ol>
<input type="submit" name="submit" value="Submit" required/>
<p>
<a href="index.php">Cancel</a>
</p>
</fieldset>
</form>
</div>
</div> <!-- End of outer-wrapper which opens in header.php -->
<?php
include ("Includes/footer.php");
?>