1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| <?php
$info_error = false;
if (isset($_POST["postaction"])) {
$info_log = $_POST['login'];
$info_mdp = $_POST['mdp'];
if ((empty($info_log)) or (empty($info_mdp))) {
$info_error = true
}
else {
if (tryconnect ($info_log, $info_mdp)) {
echo '<script>alert("connecté")</script>';
}
else {
$info_error = true;
}
}
}
function tryconnect ($log, $pass) {
#Connexion à la DB (fonctionnel)
#Si réussite, retourne True, si échec, retourne False.
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head></head>
<body>
<div id = "bar"></div>
<?php
if ($info_error = true) {
print ('<div id = "error" style =""><img src = "erreur.png" alt = "Erreur. Remplissez les champs de nouveau."></div>');
}
?>
<form id = "connect" action="#" method="post">
Tous les contrôles
</form>
</body>
</html> |