Bonsoir à tous,

Voilà je bossais sur un site Internet donc j'ai réalisé une administration. On s'y connecte à partir de la page connect.php et si le login est bon on créera une session jusque la tout va bien. Sur chaque page de l'admin je fais des qu'on l'ouvre :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
 
<?php 
session_start();
include '../classes/SQL.php';
include '../classes/CAdministration.php';
include '../classes/Outils.php';
if(!CAdministration::EstOK($_SESSION['id']))
{
	Outils::Redirection('../index.php');
}
?>
Ici je vous mets la classe Admin :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
 
<?php
class CAdministration 
{
	public function Existe($login, $mdp)
	{
		$sql = "SELECT id
				FROM administration
				WHERE login = '$login'
				AND mdp = '$mdp'";
		$objSQL = new SQL($sql);
		$tRep = $objSQL->Suivant();
		$id = null;
		if($objSQL->ALignes())
		{
			$id = $tRep[0];
		}
		$objSQL->Fermer();
		return $id;
	}
 
	public function EstOK($id)
	{
		$sql = "SELECT id
				FROM administration
				WHERE id = '$id'";
		$objSQL = new SQL($sql);
		$objSQL->Suivant();
		$ok = false;
		if($objSQL->ALignes())
		{
			$ok = true;
		}
		$objSQL->Fermer();
		return $ok;
	}
}
 
?>
Tout cela fonctionne très bien sauf sur une des pages de l'administration que j'arrive à accéder mais dès que j'appuie sur F5 ou que je valide un formulaire ou que je reviens sur la page précédente ben elle me déconnecte de l'admin et me renvoie directement a l accueil de mon site Internet....

Voici la page :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
 
<?php
session_start();
include '../classes/SQL.php';
include '../classes/CAdministration.php';
include '../classes/Outils.php';
if(!CAdministration::EstOK($_SESSION['id']))
{
	Outils::Redirection('../index.php');
}
?>
<!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" xml:lang="fr" lang="fr">
<head>
	<title> *******, Administration </title>
	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
	<link rel="stylesheet" type="text/css" href="style/design.css"/>
	<link rel="shortcut icon" href="style/favicon.ico" />
	<script type="text/javascript" src="fckeditor/fckeditor.js"></script>
	<?php 
	include '../classes/CPromotions.php';
	include '../classes/CArticles.php';
	?>
</head>
<body>
	<div id="page" class="centrer">		
		<div class="haut"></div>
		<div id="banniere">
			<a href="index.php">
				<img src="style/page_banniere_titre.png" title="" alt="" />
			</a>			
		</div>		
		<div class="contenu">
			<a href="deconnexion.php"> <img src="style/login.png" alt="déconnexion" title="déconnexion" style="width:50px; height:50px;float:right" /></a>
			<div class="entete">
				Cette page vous permettra de mettre à jour les informations de votre page liste de promotions.
			</div>
			<?php
			$id ='';
			$nom = '';
			$ancPrix = '';
			$newPrix = '';
			if(isset($_POST['btn_ajouterPromo']))
			{
				$nom = (isset($_POST['nom']))?$_POST['nom']:'';
				$ancPrix = (isset($_POST['ancPrix']))?$_POST['ancPrix']:''; 
				$newPrix = (isset($_POST['newPrix']))?$_POST['newPrix']:'';
				$img = (isset($_FILES['fichier']['name']))?$_FILES['fichier']:'';
				if($nom != '' && $newPrix != '' && $img != '')
				{
					$id = CArticles::Ajouter($nom, $ancPrix, $newPrix);
					Outils::Upload($img, '../style/promotions/',$id, array('JPG', 'jpg', 'jpeg', 'png', 'gif', 'bmp'));
					$objArticle = new CArticles($id);
					$objArticle->setImage($id.strrchr($img['name'], '.'));	
				}
			}
			elseif(isset($_POST['btn_modifierPromo']))
			{
				$id = (isset($_POST['id']))?$_POST['id']:'';
				$nom = (isset($_POST['nom']))?$_POST['nom']:'';
				$ancPrix = (isset($_POST['ancPrix']))?$_POST['ancPrix']:''; 
				$newPrix = (isset($_POST['newPrix']))?$_POST['newPrix']:'';
				$img = (isset($_FILES['fichier']['tmp_name']))?$_FILES['fichier']:'';
				if($nom != '' && $newPrix != '')
				{
					$objArticle = new CArticles($id);
					$objArticle->setLibelle($nom);
					$objArticle->setAncPrix($ancPrix);
					$objArticle->setNewPrix($newPrix);
					if($img['tmp_name'] != '')
					{
						Outils::Upload($img, '../style/promotions/',$id, array('JPG', 'jpg', 'jpeg', 'png', 'gif', 'bmp'));
						unlink('../style/promotions/'.$objArticle->getImage());
						$objArticle->setImage($id.strrchr($img['name'], '.'));
					}
					Outils::Redirection('listepromos.php');					
				}
			}
			elseif (isset($_GET['idS']))
			{
				$objArticle = new CArticles($_GET['idS']);
				unlink('../style/promotions/'.$objArticle->getImage());
				$sql = "delete from promotions where id = $_GET[idS]";
				SQL::Executer($sql);
			}
			else if(isset($_GET['idM']))
			{
				$objArticle = new CArticles($_GET['idM']);
				$id = $objArticle->getId();
			}
			?>			
			<form enctype="multipart/form-data" method="post" action="listepromos.php">
				<table class="ajoutePromo centrer">
					<tr>
						<th colspan="2" class="centrerTxt"> <?php echo (isset($_GET['idM']))?'Modifier '.$objArticle->getLibelle():'Ajouter une promo' ?> </th>
					</tr>
					<tr>
						<td> <input type="hidden" name="id" value="<?php echo $id; ?>" /> </td>
					</tr>
					<tr>
						<td> Nom : </td> <td> <input type="text" name="nom" value="<?php echo (isset($_GET['idM']))?$objArticle->getLibelle():$nom; ?>" /> </td>
					</tr>
					<tr>							
						<td> Ancien Prix : </td> <td> <input class="mini" type="text" name="ancPrix" value="<?php echo (isset($_GET['idM']))?(($objArticle->getAncPrix() != '0')?$objArticle->getAncPrix():''):$ancPrix; ?>" /> </td>
					</tr>
					<tr>	
						<td> Nouveau Prix : </td> <td> <input class="mini" type="text" name="newPrix" value="<?php echo (isset($_GET['idM']))?$objArticle->getNewPrix():$newPrix; ?>" /> </td>
					</tr>
					<tr>	
						<td> Photo : </td> <td> <input type="file" name="fichier" /></td>
					</tr>
					<tr>
						<?php 
						if(isset($_GET['idM']))
						{
							echo '<td colspan="2" class="centrerTxt"> <input type="submit" name="btn_modifierPromo" value="Modifier" /> </td>';	
						}
						else 
						{
							echo '<td colspan="2" class="centrerTxt"> <input type="submit" name="btn_ajouterPromo" value="Ajouter" /> </td>';
						}
						?>
					</tr>
				</table>
			</form>
 
			<?php
			$objArticles = CArticles::Ensemble();
			$longueur = count($objArticles);			
			?>
				<table class="centrer listepromos">
					<tr>
						<th></th>
						<th> Nom </th>
						<th> Ancien prix </th>
						<th> Nouveau prix </th>
						<th colspan="2"> Actions </th>
					</tr>
					<?php 
					for($i = 0; $i < $longueur; $i++)
					{
					?>
						<tr>
							<td> <?php echo '<img class="thumbnails" src="../style/promotions/'.$objArticles[$i]->GetImage().'" alt="'.$objArticles[$i]->getLibelle().'" title="'.$objArticles[$i]->getLibelle().'" />'; ?> </td>
							<td class="libelle"> <?php echo $objArticles[$i]->getLibelle(); ?> </td>
							<td class="ancPrix"> <?php echo ($objArticles[$i]->getAncPrix() != '0')?$objArticles[$i]->getAncPrix():''; ?> </td>
							<td class="newPrix"> <?php echo $objArticles[$i]->getNewPrix(); ?> </td>
							<td> <a href="listepromos.php?idM=<?php echo $objArticles[$i]->getID(); ?>"><img src="style/modif.png" alt="modifier" title="modifier" /></a> </td>
							<td> <a href="listepromos.php?idS=<?php echo $objArticles[$i]->getID(); ?>" onclick="if(!confirm('Voulez-vous vraiment modifier le texte ?')){return false;}"><img src="style/supprimer.png" alt="modifier" title="supprimer" /></a> </td>
						</tr>
					<?php 
					}
					?>
				</table>
		</div>
		<div class="bas">
		</div>
	</div>
</body>
</html>
Je ne comprends vraiment pas ce qui pose problème. Il n'y a que sur cette page que j'ai le problème et il est systématique... Avant je ne l'avais pas c'est cela qui est bizarre..

Merci d'avance a vous tous