Bonjour,
Je viens de me mettre au PHP et je me lance dans un petit developpement tout simple qui va tester si ma connexion mySql connaigt mon user.
Si c'est le cas et que mon user est connu, la page doit me rediriger vers l'accueil du mon site, sinon il me redirige la page de connexion pour ressaisir user et mot de passe.
Alors je précise que ma connexion fonctionne et a été remplacée par des informations comme 'monIpDeMonServeur'.
La page qui est normalement faite pour me rediriger ne FAIT RIEN et reste sur la page verifconnexion.php alors qu'elle doit me rediriger vers index.html
J'ai éssayé :
//ob_start();
header("Location: index.html/");
//ob_end_flush();
ob_start();
header("Location: index.html/");
ob_end_flush()
j'ai mis un fonction javascript en haut qui fait un redirection idem ça marche poa
Je débute et j'ai cherché pourtant sur internet mais là, ça me donne envie d'arrêter .
mErci de Votre aide car je sèche
****************************************************************************************************
PAGE DE CONNEXION
**************************************************************************************************
<!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>
<style>
.center {
margin-left: auto;
margin-right: auto;
width: 500px;
background-color: #FF6;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>INTRANET MA SOCIETE</title>
</head>
<body>
<div class="center">
<form method="post" action="verifconnexion.php">
<table width="325" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="176">Identifiant :</td>
<td width="72"> <input type="text" name="user" size="12" value="u1008811_admin"></td>
<td width="77"> </td>
</tr>
<tr>
<td>Mot de passe : </td>
<td><input type="password" name="password" size="12" value="P@ssword12071974"> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><input type="submit" value="OK" / align="right"></td>
<td> </td>
</tr>
</table>
</form>
</div>
</body>
</html>
*****************************************************************************************************************************
PAGE QUI VERIFIE MA CONNEXION ET ME REDIRIGE
*******************************************************************************************************************************
<?php
//reception des données du formulaire précédent
$identifiant = $_POST['user'];
$password = $_POST['password'];
$db = mysql_connect('monIpDeMonServeur', $identifiant, $password );
// on sélectionne la base
mysql_select_db('MaBaseDeDonnee',$db);
// on crée la requête SQL
$sql = 'SELECT * FROM T_USER';
// on envoie la requête
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
if ($identifiant = "MonIdentifiant")
{
//echo '<body onLoad="alert(\'Membre non reconnu...\')">';
session_start ();
$_SESSION['user'] = $identifiant;
$_SESSION['password'] = $password;
//$_SESSION[['chainecnx'] = $db;
//ob_start();
header("Location: index.html/");
//ob_end_flush();
}
else
{
header("Location: connexion.php/");
}
?>
</head>
<body>
</body>
</html>
*******************************************************************************************************************************************************************