par
dunbar » 13 juil. 2006, 14:49
Salut
Alors j'ai suivi tes conseils, mais devine je te montre mon nouveau code, tu va peut-être me dire ou j'ai encore fait l'endouille
// on teste si une entrée de la base contient ce couple login / pass
$sql = 'SELECT url,nom FROM membre WHERE login="'.addslashes($_POST['login']).'" AND pass_md5="'.md5(addslashes($_POST['pass'])).'"';
$req = mysql_query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
$data = mysql_fetch_array($req);
$nom = $data ['nom'];
mysql_close();
// si on obtient une réponse, alors l'utilisateur est un membre
if (mysql_num_rows($req) == 1) {
session_start();
$_SESSION['login'] = $_POST['login'];
$_SESSION['nom'] = $nom;
//'url' = adresse du champ "nom" correspondant au login de session de la TABLE membre
$url = $data['url'];
header('Location:'.$url);
exit();
}
Et la page ou je voudrais appeller le "nom"
<?php
session_start();
if (!isset($_SESSION['login']) && !isset($_SESSION['nom'])) {
header ('Location: index.php');
exit();
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="fr-be">
<title>Prestations du jour !</title>
<style>
<!--
.smallfont
{
font: 9px verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif;
}
-->
</style>
</head>
<body background="img/grd-4px.gif" style="background-attachment: fixed">
<table border="0" id="table1" width="1240">
<tr>
<td>
<p align="center"><font color="#0000FF" size="7"></font></p>
</td>
</tr>
<tr>
<td><font size="2"></font></td>
</tr>
<tr>
<td><font size="2"></font></td>
</tr>
<tr>
<td><font size="2">Tél : 0000000000</font></td>
</tr>
</table>
<table border="0" id="table2" width="1240">
<tr>
<td>
<p align="center"><font size="4">Encodage des prestations <font color="#FF0000">tvc</font>@ble<font color="#FF0000">net</font>
du jour.</font></p> <?
echo "bonjour,".$_SESSION['nom']."" ;
?>
D'avance merci

Salut
Alors j'ai suivi tes conseils, mais devine je te montre mon nouveau code, tu va peut-être me dire ou j'ai encore fait l'endouille :wink:
[php]// on teste si une entrée de la base contient ce couple login / pass
$sql = 'SELECT url,nom FROM membre WHERE login="'.addslashes($_POST['login']).'" AND pass_md5="'.md5(addslashes($_POST['pass'])).'"';
$req = mysql_query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
$data = mysql_fetch_array($req);
$nom = $data ['nom'];
mysql_close();
// si on obtient une réponse, alors l'utilisateur est un membre
if (mysql_num_rows($req) == 1) {
session_start();
$_SESSION['login'] = $_POST['login'];
$_SESSION['nom'] = $nom;
//'url' = adresse du champ "nom" correspondant au login de session de la TABLE membre
$url = $data['url'];
header('Location:'.$url);
exit();
}
[/php]
Et la page ou je voudrais appeller le "nom"
[php]
<?php
session_start();
if (!isset($_SESSION['login']) && !isset($_SESSION['nom'])) {
header ('Location: index.php');
exit();
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="fr-be">
<title>Prestations du jour !</title>
<style>
<!--
.smallfont
{
font: 9px verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif;
}
-->
</style>
</head>
<body background="img/grd-4px.gif" style="background-attachment: fixed">
<table border="0" id="table1" width="1240">
<tr>
<td>
<p align="center"><font color="#0000FF" size="7"></font></p>
</td>
</tr>
<tr>
<td><font size="2"></font></td>
</tr>
<tr>
<td><font size="2"></font></td>
</tr>
<tr>
<td><font size="2">Tél : 0000000000</font></td>
</tr>
</table>
<table border="0" id="table2" width="1240">
<tr>
<td>
<p align="center"><font size="4">Encodage des prestations <font color="#FF0000">tvc</font>@ble<font color="#FF0000">net</font>
du jour.</font></p> <?
echo "bonjour,".$_SESSION['nom']."" ;
?>
[/php]
D'avance merci :roll: