remove register.php since the admin is hard-coded

This commit is contained in:
sehnryr
2022-10-15 19:00:35 +02:00
committed by Youn Mélois
parent 3109df9a3f
commit 0d64bf728c
2 changed files with 0 additions and 57 deletions

View File

@@ -54,7 +54,6 @@ if (isset($_POST['login'])) {
<input type="password" name="password" id="password" required />
<input type="submit" name="login" value="Se connecter" />
</form>
<a href="register.php">Créer un compte</a>
</body>
</html>

View File

@@ -1,56 +0,0 @@
<?php
/**
* PHP version 8.1.11
*
* @author Youn Mélois <youn@melois.dev>
*/
require_once 'resources/config.php';
require_once 'resources/database.php';
require_once LIBRARY_PATH . '/redirect.php';
require_once LIBRARY_PATH . '/exceptions.php';
$db = new Database();
if (isset($_POST['register'])) {
$name = $_POST['name'];
$email = $_POST['email'];
$password = $_POST['password'];
try {
$success = $db->createUser($name, $email, $password);
if ($success) {
redirect('admin.php');
}
} catch (AuthenticationException $e) {
// pass
} catch (DuplicateEmailException $e) {
// pass
}
}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8" />
<title>Interpromos - Inscription</title>
</head>
<body>
<h1>Inscription</h1>
<form action="register.php" method="POST">
<label for="name">Nom</label>
<input type="text" name="name" id="name" required />
<label for="email">Email</label>
<input type="email" name="email" id="email" required />
<label for="password">Mot de passe</label>
<input type="password" name="password" id="password" required />
<input type="submit" name="register" value="S'inscrire" />
</form>
<a href="login.php">Se connecter</a>
</body>
</html>