Erreur5
sirin angel
Messages postés
15
Date d'inscription
Statut
Membre
Dernière intervention
-
Utilisateur anonyme -
Utilisateur anonyme -
Bonjour,
<?php
//demarrage de session
session_start();
//inclusion de la page de connexion mysql
include 'connect.php';
//test et traitement des identifiant saisi par l'utilisateur
if(!empty($_POST['identifiant']) && !empty($_POST['motdepass'])){
$identifiant = $_POST['identifiant'];
//supression de caractères indésirables type : ' " < >
$identifiant = mysql_real_escape_string($identifiant);
$identifiant = htmlentities($identifiant);
$motdepass = $_POST['motdepass'];
$motdepass = mysql_real_escape_string($motdepass);
$motdepass = htmlentities($motdepass);
//cryptage sha1 du mot de pass
//$motdepass = sha1($motdepass);
$req = "SELECT login, pw, type FROM user WHERE login = '".$identifiant."'"." AND pw ='".$motdepass."'";
$result = mysql_query($req);
$tableaux = mysql_fetch_row($result);
//test de résultat utilisateur/Mysql
if ($identifiant == $tableaux[0] && $motdepass == $tableaux[1]&& $type=0){
$_SESSION['connection']=1;
$_SESSION['utilisateur']=$tableaux[0];
$type=0 ;
header('Location: content.php');
}
elseif($type=1){
$_SESSION['connection']=1;
$_SESSION['utilisateur']=$tableaux[0];
$type=1;
header('Location: employe.php');
}
else {
$_SESSION['badlogin'] = 1;
sleep(2);
header('Location: index.php');
}
}
else{
echo "Identifiant ou mot de pass incorrect....";
$_SESSION['connection']=0;
header('Location: index.php');
}
?>
voila mon code je veux lorsque le type =0 il me dirige a la page content.php et lorsque type =1 il me dirige a la page employe.php comment fair ca stp et merci d'avance :)
<?php
//demarrage de session
session_start();
//inclusion de la page de connexion mysql
include 'connect.php';
//test et traitement des identifiant saisi par l'utilisateur
if(!empty($_POST['identifiant']) && !empty($_POST['motdepass'])){
$identifiant = $_POST['identifiant'];
//supression de caractères indésirables type : ' " < >
$identifiant = mysql_real_escape_string($identifiant);
$identifiant = htmlentities($identifiant);
$motdepass = $_POST['motdepass'];
$motdepass = mysql_real_escape_string($motdepass);
$motdepass = htmlentities($motdepass);
//cryptage sha1 du mot de pass
//$motdepass = sha1($motdepass);
$req = "SELECT login, pw, type FROM user WHERE login = '".$identifiant."'"." AND pw ='".$motdepass."'";
$result = mysql_query($req);
$tableaux = mysql_fetch_row($result);
//test de résultat utilisateur/Mysql
if ($identifiant == $tableaux[0] && $motdepass == $tableaux[1]&& $type=0){
$_SESSION['connection']=1;
$_SESSION['utilisateur']=$tableaux[0];
$type=0 ;
header('Location: content.php');
}
elseif($type=1){
$_SESSION['connection']=1;
$_SESSION['utilisateur']=$tableaux[0];
$type=1;
header('Location: employe.php');
}
else {
$_SESSION['badlogin'] = 1;
sleep(2);
header('Location: index.php');
}
}
else{
echo "Identifiant ou mot de pass incorrect....";
$_SESSION['connection']=0;
header('Location: index.php');
}
?>
voila mon code je veux lorsque le type =0 il me dirige a la page content.php et lorsque type =1 il me dirige a la page employe.php comment fair ca stp et merci d'avance :)