25-02-2008, 11:22 PM
Si,
Code PHP :
<?php
if(isset($_POST['pseudo']))
{
$pseudo = strtolower(protect($_POST['pseudo']));
$mdp = strtolower(protect($_POST['mdp']));
$exist = doquery("SELECT id,pseudo,mdp FROM user WHERE pseudo='{$pseudo}'",1);
if(!$exist['pseudo']) { $erreur++; }
if(empty($pseudo)) { $erreur++; }
if(empty($mdp)) { $erreur++; }
if($mdp != $exist['mdp']) { $erreur++; }
$id = $exist['id'];
if($erreur == 0)
{
$rep = doquery("SELECT id,nom FROM planete WHERE id_user = '$id'");
$a = 1;
while($req = mysql_fetch_assoc($rep))
{
$_SESSION['planete_id'.$a] = $req['id'];
$_SESSION['planete_nom'.$a] = $req['nom'];
$a++;
}
$_SESSION['nbr_planete'] = $a;
$planete_id = $_SESSION['planete_id1'];
$sql = doquery("SELECT * FROM planete WHERE id_user ='$id' AND id='$planete_id'",1);
$_SESSION['id_planete'] = $sql['id'];
$_SESSION['id'] = $exist['id'];
$_SESSION['pseudo'] = $exist['mdp'];
header("Location : index.php");
}
}