brom
Invité n'ayant pas de compte PHPfrance
02 mai 2011, 17:38
Bonjour,
donc le elseif bien que faux n'a rien à voir dans l'erreur de ma page, mon else ne s'execute tjs pas et en plus de ça quand je met mon site sur mon serveur apache ubuntu il me dit que ma requête
Code : Tout sélectionner
$sql = "SELECT nom_user, pass_user FROM users WHERE nom_user = '$login' AND `pass_user`= '$pass'";
est impossible à effectuer
donc je vous met ma page de saisie
Code : Tout sélectionner
<?php
DEFINE ('USER', 'root');
DEFINE ('PASSWORD', '');
DEFINE ('HOST', 'localhost');
DEFINE ('DBNAME', 'vincealex');
$dbc = @mysql_connect (HOST , USER, PASSWORD);
mysql_select_db (DBNAME);
?>
<!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=utf-8" />
<title>Bienvenue chez Vincent & Alexandre</title>
</head>
<body bgcolor="#000000">
<table width="100%"><tr><td align="center">
<table cellpadding="0" cellspacing="0">
<tr>
<td width="575" height="524" background="images/index_02.png"></td>
</tr>
</table>
<table cellpadding="0" cellspacing="0">
<tr>
<form method="post" action="authentification.php" enctype="multipart/form-data">
<td width="25" height="63" background="images/index_04.gif"></td>
<td width="101" height="63" background="images/index_05.gif"></td>
<td width="219" height="63" background="images/index_06.gif"><input type="test" name="login" /></td>
</tr>
</table>
<table cellpadding="0" cellspacing="0">
<tr>
<td width="25" height="56" background="images/index_04bis.gif"></td>
<td width="102" height="56" background="images/index_08.gif"></td>
<td width="218" height="56" background="images/index_09.gif"><input type="password" name="pass" /></td>
</tr>
</table>
<table cellpadding="0" cellspacing="0">
<tr>
<td width="575" height="56" align="center"><input type="submit" src="images/entrer.gif"/></td>
</tr>
</table>
</tr>
</form>
</table>
</td></tr></table>
</body>
</html>
et ma page de vérif des infos une nouvelle fois mais modifiée
Code : Tout sélectionner
<?php
DEFINE ('USER', 'root');
DEFINE ('PASSWORD', '');
DEFINE ('HOST', 'localhost');
DEFINE ('DBNAME', 'vincealex');
$dbc = @mysql_connect (HOST , USER, PASSWORD);
mysql_select_db (DBNAME);
session_start();
$login = $_POST['login'];
$pass = $_POST['pass'];
$sql = "SELECT nom_user, pass_user FROM users WHERE nom_user = '$login' AND `pass_user`= '$pass'";
$result = mysql_query($sql) or die ('Erreur SQL : impossible d\'effectuer la requête : <br />'.$sql);
for($i=0;$i<mysql_num_rows($result);$i++)
{
$row=mysql_fetch_assoc($result);
if($row["nom_user"] = $_POST['login'] && $row["pass_user"] = $_POST['pass'])
{
// Nous avons bien le bon utilisateur
// Nous créons la variable de session
$_SESSION['auth']="AUTH : OK";
header("location: accueil.php");
}
elseif ($row["nom_user"] == $_POST['login'] || $row["pass_user"] == $_POST['pass'])
{
// Nous n'avons pas les bonnes informations
// On renvoi vers la page d'authentification
header("location: index.php");
}}
?>
merci pour votre aide