Bonjour tout le monde,
J'aimerai savoir comment je pourrai afficher un message "Login ou mot de passe érronés" (au niveau du ICI en rouge dans le code ci dessous) apres une fausse saisie de la part de l'utilisateur lors du rafraichissement de la meme page!
Voici mon code de ma page:
<?php require_once('Connections/ConnexionMonSite.php'); ?>
<?php
// *** Validate request to login to this site.
session_start();
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($accesscheck)) {
$GLOBALS['PrevUrl'] = $accesscheck;
session_register('PrevUrl');
}
if (isset($_POST['log'])) {
$loginUsername=$_POST['log'];
$password=$_POST['pass'];
$MM_fldUserAuthorization = "id_statut";
$MM_redirectLoginSuccess = "page/index.php";
$MM_redirectLoginFailed = "index.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_ConnexionMonSite, $ConnexionMonSite);
$LoginRS__query=sprintf("SELECT log, pass, id_statut FROM usr_profil WHERE log='%s' AND pass='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $ConnexionMonSite) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysql_result($LoginRS,0,'id_statut');
//declare two session variables and assign them
$GLOBALS['MM_Username'] = $loginUsername;
$GLOBALS['MM_UserGroup'] = $loginStrGroup;
//register the session variables
session_register("MM_Username");
session_register("MM_UserGroup");
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><!-- InstanceBegin template="/Templates/index.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- InstanceBeginEditable name="doctitle" -->
<title>Document sans titre</title>
<!-- InstanceEndEditable --><style type="text/css">
<!--
.Style3 {font-size: 12px}
.Style5 {
font-family: Arial, Verdana, Helvetica;
font-size: 11px;
color: #FFFFFF;
font-weight: bold;
}
-->
</style>
<!-- InstanceBeginEditable name="head" -->
<link href="Templates/MonSitecss.css" rel="stylesheet" type="text/css">
<!-- InstanceEndEditable -->
<link href="MonSitecss.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.Style6 {font-size: xx-small}
-->
</style>
</head>
<body>
<div align="center">
<table width="800" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="290" height="95" valign="top" background="logog.jpg"><!--DWLayoutEmptyCell--> </td>
<td width="510" valign="top"><!--DWLayoutEmptyCell--> </td>
</tr>
</table>
</div>
<div align="center">
<table width="800" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="800" height="6"></td>
</tr>
</table>
</div>
<div align="center" class="Style3"></div>
<div align="center"></div>
<div align="center">
<table width="800" border="0" cellpadding="0" cellspacing="0" background="barh.jpg">
<!--DWLayoutTable-->
<tr>
<td width="800" height="20"> </td>
</tr>
</table>
</div>
<div align="center"></div>
<div align="center">
<table width="800" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="800" height="5"></td>
</tr>
</table>
</div>
<div align="center">
<table width="800" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="150" height="300" valign="top"><table width="100%" border="1" bordercolor="#B7BADD">
<tr>
<td bordercolor="#EAEAF4"><!-- InstanceBeginEditable name="Menu" -->
<table width="100%" border="1" bordercolor="#CCCFE2">
<tr>
<td bordercolor="#000000" bgcolor="#9D9FD8"><div align="right" class="Style5">NAVIGATION</div></td>
</tr>
<tr>
<td bordercolor="#000000" bgcolor="#E2E3EF"> </td>
</tr>
<tr>
<td bordercolor="#000000" bgcolor="#E2E3EF"> </td>
</tr>
<tr>
<td bordercolor="#000000" bgcolor="#FF5357"> </td>
</tr>
<tr>
<td bordercolor="#000000" bgcolor="#E2E3EF"> </td>
</tr>
<tr>
<td bordercolor="#000000" bgcolor="#33CC00"> </td>
</tr>
<tr>
<td bordercolor="#000000"> </td>
</tr>
</table>
<!-- InstanceEndEditable --></td>
</tr>
</table></td>
<td width="5" valign="top"><!--DWLayoutEmptyCell--> </td>
<td width="490" valign="top"><!-- InstanceBeginEditable name="Milieu" -->
<table width="100%" border="0">
<tr>
<td> </td>
</tr>
</table>
<!-- InstanceEndEditable --></td>
<td width="5" valign="top"><!--DWLayoutEmptyCell--> </td>
<td width="150" valign="top"><!-- InstanceBeginEditable name="Menudroi" -->
<table width="100%" border="1" bordercolor="#B7BADD">
<tr>
<td bordercolor="#EAEAF4"><form name="form1" method="POST" action="<?php echo $loginFormAction; ?>">
<table width="100%" border="1" bordercolor="#CCCFE2">
<tr>
<td bordercolor="#000000" bgcolor="#9D9FD8" class="Style5">:: Connexion :: </td>
</tr>
<tr>
<td bordercolor="#B6B9D8" bgcolor="#E2E3EF">
[color=FF0000]ICI[/color] <p align="center" class="pathway"><strong>Login:
</strong>
<input name="log" type="text" class="formInputRed" id="log" size="15" maxlength="50">
<strong>Password: </strong>
<input name="pass" type="password" class="formInputRed" id="pass" size="15" maxlength="15">
<input name="connexion" type="submit" class="formButton" id="connexion" value=":: Go ::">
</p>
</td>
</tr>
<tr>
<td bordercolor="#EAEAF4" bgcolor="#E2E3EF"><div align="center"><span class="pathway">
</span></div></td>
</tr>
</table>
</form></td>
</tr>
</table>
<!-- InstanceEndEditable --></td>
</tr>
</table>
</div>
</body><!-- InstanceEnd -->
</html>
Merci d'avance!
Bye
Ben