Ludovic_
Anime > Manga
Je ne sais plus quoi faire
je suis à un stade très noob et bref, j'aimerai affiché le header logged quand la personne est loggé, et la version pas loggé quand pas loggé... truc tout con de session qui ne veut pas marcher 
PHP:
<?php require_once('Connections/foodsurfing.php'); ?>
<?php if(isset($_SESSION['mail'])){?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>FoodSurfing - Page d'accueil</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="style.css" rel="stylesheet" type="text/css" />
<link rel="icon" type="image/png" href="images/fav.ICO" />
</head>
<!-- TOP -->
<div class="top"><p align="right" class="dejamembre"> </p></div>
<!-- END TOP -->
<!-- HEADER -->
<div class="header" id="header">
<div class="logo"><a href="index2.php"><img src="images/logo.png"></a></div>
<div class="login_off"><div class="img_membre"></div>
<div class="infos_membre">
<h3>Ludovic Wybo</h3>
<p class="login"><a class="edit" href="#">Vous avez <strong>1</strong> nouveau(x) message(s)</a></p>
<p class="login"><a class="edit2" href="#">Editer profil</a> | <a href="#" class="edit2">Se déconnecter</a></p>
</div>
</div>
<div class="button_propose2"><a href="add_food.php"><img src ="images/propose.png"></a></div>
<div class="button_recherche2"><a href="search_food.php"><img src ="images/recherche.png"></a></div>
</div>
<!-- END HEADER -->
<!-- HEADER_unlogged_content -->
<?php } else {echo' ' ; } ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}
if (isset($_POST['mail'])) {
$loginUsername=$_POST['mail'];
$password=$_POST['mdp'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "index2.php";
$MM_redirectLoginFailed = "gmap.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_foodsurfing, $foodsurfing);
$LoginRS__query=sprintf("SELECT mail, mdp FROM fiche_membres WHERE mail=%s AND mdp=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $foodsurfing) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<!-- TOP -->
<div class="top"><img src="images/facebook.png" alt="Facebook Button" width="144" height="21" align="right" vspace="7" hspace="5"><p align="right" class="dejamembre">Déjà membre ? <a href="#facebook" class="dejamembre" >Se connecter</a></p></div>
<!-- END TOP -->
<!-- HEADER -->
<div class="header" id="header">
<div class="logo"><a href="index2.php"><img src="images/logo.png"></a></div>
<div class="login_off">
<form ACTION="<?php echo $loginFormAction; ?>" METHOD="POST"><p class="login">Nom d'utilisateur: <input type="text" name="mail" class="mail"></p>
<p class="login">Mot de passe:
<input type="text" name="mdp" class="mdp"><a> </a><input id="submit" name="submit" type="submit" class="connexion" value="Connexion"></p>
<a style="font-size:14px;text-decoration:none; color:#B5CBE6">Mot de passe oublié ? </a><a style="font-size:14px;text-decoration:none; color:#B5CBE6; text-outline:2" href="#"><strong>Cliquez-ici !
</strong></a>
</form>
<br>
</div>
<div class="button_propose2"><a href="add_food.php"><img src ="images/propose.png"></a></div>
<div class="button_recherche2"><a href="search_food.php"><img src ="images/recherche.png"></a></div>
</div>
<!-- END HEADER -->