peut-on afficher une requête Msql sous une session_start() ?

WRInaute accro
Bonsoir,
Pour accéder à la partie sécurisée de mon site, mes membres font un login!
Mais cette partie sécurisée fait appel à une requête Msql et les paramètres de ma session se voient effacées pour prendre les paramètres de ma requête!!!!

Pouvez-vous m'aider?
 
WRInaute accro
La comme ca, sans le code, non, ca risque d'être dur. Développeur mais pas devin comme mon grand père disait ;)
 
WRInaute accro
kazhar a dit:
Développeur mais pas devin comme mon grand père disait ;)
Looool ton grand-père était sage!!

Non, sans déc !
Merci de ton attention,
Pour apporter quelques précision avant de donner mon script......je fais un login sur ma (table Msql n°1) via ma page "se-connecter.php" puis lors d'une recherche rapide sur ma page d'accueil, les internautes sortent un listing en page "annonce.php" puis pour voir l'annonce en détail "enregistrement.php", j'ai mis une condition, dans le cas d'être connecter, requête (table Msql n°2) pour sortir toutes les infos de mon annonce.....sinon, message devoir s'inscrire..........bref, de blabla!
Code:
<?php
//**********************************************************
//                         ETAPE 1       le visiteur doit s'enregistrer
//**********************************************************
				$id=$_GET['id'];
				
			if ($_SESSION['connecter']=="")
				{
				?>
					<table class="paiement">
						<tr>
							<td>Profitez des avantages que vous offre notre site: "Voyage-surfing" !!!!<br/>Pour cela, Suivez ce lien: <a href="http://www.voyage-surfing.com/photos/paiement.php">Cliquer ici</a> et vous pourrez par la suite déposer une annonce, suivre la votre et bénéficier de nos formules d'abonnements:<br/><center><span style="font-weight:bolder;">SERVICE PREMIUM </span>ou <span style="font-weight:bolder;">SERVICE CONSULTANT</span><br/></center> Vous pourrez de plus, connaître les coordonnées de nos membres qui vous attendent pour des échanges d'hébergement, des services de prestations sur nos rubriques :<br/><center><strong>Voyage Humanitaire</strong> et <strong>Voyage Nature et Découverte</strong></center></td>
						</tr>
						<tr>
							<td><hr /></td>
						</tr>	
						<tr>
							<td>Ami(e) membre, nous vous conseillons de vous connecter afin de pouvoir parcourir nos annonces <a href="http://www.voyage-surfing.com/se-connecter.php">Se connecter</a><br /><br /></td>
						</tr>
					</table>					
					<?php
				}
			else
				{
					mysql_connect("xxxx", "xxxxx", "xxxx"); //connexion Table Msql
					mysql_select_db("xxxxx");
		
					$reponse_resultat = mysql_query("SELECT * FROM xxxx WHERE id='$id'")or die(mysql_error());
					// Récupération des données

					while ($donnees_resultat = mysql_fetch_array($reponse_resultat)) 
						{
							$abonnement=$donnees_resultat['abonnement'];
							$timestamp=$donnees_resultat['timestamp'];
							$pseudo=$donnees_resultat['pseudo'];
							$motdepasse=$donnees_resultat['motdepasse'];
							$nom=$donnees_resultat['nom'];
							$prenom=$donnees_resultat['prenom'];
							$adresse=$donnees_resultat['adresse'];
							$codepostal=$donnees_resultat['codepostal'];
							$pays_domicile=$donnees_resultat['pays_domicile'];
							$ville=$donnees_resultat['ville'];
							$telephone=$donnees_resultat['telephone'];
							$email=$donnees_resultat['email'];
							$site_internet=$donnees_resultat['site_internet'];
							$profession=$donnees_resultat['profession'];
							$choix_hebergement=$donnees_resultat['choix_hebergement'];
							$prix_loca=$donnees_resultat['prix_loca'];
							$ville_plus_proche=$donnees_resultat['ville_plus_proche'];
							$direction_rapport_ville=$donnees_resultat['direction_rapport_ville'];
							$distance_km_ville=$donnees_resultat['distance_km_ville'];
							$duree_sejour=$donnees_resultat['duree_sejour'];
							$periode_sejour=$donnees_resultat['periode_sejour'];
							$nombre_adulte=$donnees_resultat['nombre_adulte'];
							$nombre_adolescent=$donnees_resultat['nombre_adolescent'];
							$age_adolescent=$donnees_resultat['age_adolescent'];
							$nombre_enfant=$donnees_resultat['nombre_enfant'];
							$age_enfant=$donnees_resultat['age_enfant'];
							$descriptif_logis=$donnees_resultat['descriptif_logis'];
							$nombre_accueillir_personnes=$donnees_resultat['nombre_accueillir_personnes'];
							$nombre_chambres=$donnees_resultat['nombre_chambres'];
							$nombre_salledebain=$donnees_resultat['nombre_salledebain'];
							$qualites=$donnees_resultat['qualites'];
							$indication1=$donnees_resultat['indication1'];
							$indication2=$donnees_resultat['indication2'];
							$indication3=$donnees_resultat['indication3'];
							$indication4=$donnees_resultat['indication4'];
							$indication5=$donnees_resultat['indication5'];
							$indication6=$donnees_resultat['indication6'];
							$region1=$donnees_resultat['region1'];
							$region2=$donnees_resultat['region2'];
							$region3=$donnees_resultat['region3'];
							$region4=$donnees_resultat['region4'];
							$activite_disponible1=$donnees_resultat['activite_disponible1'];
							$activite_disponible2=$donnees_resultat['activite_disponible2'];
							$extra1=$donnees_resultat['extra1'];
							$extra2=$donnees_resultat['extra2'];
							$expert=$donnees_resultat['expert'];
							$avertissement=$donnees_resultat['avertissement'];
							$allergie=$donnees_resultat['allergie'];
							$langue_parlee1=$donnees_resultat['langue_parlee1'];
							$langue_parlee2=$donnees_resultat['langue_parlee2'];
							$choix1_destination=$donnees_resultat['choix1_destination'];
							$choix2_destination=$donnees_resultat['choix2_destination'];
							$choix3_destination=$donnees_resultat['choix3_destination'];
							$savefile=$donnees_resultat['savefile'];
						}
					mysql_close(); // Déconnexion de MySQL				
					?>
					<table class="enregistrement">
						<tr>
							<td><span style="text-decoration:underline;">Date de l'annonce:</span>&nbsp;<strong><span class="variable"><?php echo $timestamp; ?></span></strong></td>
							<td><span style="text-decoration:underline;">Catégorie:</span>&nbsp;<strong><span class="variable"><?php 
																															if (($choix_hebergement==$location1) OR ($choix_hebergement==$location2) OR ($choix_hebergement==$location3) OR ($choix_hebergement==$location4))
																																{
																																	echo "$choix_hebergement'-'$prix_loca";
																																}
																															else
																																{
																																	echo "$choix_hebergement";
																																}

																															?></span></strong></td>
							<td><span style="text-decoration:underline;">Réf.:</span>&nbsp;<strong><span class="variable"><?php echo $id; ?></span></strong></td>																								
						</tr>
						<tr>
							<td colspan="3"><hr /></td>
						</tr>
						<tr>
							<td><span style="text-decoration:underline;">Pays:</span>&nbsp;<strong><span class="variable"><?php echo $pays_domicile; ?></span></strong></td>
							<td><span style="text-decoration:underline;">Localité:</span>&nbsp;<strong><span class="variable"><?php echo $ville; ?></span></strong></td>
							<td><span style="text-decoration:underline;">Téléphone:</span>&nbsp;<strong><span class="variable"><?php echo $telephone; ?></span></strong></td>
						</tr>
						<tr>
							<td><span style="text-decoration:underline;">Ville plus proche:</span>&nbsp;<strong><span class="variable"><?php echo $ville_plus_proche; ?></span></strong></td>
							<td><span style="text-decoration:underline;">Direction par rapport à la ville:</span>&nbsp;<strong><span class="variable"><?php echo $direction_rapport_ville; ?></span></strong></td>
							<td><span style="text-decoration:underline;">Distance en KM:</span>&nbsp;<strong><span class="variable"><?php echo $distance_km_ville; ?></span></strong></td>
						</tr>
						<tr>
							<td colspan="3"><hr /></td>
						</tr>
						<tr>
							<td><span style="text-decoration:underline;">Descriptif du logis:</span>&nbsp;<strong><span class="variable"><?php echo $descriptif_logis; ?></span></strong></td>
							<td colspan="2"><span style="text-decoration:underline;">Nombre de personnes acceptées:</span>&nbsp;<strong><span class="variable"><?php echo $nombre_accueillir_personnes; ?></span></strong></td>
						</tr>
						<tr>
							<td><span style="text-decoration:underline;">Nombre de salle de bain:</span>&nbsp;<strong><span class="variable"><?php echo $nombre_salledebain; ?></span></strong></td>
							<td><span style="text-decoration:underline;">Nombre de chambres:</span>&nbsp;<strong><span class="variable"><?php echo $nombre_chambres; ?></span></strong></td>
							<td></td>
						</tr>
						<tr>
							<td colspan="3"><hr /></td>
						</tr>
						<tr>
							<td colspan="2"><span style="text-decoration:underline;">Famille/groupe:</span>&nbsp;<em><span style="text-decoration:underline;">Adulte:</span></em>&nbsp;<strong><span class="variable"><?php echo $nombre_adulte; ?></span></strong>&nbsp; ::&nbsp;<em><span style="text-decoration:underline;"> Adolescent:</span></em>&nbsp;<strong><span class="variable"><?php echo $nombre_adolescent; ?></span></strong>&nbsp;<em><span style="text-decoration:underline;">Age:</span></em>&nbsp;<strong><span class="variable"><?php echo $age_adolescent; ?></span></strong>&nbsp; ::&nbsp;<em><span style="text-decoration:underline;"> Enfant:</span></em>&nbsp;<strong><span class="variable"><?php echo $nombre_enfant; ?></span></strong>&nbsp;<em><span style="text-decoration:underline;">Age:</span></em>&nbsp;<strong><span class="variable"><?php echo $age_enfant; ?></span></strong></td>
							<td></td>
						</tr>
						<tr>
							<td colspan="3"><hr /></td>
						</tr>
						<tr>	
							<td colspan="2"><span style="text-decoration:underline;">Période/Date:</span>&nbsp;<strong><span class="variable"><?php echo $periode_sejour; ?></span></strong>&nbsp;::&nbsp; <strong><span class="variable"><?php echo $duree_sejour; ?></span></strong></td>
							<td></td>
						</tr>
						<tr>
							<td colspan="3"><hr /></td>
						</tr>
						<tr>
							<td colspan="3"><span style="text-decoration:underline;">Services complémentaires:</span>&nbsp;<strong><span class="variable"><?php echo $indication1; ?></span></strong>&nbsp;::&nbsp;<strong><span class="variable"><?php echo $indication2; ?></span></strong>&nbsp;::&nbsp;<strong><span class="variable"><?php echo $indication3; ?></span></strong>&nbsp;::&nbsp;<strong><span class="variable"><?php echo $indication4; ?></span></strong>&nbsp;::&nbsp;<strong><span class="variable"><?php echo $indication5; ?></span></strong>&nbsp;::&nbsp;<strong><span class="variable"><?php echo $indication6; ?></span></strong></td>
						</tr>
						<tr>	
							<td colspan="3"><span style="text-decoration:underline;">Activités possible:</span>&nbsp;<strong><span class="variable"><?php echo $activite_disponible1; ?></span></strong>&nbsp;::&nbsp;<strong><span class="variable"><?php echo $activite_disponible2; ?></span></strong></td>
						</tr>
						<tr>	
							<td colspan="3"><span style="text-decoration:underline;">Partie attrayante de la région:</span>&nbsp;<strong><span class="variable"><?php echo $region1; ?></span></strong>&nbsp;::&nbsp;<strong><span class="variable"><?php echo $region2; ?></span></strong>&nbsp;::&nbsp;<strong><span class="variable"><?php echo $region3; ?></span></strong>&nbsp;::&nbsp;<strong><span class="variable"><?php echo $region4; ?></span></strong></td>
						</tr>
						<tr>
							<td colspan="3"><hr /></td>
						</tr>
						<tr>
							<td colspan="3"><span style="text-decoration:underline;">Destinations préférées:</span>&nbsp;<strong><span class="variable"><?php echo $choix1_destination; ?></span></strong>&nbsp;::&nbsp;<strong><span class="variable"><?php echo $choix2_destination; ?></span></strong>&nbsp;::&nbsp;<strong><span class="variable"><?php echo $choix3_destination; ?></span></strong></td>
						</tr
						<tr>
							<td colspan="3"><hr /></td>
						</tr>
						<tr>
							<td colspan="3"><center><span style="text-decoration:underline;">Photo:</span><br/><img src="http://www.voyage-surfing.com/photos/<?php echo "$savefile"; ?>" /></center></td>
						</tr>
						<tr>
							<td colspan="3"><hr /></td>
						</tr>
						<tr>	
							<td colspan="3"><span style="text-decoration:underline;">Commentaire:</span><br/><strong><span class="variable"><?php echo $qualites; ?></span></strong></td>
						</tr>
						<tr>
							<td colspan="3"><hr /></td>
						</tr>
						<tr>
							<td colspan="3"><span style="text-decoration:underline;">Indications importantes:</span><br/><em><span style="text-decoration:underline;">Advertissement:</span></em>&nbsp;<strong><span class="variable"><?php echo $avertissement; ?></span></strong>&nbsp;::&nbsp;<em><span style="text-decoration:underline;">Allergie possible:</span></em>&nbsp;<strong><span class="variable"><?php echo $allergie; ?></span></strong>&nbsp;::&nbsp;<em><span style="text-decoration:underline;">Niveau expert:</span></em>&nbsp;<strong><span class="variable"><?php echo $expert; ?></span></strong><br/><em><span style="text-decoration:underline;">En extra:</span></em>&nbsp;<strong><span class="variable"><?php echo $extra1; ?></span></strong>&nbsp;::&nbsp;<strong><span class="variable"><?php echo $extra2; ?></span></strong></td>
						</tr>
						<tr>
							<td colspan="3"><hr /></td>
						</tr>
						<tr>
							<td colspan="3"><span style="text-decoration:underline;">Contact:</span>&nbsp;<strong><span class="variable"><?php echo $nom; ?></span></strong>&nbsp;<strong><span class="variable"><?php echo $prenom; ?></span></strong>&nbsp;<strong><span class="variable"><?php echo $adresse; ?></span></strong>&nbsp;<strong><span class="variable"><?php echo $codepostal; ?></span></strong>&nbsp;<strong><span class="variable"><?php echo $ville; ?></span></strong>&nbsp;<strong><span class="variable"><?php echo $pays_domicile; ?></span></strong><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<em><span style="text-decoration:underline;">Email:</span></em>&nbsp;<strong><span class="variable"><?php echo $email; ?></span></strong></td>
						</tr>
						<tr>
							<td colspan="3"><hr /></td>
						</tr>
						<tr>
							<td colspan="3"><span style="text-decoration:underline;">Divers:</span>&nbsp;<em><span style="text-decoration:underline;">Profession:</span></em>&nbsp;<strong><span class="variable"><?php echo $profession; ?></span></strong>&nbsp;::&nbsp;<em><span style="text-decoration:underline;">Site internet:</span></em>&nbsp;<strong><span class="variable"><?php echo $site_internet; ?></span></strong><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<em><span style="text-decoration:underline;">Langue parlée:</span></em>&nbsp;<strong><span class="variable"><?php echo $langue_parlee1; ?></span></strong>&nbsp;::&nbsp;<strong><span class="variable"><?php echo $langue_parlee2; ?></span></strong><br /><br /><br /><br /><br /></td>
						</tr>
					</table>
					<?php
				}
				?>
