Files
AIidE/php/auth/register.php
Dupard 3ba56a592a SQL
2021-09-09 23:55:45 +02:00

46 lines
1.6 KiB
PHP
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
session_start();
if(isset($_SESSION['auth']))
{
header('Location: ../../');
}
if(isset($_POST['register']))
{
$mail = filter_input(INPUT_POST, 'mail', FILTER_VALIDATE_EMAIL | FILTER_SANITIZE_EMAIL);
if($mail)
{
$promo = filter_input(INPUT_POST, 'promo', FILTER_VALIDATE_INT | FILTER_SANITIZE_NUMBER_INT);
if($promo)
{
$pass = filter_input(INPUT_POST, 'passwd', FILTER_SANITIZE_STRING);
register($mail, $promo, password_hash($pass, PASSWORD_DEFAULT));
header("Location: login.php");
}
}
}
include "../templates/header.php";
?>
<form method="POST">
<label for="mail">Mail</label>
<input type="email" id="mail" name="mail" placeholder="Votre adresse mail" required value="<?php if(isset($error)) echo $_POST['mail'] ?>"/>
<label for="promo">Promo</label>
<input type="number" id="promo" name="promo" placeholder="Votre année de sortie du BUT" required min="1996" max="<?php $now = date("Y") + 3; echo $now; ?>" />
<label for="passwd">Mot de passe</label>
<input type="passwd" id="passwd" name="passwd" placeholder="Votre mot de passe" minlength="6" required value="<?php if(isset($error)) echo $_POST['passwd'] ?>" />
<label for="conf_passwd">Confirmer votre mot de passe</label>
<input type="passwd" id="conf_passwd" name="conf_passwd" placeholder="Confirmation du mot de passe" minlength="6" required />
<input type="hidden" name="register" value="true" />
<input type="submit" value="valider">
</form>
<a href="login.php">Déjà inscrit ? Connectez-vous !</a>
<?php include "../templates/footer.php" ?>