Voila,
je voudrait que sur mon site, l'utilisateur se connecte, puis via une page "profil.php" puisse changer la couleur de fond de la page et la variable de session $_couleur est par défaut égale a "verte" par exemple.
Dans le "head" de ma page web, il y aura:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>PSPFlash-le site</title>
<?php if(!empty($_SESSION['couleur']) AND $_SESSION['couleur']=='default')
{?>
<link rel="stylesheet" href="style-base.css" type="text/css" />
<?php
}
else
{?>
<link rel="stylesheet" href="style-deco.css" type="text/css" />
<?php
}?>
</head>
<body>
<table>
<tr>
<td colspan="6"><img src="banniere.jpg" alt="PSPFlash" /></td>
</tr>
<div id="menu">
<tr>
<td><a href="index.php">News</b></a></td>
<td><a href="jeux.php">Jeux</a></td>
<td><a href="anim.php">Animations</a></td>
<td><a href="utils.php">Utilitaires</a></td>
<td><a href="liens.php">Liens</a></td>
<td><a href="contact.php">Me contacter</a></td>
</tr>
<tr>
<td><a href="tchat.php">T'chat</a></td>
<td><a href="forum">Forum</a></td>
<td><a href="images.php"> Images</a></td>
<?php
if(!empty($_SESSION['pseudo']))
{?>
<td><a href="pro.php">Profil</a></td>
<td><a href="deco.php">Déconnexion</a></td>
<td><a href="users.php">Membres</a></td>
<?php
}
else
{?>
<td><a href="connexion.php">Connexion</a></td>
<td><a href="inscription.php">Inscription</a></td>
<td><a href="portails.php"> Portails</a></td>
<?php
}?>
</tr>
<tr>
<?php
if(!empty($_SESSION['pseudo']))
{?>
<td><a href="mp.php">Messages</a></td>
<td><a href="infos.php">Infos</a></td>
<td><a href="theme.php">Thèmes</a></td>
<?php
}
else
{?>
<?php
}?>
</tr>
</div>
Mais si rajoute ceci:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>PSPFlash-le site</title>
<?php if(!empty($_SESSION['couleur']) AND $_SESSION['couleur']=='default')
{?>
<link rel="stylesheet" href="style-base.css" type="text/css" />
<?php
}
else
{?>
<link rel="stylesheet" href="style-deco.css" type="text/css" />
<?php
}?>
<?php if(!empty($_SESSION['couleur']) AND $_SESSION['couleur']=='white')
{?>
<link rel="stylesheet" href="style.css" type="text/css" />
<?php
}
else
{?>
<link rel="stylesheet" href="style-white.css" type="text/css" />
<?php
}?>
</head>
<body>
<table>
<tr>
<td colspan="6"><img src="banniere.jpg" alt="PSPFlash" /></td>
</tr>
<div id="menu">
<tr>
<td><a href="index.php">News</b></a></td>
<td><a href="jeux.php">Jeux</a></td>
<td><a href="anim.php">Animations</a></td>
<td><a href="utils.php">Utilitaires</a></td>
<td><a href="liens.php">Liens</a></td>
<td><a href="contact.php">Me contacter</a></td>
</tr>
<tr>
<td><a href="tchat.php">T'chat</a></td>
<td><a href="forum">Forum</a></td>
<td><a href="images.php"> Images</a></td>
<?php
if(!empty($_SESSION['pseudo']))
{?>
<td><a href="pro.php">Profil</a></td>
<td><a href="deco.php">Déconnexion</a></td>
<td><a href="users.php">Membres</a></td>
<?php
}
else
{?>
<td><a href="connexion.php">Connexion</a></td>
<td><a href="inscription.php">Inscription</a></td>
<td><a href="portails.php"> Portails</a></td>
<?php
}?>
</tr>
<tr>
<?php
if(!empty($_SESSION['pseudo']))
{?>
<td><a href="mp.php">Messages</a></td>
<td><a href="infos.php">Infos</a></td>
<td><a href="theme.php">Thèmes</a></td>
<?php
}
else
{?>
<?php
}?>
</tr>
</div>
En gros, pour mettre une 2e couleure, la cela ne fontionne pas, losque le membre se connecte, il a toujours le disign syle-deco.css...
Merci de maider