Bien entendu, une session_start() se trouve sur toutes mes pages
 
WRInaute accro
merci de ton attention STFprod
mais à force de tourner cela dans tous les sens......waou!!...je suis tenace...car je ne compte pas les fois depuis plusieurs jours que je reprends continuellement mon script et j'ai fini par comprendre mon erreur était d'avoir laissé trainer sur cette page plus haut "annonce.php" mes valeurs $pseudo et $motdepasse et lors de ma requête pour extraire mon résultat.......ma session prenait par défaut ces variables!!!!! :oops:
maintenant, je les ai viré et c'est parfait....je peux surfer sur toutes mes pages et faire une requête sur pour extraire chaque annonce....ma page "test.php" reste sur mon login!!!! :D
 
WRInaute passionné
Ton code y'a pas mal de choses à améliorée, tu le verras avec le temps; mais une principalement :

Code:
 mysql_connect("xxxx", "xxxxx", "xxxx"); //connexion Table Msql
               mysql_select_db("xxxxx");

Mets ça dans un fichier dans un dossier protégé et tu fais un include de ce fichier.
 
WRInaute accro
Ok Bacteries!
Merci pour ces infos.....j'imagine contre le piratage......je préfère perdre un peu de temps mais sécurisé ma BDD, je vais mettre cette page dans un secteur protégé.

Encore merci!
 
Discussions similaires
Haut