petit probleme de session

Eléphant du PHP | 299 Messages

10 avr. 2010, 22:51

Salut a tous!

je suis sur un projet de cms avec ajout par la suite de dizaines de modules.

Pas nouveau mais un bon exercise.

J' ai un bug quelque part sur ma page d' identification et son traitement (qui sont les deux sur la meme page.

le mieux est de vous montrer avec login: test et pass: test2

http://r22914.ovh.net/~buroware/index.php

lors du traitement, la session s' affiche bien avant la redirection, puis plus rien aprés la redirection!

voici le code de ma page index suivi de son include "infos" pour la partie 'connection', c' est plsu la seconde partie qui nous interesse, je n' ai pas mis de session_start(); sur infos.php car ca me met un probleme lors de la deconnection et ca ne change rien a l' affiche de la session.
<?php
session_start();
include('header.php');
?>
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="23" background="images/main/fen_h.png"><img src="images/main/blank20.png" width="20" height="1" /><span class="Style1"><?php echo $titre; ?></span></td>
  </tr>
  <tr>
    <td height="513" valign="top" background="images/main/fen_m.png"><br>
      <table width="980" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="210" align="left" valign="top">
		
		<?php
		
		$menu2 = mysql_query('SELECT * FROM includes WHERE modules="menu"');
		$menu = mysql_fetch_array($menu2)
		
		?>
		<?php
		
			if ($menu['etat'] == 1)
			{
			include ('includes/menu/index.php');
			}
			else
			{
			}
		?>
		
		</td>
        <td width="100%" align="left" valign="top">
		<?php
		
		$news2 = mysql_query('SELECT * FROM includes WHERE modules="news"');
		$news = mysql_fetch_array($news2)
		
		?>
		<?php
		
			if ($news['etat'] == 1)
			{
			include ('includes/news/index.php');
			}
			else
			{
			}
		?> 
		
		</td>
        <td width="210" align="right" valign="top"><?php
		
			if ($menu['etat'] == 1)
			{
			include ('includes/infos/infos.php');
			}
			else
			{
			}
		?></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td height="5" background="images/main/fen_b.png"></td>
  </tr>
</table>
</body>
</html>
et infos.php
<?php


$name = mysql_real_escape_string(htmlspecialchars($_POST['name']));
$pass2 = mysql_real_escape_string(htmlspecialchars($_POST['pass']));
$quete = mysql_query('SELECT pseudo, passe FROM users WHERE pseudo="' . $name . '"'); // Si possible, remplace l'&eacute;toile par le nom de tous les champs voulus (ici, que "mdp" apparement)
$nbre = mysql_num_rows($quete);
$donnees = mysql_fetch_assoc($quete);

	
	
	
	
	  if ($name != NULL)
	  {
if($nbre != 0) //si le pseudo existe
	if($pass2 == $donnees['passe'])
	{

$_SESSION['name'] = $_POST['name'];
		echo '<table width="200" border="0" align="right" cellpadding="0" cellspacing="0"><tr><td height="20" >&nbsp;</td></tr><tr><td height="19" ><div align="center"><span class="rouge">Connection réussie !</span></div></td></tr><tr><td height="20"></td></tr></table><meta http-equiv="Refresh" content="1;URL=index.php"><br /><br /><br /><br />';
	
	
			}
		else
		{
			echo '<table width="200" border="0" align="right" cellpadding="0" cellspacing="0"><tr><td height="20" >&nbsp;</td></tr><tr><td height="19" ><div align="center"><span class="rouge">Mauvais identifiants !</span></div></td></tr><tr><td height="20" ></td></tr></table><meta http-equiv="Refresh" content="1;URL=index.php"><br /><br /><br /><br />';
			}

		
		else{
		
			echo '<table width="200" border="0" align="right" cellpadding="0" cellspacing="0"><tr><td height="20" >&nbsp;</td></tr><tr><td height="19" ><div align="center"><span class="rouge">Pseudo inéxistant !</span><meta http-equiv="Refresh" content="1;URL=index.php"></div></td></tr><tr><td height="20" ></td></tr></table><br /><br /><br /><br />';
			}

}



?>
<table width="200" border="0" align="left" cellpadding="0" cellspacing="0">
  <tr>
    <td height="5" background="includes/menu/images/h.png"></td>
  </tr>
  <tr>
    <td height="20" align="left" valign="middle" background="includes/menu/images/m.png"><table width="180" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td align="center" valign="middle">
		<?php
		if(isset($_SESSION['name']))
		{
		echo '<p>Bonjour ';
		echo $_SESSION['name'];
		echo '<br /><br /><img src="includes/infos/images/cadenas.gif" alt="" align="absbottom" /><img src="images/main/blank20.png" alt="" width="5" align="absbottom" /><a href="decob.php">Déconnection</a><br /></p>';
		}
		else
		{
		echo '<p>
  
<form name="log" method="post" action="index.php">
  <table width="155" border="0" align="center" cellpadding="0" cellspacing="0">
      
    <tr>
      <td width="59" align="right" valign="middle">Pseudo : </td>
      <td width="131" height="25" colspan="2" align="right" valign="top">
	  <input name="name" type="text" size="10"/></td>
    </tr>
      <tr>
        <td align="right" valign="middle">Passe : </td>
        <td height="25" colspan="2" align="right" valign="top">
          <div align="right">
            <input name="pass" type="password" size="10"/>
          </div>
        </td>
      </tr>
  </table>
	  <br />
  <div align="center"><input type="submit" Value="Connection">
    <br /><br />

        
      <img src="includes/infos/images/inscription.png" alt="" align="absbottom" /><img src="images/main/blank20.png" alt="" width="5" align="absbottom" /><a href="inscription.php">Inscription</a><br /><br />


      
</div>
</form>

</p>';
		}
		?></td>
        </tr>
    </table>
	
	
	</td>
  </tr>
  <tr>
    <td height="5" background="includes/menu/images/b.png"></td>
  </tr>
</table>
Merci de votre aide, meme si c' est urgent, je vous suis tres reconnaissant du moindre petit indice!

ViPHP
ViPHP | 4039 Messages

10 avr. 2010, 23:45

connexion!

(désolé, mais ça me brûle les yeux, et du coup ça tâche ma carpette (et ça part pas au lavage, du coulage de noenoeil))
Mais qu'importe. (je suis ici - dernier petit projet)
Berze going social.

Eléphant du PHP | 299 Messages

11 avr. 2010, 00:32

oui, je suis franglais sur les bords, ceci dit ca ne me donne aucune piste :/

Eléphant du PHP | 299 Messages

11 avr. 2010, 00:39

probleme reglé, traitement sur page a part et c' est resolu, dommage :/