1 pièce(s) jointe(s)
J-Notify (message d'erreur)
Bonjour,
Je suis un etudiant en informatique et je suis sur un projet. Je voudrai afficher un message d'erreur apres une tentative de connexion echoué ( faux username ou faux password). Et apres mes recherches j'a trouve que je peux utiliser J-Notify pour afficher un message d'erreur convivial. Mais je ne sais pas comment l'introduire dans mes fichiers HTML. J'ai essaye mais il ne s'affiche pas.
Voici les resultats de mon projet:
Pièce jointe 185335
Et voici mes codes:
INDEX.PHP
Code:
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
|
<?php
session_start();
include ('election.php');?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Log In</title>
<link rel="stylesheet" href="style.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="/lib/jquery.jnotify.js"></script>
</head>
<body>
<?php if(isset($_SESSION['errors'])): ?>
<?=implode($_SESSION['errors']); ?>
<?php endif; ?>
<nav><a href="#" class="focus">Log In</a> | <a href="register.html">Register</a></nav>
<form name="form1" method="post" action="validation.php">
<h2>Log In</h2>
<input name="log" type="text" class="text-field" placeholder="Username" id="login" />
<input name="password" type="password" class="text-field" id="passwd" placeholder="Password" />
<div class="styled-select">
<select name="type" id="type">
<option>Faites votre choix</option>
<option value="administrateur">administrateur</option>
<option value="Etudiant">Etudiant</option>
<option value="Enseignant">Enseignant</option>
</select>
</div>
<input name="btn" type="submit" class="button" id="btn" value="Log In" />
</form>
<?php unset($_SESSION['errors']); ?>
</body>
</html> |
VALIDATION.PHP
Code:
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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
|
<?php include ('election.php');
$heure=date("H:i");
$heuredep="08:00";
$heuredest="19:00";
$login=$_POST['log'];
$mdp=$_POST['password'];
$type=$_POST['type'];?>
<link type="text/css" href="css/jquery.jnotify.css" rel="stylesheet" media="all" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="/lib/jquery.jnotify.js"></script>
<?php
if(empty($login) OR empty($mdp)){header('location:index.php');}else{
$requete="SELECT * FROM utilisateur WHERE Matricule_User='$login' AND Password_User='$mdp' AND Type_User='$type'";
$resultat=mysql_query($requete);
$trouver=mysql_num_rows($resultat);
if($trouver>0)
{
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
background-image: url();
background-color: #0033FF;
}
body,td,th {
color: #FFFFFF;
}
.style1 {color: #FFFFFF}
-->
</style></head>
<javasc
<body>
<?php
if($type=='administrateur')
{
header('location:admin.php');
}
elseif($type=='Faites votre choix')
{
header('location:index.php');
}
elseif($type=='Etudiant')
{
?>
<form id="form1" name="form1" method="post" action="">
<table width="400" border="0">
<tr>
<td> </td>
</tr>
<tr>
<td><a href="vote.php?login=<?php echo $login; ?>" class="style1">Vote</a><a href="result.php" class="style1">
<input name="login" type="hidden" id="login" value="<?php echo $login; ?>" />
<label></label>
</a></td>
</tr>
<tr>
<td><a href="result.php" class="style1">Résultat
</a></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</form>
<?php
}
elseif($type=='Enseignant')
{
?>
<form id="form1" name="form1" method="post" action="">
<table width="400" border="0">
<tr>
<td> </td>
</tr>
<tr>
<td><a href="vote.php?login=<?php echo $login; ?>" class="style1">Vote</a><a href="result.php" class="style1">
<input name="login" type="hidden" id="login" value="<?php echo $login; ?>" />
<label></label>
</a></td>
</tr>
<tr>
<td><a href="result.php" class="style1">Résultat
</a></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</form>
<?php
}
?>
</body>
</html>
<?php }
else
{
session_start();
header('location:index.php');
$errors=[];
$errors['j']=$notify.click(function () {
$.jnotify("hello World");
});
$_SESSION['errors']=$errors;
$_SESSION['inputs']=$_POST;
}
}
?> |
Ou dois-je mettre mes codes pour le message d'erreur, je suis vraiment bloqué ...
Merci.