Skip to content
Snippets Groups Projects
Commit ce5afd69 authored by CHETTAH YASMINE's avatar CHETTAH YASMINE
Browse files

rendu final exam bonnes vacances

parent 53ecbe23
Branches
No related merge requests found
......@@ -6,3 +6,49 @@
*/
require_once __DIR__ . '/../db/Database.php';
if(!empty($_POST)){
//On vérifie que tous les champs ont été remplis
if(isset($_POST["username"],$_POST["email"],$_POST["mdp"]) && !empty($_POST["username"])&&
!empty($_POST["email"])&& !empty($_POST["mdp"])){
//le formulaire est complet
//On récupère les infos en les protégeant
$password = htmlspecialchars($_POST['password']);
$username = htmlspecialchars($_POST['username']);
if (preg_match('#^[a-z0-9.-_]+@[a-z0-9.-_]+\.[a-z]{2,}$#', $username) &&
strlen($username) <= 255 &&
strlen($password) >= 8
) {
try {
$statement = $pdo->prepare("
INSERT INTO user ('username', 'password')
VALUES (:username, :password)");
$statement->bindValue(':username', $username);
$statement->bindValue(':password', password_hash($password, password_BCRYPT));
$statement->execute();
header('Location: http://localhost:8000/login.php');
} catch (PDOException $exception) {
die("Le formulaire est incomplet");
}
}
else{
die("Le formulaire est incomplet");
}
}}
......@@ -19,6 +19,8 @@ main {
margin: 0 4rem; }
main section a {
color: black; }
main section a article {
height: 100%;
display: flex;
......@@ -28,6 +30,26 @@ main {
background-color: var(--color-primary-transparent);
box-sizing: border-box;
border-radius: 1rem; }
@media all and (min-width : 750px){
#main_section a article{
width: 750px ;
grid-template-columns: repeat(2,1fr);
grid-gap: 20px;
}
}
@media all and (min-width : 1200px){
#main_section nav{
width: 1200px ;
grid-template-columns: repeat(4,1fr);
}
}
main section a article header {
position: relative;
height: 200px;
......@@ -36,6 +58,8 @@ main {
align-items: stretch;
justify-content: center;
width: 100%; }
main section a article header img {
left: 0;
right: 0;
......@@ -46,12 +70,15 @@ main {
border-radius: 1rem 1rem 0 0;
position: absolute;
z-index: -1; }
main section a article header h3 {
padding: 1rem 0;
text-align: center;
width: 100%;
font-size: 2rem;
background-color: rgba(255, 255, 255, 0.5); }
main section a article p {
padding: 0.75rem;
font-size: 0.75rem; }
......
......@@ -19,6 +19,30 @@ require_once __DIR__ . '/assets/template/nav.php';
?>
<!-- ajouter un formulaire pour permettre à l'utilisateur de s'inscrire sur le site. Attention un style existe déjà, utilisez une structure pour permettre de l'adapter au mieux. -->
<main>
<div>
<h2>Inscription</h2>
<form method="post" action="assets/actions/register.php">
<label>
<input type="text" name="username" placeholder="Pseudo">
</label>
<label>
<input type="password" name="password" placeholder="Mot de passe">
</label>
<button type="submit">S'inscrire</button>
</form>
</div>
</main>
<?php
require_once __DIR__ . '/assets/template/footer.php';
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment