24 lines
672 B
PHP
24 lines
672 B
PHP
<?php
|
|
|
|
require_once("lib/getPDD.php");
|
|
|
|
$bdd = getPDO();
|
|
|
|
if ($bdd instanceof PDO) {
|
|
try {
|
|
$req = $bdd->prepare("SELECT * FROM Utilisateur WHERE nom = ?");
|
|
$req->execute(array($username));
|
|
|
|
if ($req->fetch())
|
|
$alert = choixAlert("register");
|
|
else {
|
|
$req->closeCursor();
|
|
$req = $bdd->prepare("INSERT INTO Utilisateur (nom, nbRepet, mot) values (?, ?, ?)");
|
|
$req->execute(array($username, $nb, $word));
|
|
}
|
|
$req->closeCursor();
|
|
} catch (Exception $e) {
|
|
$alert = choixAlert("query");
|
|
}
|
|
} elseif ($bdd instanceof Exception)
|
|
$alert = choixAlert("connexion");
|