View sourcecode

The following files exists in this folder. Click to view.

signup.php

58 lines ASCII Unix (LF)
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
<?php
session_start
();
require_once 
"functions/database.php";

if(isset(
$_POST["submit"])){
    
$db->query("INSERT INTO `accountData`(`username`, `password`, `mail`, `isAdmin`) VALUES (:username, :password, :mail, 0)"
    array(
        
"username"=>$_POST["username"],
        
"password"=>hash("sha256"$_POST["password"], false),
        
"mail"=>$_POST["mail"]
    ));
    
$userID $db->getLastId();
    
header("location: index.php");
}
?>

<!DOCTYPE html>
<html lang="en" data-bs-theme="dark">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Sign up</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB" crossorigin="anonymous">
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js"
        integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI"
        crossorigin="anonymous"></script>
</head>

<body>
    <?php include "page/navbar.php" ?>
    <div class="container">
        <br>
        <h1>Sign up</h1><br>
        <form action="" method="POST">
            <label for="username" class="form-label">Username</label>
            <div class="input-group mb-3">
                <input type="text" id="username" name="username" class="form-control" placeholder="Username"
                    aria-label="Username" aria-describedby="basic-addon1" required>
            </div>
            <br>
            <label for="password" class="form-label">Password</label>
            <div class="input-group mb-3">
                <input type="password" id="password" name="password" class="form-control" placeholder="Password"
                    aria-label="Password" aria-describedby="basic-addon1" required>
            </div>
            <label for="password" class="form-label">Mail</label>
            <div class="input-group mb-3">
                <input type="text" id="mail" name="mail" class="form-control" placeholder="Mail"
                    aria-label="Mail" aria-describedby="basic-addon1" required>
            </div>
            <input type="submit" name="submit" class="btn btn-primary" value="Sign up">
        </form>
    </div>
</body>

</html>