update without story 4 #2
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
// Story 0: request to find all username
/*
$stmt = ...
$stmt->execute();
$users = $stmt->fetchAll();
*/
CREATE TABLE user(
$e->getMessage() ) ); die(); } $dbh = new PDO($dsn, $userofdb, $passwordofdb); ?> = 4) { if(isset ($_POST["password"])){ $pattern = '/^(?=.*[!@#$%^&*-])(?=.*[0-9])(?=.*[A-Z]).{8,20}$/ '; if (preg_match($pattern, $password)) { $user = $dbh->prepare('SELECT * FROM user WHERE email = :email'); $user->execute(['email' => $email]); $useer = $user->fetch(); if (empty($user)){ $options = [ 'cost' => 12, ]; $passwordhash = password_hash($password, PASSWORD_BCRYPT, $options); $insert = $dbh->prepare('INSERT INTO user (email, name, password) VALUES (:email, :name, :password)'); $redirect = $insert->execute(array( 'email' => $email, 'name' => $name, 'password' => $password )); if($redirect){ header("Location: login.php"); } }else{ echo "Votre compte existe."; } } ?> prepare('SELECT * FROM user WHERE email = :email and password = :password'); $query->execute(['email' => $email, 'password' => $password]); $query = $query->fetch(); $newquery=$dbh->prepare('UPDATE user SET name=:newname WHERE id=:id'); $newquery->execute(['newname' => $newname, 'id' => $query[0]]); } ?> prepare('delete from user WHERE email = :email and password = :password'); $query->execute(['email' => $email, 'password' => $password]); $query = $query->fetch(); } ?> <title>Document</title>id INT not null PRIMARY KEY,
name VARCHAR(255) UNIQUE,
password VARCHAR(255),
date_time_inscription DATETIME,
date_time_last_connexion DATETIME
);