IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage PHP Discussion :

blocage du résultat d'un javascript


Sujet :

Langage PHP

  1. #1
    Membre actif
    Profil pro
    Loisir
    Inscrit en
    Novembre 2011
    Messages
    159
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Loisir

    Informations forums :
    Inscription : Novembre 2011
    Messages : 159
    Points : 284
    Points
    284
    Par défaut blocage du résultat d'un javascript
    Bonjour,

    veuillez excuser mes impressions de vocabulaire et autres horreurs que vous trouverez dans mes codes, je suis débutant.

    J'ai créé une page composée de formulaires (listes déroulantes) pour lesquels tout changement de choix modifie un paramètre d'un script en javascript (utilisant OpenLayers) et recharge la page.

    Lorsque cette page est enregistrée en html ou php (sans session), la page fonctionne sans problème.
    exemple :
    • état inital : choix 1 (eau en bleu) de la liste 1 donc carte avec le fleuve en bleu
    • l'utilisateur prends le choix 2 (eau en rouge) de la liste 1
    • la page se recharge avec la carte avec le fleuve en rouge et le choix de la liste 1 est 2

    C'est exactement ce que je veux.

    Mais lorsque j'intègre un mécanisme de session, la page recharge son état initial.
    exemple :
    • état inital : choix 1 (eau en bleu) de la liste 1 donc carte avec le fleuve en bleu
    • l'utilisateur prends le choix 2 (eau en rouge) de la liste 1
    • la page se recharge avec la carte avec le fleuve en bleu et le choix de la liste 1 revient à 1


    voici les codes de mes pages sans et avec session :

    Code html : 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
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"> -->
    <html>
    	<head>
    		<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    		<title>Première carte avec OpenStreetMap</title>
    		<script type="text/javascript" src="OpenLayers/lib/OpenLayers.js"></script>
    		<link rel="stylesheet" href="carte.css" type="text/css">
    	</head>
    	<body onload="init()">
    		<form>
    		<div id="legend_validation">
    			<div id="info">
    				<b>login :
    			</div>
    				<div id="legend">
    					<div id="legend_echelle">
    						<div id="legend_echelle_titre" style="text-align: center">
    							ÉCHELLE
    						</div>
    						<div id="legend_echelle_choix">
    							<FORM NAME="legend_echelle">
    								<select name="choix_echelle" id="choix_echelle" onChange=javascript:location.reload() style="min-width: 400px">
    									<option value="choix1_echelle">Département</option>
    									<option value="choix2_echelle">Val de Tours et val de Luynes</option>
    									<option value="choix3_echelle">Commune</option>
    									<option value="choix4_echelle">Quartier</option>
    								</select>
    							</FORM>
    						</div>
    					</div>
    					<div id="legend_alea">
    						<div id="legend_alea_titre" style="text-align: center">
    							ALÉA
    						</div>
    						<div id="legend_alea_choix">
    							<select name="choix_alea" id="choix_alea" onChange=javascript:location.reload() style="min-width: 400px">
    								<option value="choix1_alea">Sans aléa</option>
    								<option value="choix2_alea" selected="Selected">Dégradé de bleu</option>
    								<option value="choix3_alea">Dégradé de rouge</option>
    								<option value="choix4_alea">Couleurs du PPRI</option>
    								<option value="choix5_alea">Couleurs de l'AZI</option>
    								<option value="choix6_alea">Bleu uni</option>
    								<option value="choix7_alea">Rouge uni</option>
    							</select>
    						</div>
    					</div>
    					<div id="legend_bati">
    						<div id="legend_bati_titre" style="text-align: center">
    							BÂTI À ÉVACUER
    						</div>
    						<div id="legend_bati_choix">
    							<select name="choix_bati" id="choix_bati" onChange=javascript:location.reload() style="min-width: 400px">
    								<option value="choix1_bati" selected="Selected">Sans bâtiment</option>
    								<option value="choix2_bati">Mon appartement (point)</option>
    								<option value="choix3_bati">Mon appartement (icône)</option>
    								<option value="choix4_bati">Mon appartement (forme réelle)</option>
    								<option value="choix5_bati">Tous les immeubles (points simples)</option>
    								<option value="choix6_bati">Tous les immeubles (points), nombre total</option>
    								<option value="choix7_bati">Tous les immeubles (points), nombre d'évacués sur le créneau</option>
    								<option value="choix8_bati">Tous les immeubles (points), nombre d'évacués depuis le début</option>
    								<option value="choix9_bati">Tous les immeubles (points), nombre total et % d'évacués depuis le début</option>
    								<option value="choix10_bati">Tous les immeubles (forme réelle)</option>
    								<option value="choix11_bati">Tous les immeubles (forme réelle), % d'évacués sur le créneau</option>
    								<option value="choix12_bati">Tous les immeubles (forme réelle), % d'évacués depuis le début</option>
    							</select>
    							<form>
    								<input type="radio" name="bati_radio" id="bati_r0" value="sans">sans information complémentaire <br />
    								<input type="radio" name="bati_radio" id="bati_r1" value="nb_hab">en nombre d'habitants <br />
    								<input type="radio" name="bati_radio" id="bati_r2" value="nb_veh">en nombre de véhicules
    							</form>
    						</div>
    					</div>
    					<div id="legend_iti_evac">
    						<div id="legend_iti_evac_titre" style="text-align: center">
    							ITINÉRAIRE D'ÉVACUATION
    						</div>
    						<div id="legend_iti_evac_choix">
    							<select name="choix_iti_evac" id="choix_iti_evac" onChange=javascript:location.reload() style="min-width: 400px">
    								<option value="choix1_iti" selected="Selected">Sans itinéraire</option>
    								<option value="choix2_iti">Trait simple</option>
    								<option value="choix3_iti">Nombre de véhicules</option>
    								<option value="choix4_iti">Saturation du(des) itéraire(s)</option>
    								<option value="choix5_iti">Nombre de véhicules et saturation du(des) itéraire(s)</option>
    							</select>
    							<form>
    								<input type="radio" name="iti_radio" id="iti_r1" value="nb_hab">Sans nom de route<br />
    								<input type="radio" name="iti_radio" id="iti_r2" value="nb_hab">Nom des avenues<br />
    								<input type="radio" name="iti_radio" id="iti_r3" value="nb_veh">Nom des petites rues
    							</form>
    						</div>
    					</div>
    					<div id="legend_croisement">
    						<div id="legend_croisement_titre" style="text-align: center">
    							CROISEMENTS
    						</div>
    						<div id="legend_croisement_choix">
    							<select name="choix_croisement" id="choix_croisement" onChange=javascript:location.reload() style="min-width: 400px">
    								<option value="choix1_croisement" selected="Selected">Sans croisements</option>
    								<option value="choix2_croisement">Nombre de véhicules</option>
    								<option value="choix3_croisement">Nombre de routes accédantes</option>
    							</select>
    							<form>
    								<input type="radio" name="croisement_radio" id="croisement_r1" value="sans_texte">Sans texte<br />
    								<input type="radio" name="croisement_radio" id="croisement_r2" value="avec_texte">Avec texte
    							</form>
    						</div>
    					</div>
    					<div id="legend_ZRO">
    						<div id="legend_ZRO_titre" style="text-align: center">
    							ZONES DE REGROUPEMENT<br />ET D'ORIENTATION
    						</div>
    						<div id="legend_ZRO_choix">
    							<select name="choix_ZRO" id="choix_ZRO" onChange=javascript:location.reload() style="min-width: 400px">
    								<option value="choix1_ZRO" selected="Selected">Sans les Zones de Regroupements et d'Orientation (ZRO)</option>
    								<option value="choix2_ZRO">ZRO (forme réelle) simple</option>
    								<option value="choix3_ZRO">ZRO (forme réelle) pourcentage d'occupation</option>
    								<option value="choix4_ZRO">ZRO (point) simple</option>
    								<option value="choix5_ZRO">ZRO (point) capacité d'accueil</option>
    								<option value="choix6_ZRO">ZRO (point) pourcentage de remplissage</option>
    								<option value="choix7_ZRO">ZRO (point) capacité d'accueil et pourcentage de remplissage</option>
    							</select>
    							<form>
    								<input type="radio" name="ZRO_radio" id="ZRO_r1" value="logo">Sans information complémentaire<br />
    								<input type="radio" name="ZRO_radio" id="ZRO_r1" value="logo">Logo des fonctionnalités<br />
    								<input type="radio" name="ZRO_radio" id="ZRO_r2" value="texte">Texte des fonctionnalités<br />
    								<input type="radio" name="ZRO_radio" id="ZRO_r3" value="logo_texte">Logo et texte
    							</form>
    						</div>
    					</div>
    					<div id="legend_secondaire">
    						<div id="legend_secondaire_titre" style="text-align: center">
    							AUTRES INFORMATIONS
    						</div>
    						<div id="legend_secondaire_choix">
    							<form>
    								<input type="checkbox" name="second_mairie" id="second_mairie" value="mairie">Mairie<br />
    								<input type="checkbox" name="second_gare" id="second_gare" value="gare">Gare
    							</form>
    						</div>
    					</div>
    					<div id="legend_fond">
    						<div id="legend_fond_titre" style="text-align: center">
    							FOND DE CARTE
    						</div>
    						<div id="legend_fond_choix">
    							<FORM NAME="legend_fond">
    								<select name="choix_fond" id="choix_fond" onChange=javascript:location.reload() style="min-width: 400px">
    									<option value="choix1_fond" selected="Selected">OpenStreetMap</option>
    									<option value="choix2_fond">Limites communales</option>
    									<option value="choix3_fond">Réseau routier</option>
    									<option value="choix4_fond">Batîments</option>
    								</select>
    							</FORM>					
    						</div>
    					</div>
    				</div>
    				<div id="validation">
    				TEST
    				</div>
    		</div>
    		<div id="question_map">
    			<div id="question_commentaire">
    				<div id="question">
    					<b>A quelle(s) question(s) dois vous permettre de répondre cette carte ?</b>
    				</div>
    				<div id="commentaire" align="right">
    					<textarea name="commentaires">commentaires et remarques</textarea>
    				</div>
    			</div>
    			<div id="map">
    				<script type="text/javascript" src="carte.js"></script>
    			</div>
    		</div>
    	</form>
    	</body>
    </html>

    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
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    <?php
     
    session_start();
     
    // Test de connexion à la base de données.
    try {
    	$bdd = new PDO("mysql:host=localhost;dbname=ciri","root","5zk83vxx2l");
    }
    catch (PDOException $e){
    	die("Erreur : ".$e->getMessage());
    }
     
    ?>
     
    <html>
    	<head>
    		<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    		<title>Première carte avec OpenStreetMap</title>
    		<script type="text/javascript" src="OpenLayers/lib/OpenLayers.js"></script>
    		<link rel="stylesheet" href="carte.css" type="text/css">
    	</head>
    	<body onload="init()">
    		<form>
    		<div id="legend_validation">
    			<div id="info">
    				<b>login : <?php echo $_SESSION['login'] ?> </b> <br>
    			</div>
    				<div id="legend">
    					<div id="legend_echelle">
    						<div id="legend_echelle_titre" style="text-align: center">
    							ÉCHELLE
    						</div>
    						<div id="legend_echelle_choix">
    							<FORM NAME="legend_echelle">
    								<select name="choix_echelle" id="choix_echelle" onChange=javascript:location.reload() style="min-width: 400px">
    									<option value="choix1_echelle">Département</option>
    									<option value="choix2_echelle">Val de Tours et val de Luynes</option>
    									<option value="choix3_echelle">Commune</option>
    									<option value="choix4_echelle">Quartier</option>
    								</select>
    							</FORM>
    						</div>
    					</div>
    					<div id="legend_alea">
    						<div id="legend_alea_titre" style="text-align: center">
    							ALÉA
    						</div>
    						<div id="legend_alea_choix">
    							<select name="choix_alea" id="choix_alea" onChange=javascript:location.reload() style="min-width: 400px">
    								<option value="choix1_alea">Sans aléa</option>
    								<option value="choix2_alea" selected="Selected">Dégradé de bleu</option>
    								<option value="choix3_alea">Dégradé de rouge</option>
    								<option value="choix4_alea">Couleurs du PPRI</option>
    								<option value="choix5_alea">Couleurs de l'AZI</option>
    								<option value="choix6_alea">Bleu uni</option>
    								<option value="choix7_alea">Rouge uni</option>
    							</select>
    						</div>
    					</div>
    					<div id="legend_bati">
    						<div id="legend_bati_titre" style="text-align: center">
    							BÂTI À ÉVACUER
    						</div>
    						<div id="legend_bati_choix">
    							<select name="choix_bati" id="choix_bati" onChange=javascript:location.reload() style="min-width: 400px">
    								<option value="choix1_bati" selected="Selected">Sans bâtiment</option>
    								<option value="choix2_bati">Mon appartement (point)</option>
    								<option value="choix3_bati">Mon appartement (icône)</option>
    								<option value="choix4_bati">Mon appartement (forme réelle)</option>
    								<option value="choix5_bati">Tous les immeubles (points simples)</option>
    								<option value="choix6_bati">Tous les immeubles (points), nombre total</option>
    								<option value="choix7_bati">Tous les immeubles (points), nombre d'évacués sur le créneau</option>
    								<option value="choix8_bati">Tous les immeubles (points), nombre d'évacués depuis le début</option>
    								<option value="choix9_bati">Tous les immeubles (points), nombre total et % d'évacués depuis le début</option>
    								<option value="choix10_bati">Tous les immeubles (forme réelle)</option>
    								<option value="choix11_bati">Tous les immeubles (forme réelle), % d'évacués sur le créneau</option>
    								<option value="choix12_bati">Tous les immeubles (forme réelle), % d'évacués depuis le début</option>
    							</select>
    							<form>
    								<input type="radio" name="bati_radio" id="bati_r0" value="sans">sans information complémentaire <br />
    								<input type="radio" name="bati_radio" id="bati_r1" value="nb_hab">en nombre d'habitants <br />
    								<input type="radio" name="bati_radio" id="bati_r2" value="nb_veh">en nombre de véhicules
    							</form>
    						</div>
    					</div>
    					<div id="legend_iti_evac">
    						<div id="legend_iti_evac_titre" style="text-align: center">
    							ITINÉRAIRE D'ÉVACUATION
    						</div>
    						<div id="legend_iti_evac_choix">
    							<select name="choix_iti_evac" id="choix_iti_evac" onChange=javascript:location.reload() style="min-width: 400px">
    								<option value="choix1_iti" selected="Selected">Sans itinéraire</option>
    								<option value="choix2_iti">Trait simple</option>
    								<option value="choix3_iti">Nombre de véhicules</option>
    								<option value="choix4_iti">Saturation du(des) itéraire(s)</option>
    								<option value="choix5_iti">Nombre de véhicules et saturation du(des) itéraire(s)</option>
    							</select>
    							<form>
    								<input type="radio" name="iti_radio" id="iti_r1" value="nb_hab">Sans nom de route<br />
    								<input type="radio" name="iti_radio" id="iti_r2" value="nb_hab">Nom des avenues<br />
    								<input type="radio" name="iti_radio" id="iti_r3" value="nb_veh">Nom des petites rues
    							</form>
    						</div>
    					</div>
    					<div id="legend_croisement">
    						<div id="legend_croisement_titre" style="text-align: center">
    							CROISEMENTS
    						</div>
    						<div id="legend_croisement_choix">
    							<select name="choix_croisement" id="choix_croisement" onChange=javascript:location.reload() style="min-width: 400px">
    								<option value="choix1_croisement" selected="Selected">Sans croisements</option>
    								<option value="choix2_croisement">Nombre de véhicules</option>
    								<option value="choix3_croisement">Nombre de routes accédantes</option>
    							</select>
    							<form>
    								<input type="radio" name="croisement_radio" id="croisement_r1" value="sans_texte">Sans texte<br />
    								<input type="radio" name="croisement_radio" id="croisement_r2" value="avec_texte">Avec texte
    							</form>
    						</div>
    					</div>
    					<div id="legend_ZRO">
    						<div id="legend_ZRO_titre" style="text-align: center">
    							ZONES DE REGROUPEMENT<br />ET D'ORIENTATION
    						</div>
    						<div id="legend_ZRO_choix">
    							<select name="choix_ZRO" id="choix_ZRO" onChange=javascript:location.reload() style="min-width: 400px">
    								<option value="choix1_ZRO" selected="Selected">Sans les Zones de Regroupements et d'Orientation (ZRO)</option>
    								<option value="choix2_ZRO">ZRO (forme réelle) simple</option>
    								<option value="choix3_ZRO">ZRO (forme réelle) pourcentage d'occupation</option>
    								<option value="choix4_ZRO">ZRO (point) simple</option>
    								<option value="choix5_ZRO">ZRO (point) capacité d'accueil</option>
    								<option value="choix6_ZRO">ZRO (point) pourcentage de remplissage</option>
    								<option value="choix7_ZRO">ZRO (point) capacité d'accueil et pourcentage de remplissage</option>
    							</select>
    							<form>
    								<input type="radio" name="ZRO_radio" id="ZRO_r1" value="logo">Sans information complémentaire<br />
    								<input type="radio" name="ZRO_radio" id="ZRO_r1" value="logo">Logo des fonctionnalités<br />
    								<input type="radio" name="ZRO_radio" id="ZRO_r2" value="texte">Texte des fonctionnalités<br />
    								<input type="radio" name="ZRO_radio" id="ZRO_r3" value="logo_texte">Logo et texte
    							</form>
    						</div>
    					</div>
    					<div id="legend_secondaire">
    						<div id="legend_secondaire_titre" style="text-align: center">
    							AUTRES INFORMATIONS
    						</div>
    						<div id="legend_secondaire_choix">
    							<form>
    								<input type="checkbox" name="second_mairie" id="second_mairie" value="mairie">Mairie<br />
    								<input type="checkbox" name="second_gare" id="second_gare" value="gare">Gare
    							</form>
    						</div>
    					</div>
    					<div id="legend_fond">
    						<div id="legend_fond_titre" style="text-align: center">
    							FOND DE CARTE
    						</div>
    						<div id="legend_fond_choix">
    							<FORM NAME="legend_fond">
    								<select name="choix_fond" id="choix_fond" onChange=javascript:location.reload() style="min-width: 400px">
    									<option value="choix1_fond" selected="Selected">OpenStreetMap</option>
    									<option value="choix2_fond">Limites communales</option>
    									<option value="choix3_fond">Réseau routier</option>
    									<option value="choix4_fond">Batîments</option>
    								</select>
    							</FORM>					
    						</div>
    					</div>
    				</div>
    				<div id="validation">
    				TEST
    				</div>
    		</div>
    		<div id="question_map">
    			<div id="question_commentaire">
    				<div id="question">
    					<b>A quelle(s) question(s) dois vous permettre de répondre cette carte ?</b>
    				</div>
    				<div id="commentaire" align="right">
    					<textarea name="commentaires">commentaires et remarques</textarea>
    				</div>
    			</div>
    			<div id="map">
    				<script type="text/javascript" src="carte.js"></script>
    			</div>
    		</div>
    	</form>
    	</body>
    </html>
    Quel est le mécanisme que je comprends pas selon vous ?
    Je vous remercie de votre aide

  2. #2
    Membre expérimenté
    Homme Profil pro
    Inscrit en
    Septembre 2009
    Messages
    875
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Septembre 2009
    Messages : 875
    Points : 1 313
    Points
    1 313
    Par défaut
    ta session ne sert qu'a afficher le nom du login de l'utilisateur c'est ca?

  3. #3
    Membre actif
    Profil pro
    Loisir
    Inscrit en
    Novembre 2011
    Messages
    159
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Loisir

    Informations forums :
    Inscription : Novembre 2011
    Messages : 159
    Points : 284
    Points
    284
    Par défaut
    pour le moment oui, mais à terme elle doit permettre de :
    - afficher un include() en fonction de l'utilisateur (plus précisément par rapport à la réponse à une question d'un questionnaire limesurvey)
    - permettre d'enregistrer tous les choix de l'utilisateur dans un base de donnée.

    Le but n'est pas seulement d'afficher une carte mais enregistrer aussi les choix d'affichage.

    Voici le script en js qui permet l'affichage de la carte en fonction des choix :
    Code javascript : 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
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    function init() {
        //couleur de l'aléa
        var docdiv = document.getElementById("choix_alea");
        var index = docdiv.selectedIndex;
        switch (index) {
            case 0:
                var SDL_choix1 = "http://localhost/SLD/SLD_ALEA_BLEU.xml";
                var val_opacity1 = 0;
                //alert("Sans");
            break;
            case 1:
                var SDL_choix1 = "http://localhost/SLD/SLD_ALEA_BLEU.xml";
                var val_opacity1 = 0.5;
                //alert("bleu");
            break;     
            case 2:
                var SDL_choix1 = "http://localhost/SLD/SLD_ALEA_ROUGE.xml";
                var val_opacity1 = 0.5;
                //alert("rouge");
            break;
            case 3:
                var SDL_choix1 = "http://localhost/SLD/SLD_ALEA_PPRI.xml";
                var val_opacity1 = 0.5;
                //alert("ppri");
            break;
            case 4:
                var SDL_choix1 = "http://localhost/SLD/SLD_ALEA_AZI.xml";
                var val_opacity1 = 0.5;
                //alert("azi");
            break;
            case 5:
                var SDL_choix1 = "http://localhost/SLD/SLD_ALEA_BLEU_UNI.xml";
                var val_opacity1 = 0.5;
                //alert("bleu uni");
            break;
            case 6:
                var SDL_choix1 = "http://localhost/SLD/SLD_ALEA_ROUGE_UNI.xml";
                var val_opacity1 = 0.5;
                //alert("rouge uni");
            break;
        };
     
        //zoom initial
        var docdiv4 = document.getElementById("choix_echelle");
        var index4 = docdiv4.selectedIndex;
        switch (index4) {
            case 0:
                var Xi = 66000.0
                var Yi = 6000754.0
                var Ni = 10
                //alert("Département");
            break;
            case 1:
                var Xi = 77000.0
                var Yi = 6006088.0
                var Ni = 11
                //alert("Val");
            break;
            case 2:
                var Xi = 77000.0
                var Yi = 6006088.0
                var Ni = 13
                //alert("Commune");
            break;     
            case 3:
                var Xi = 77000.0
                var Yi = 6006000.0
                var Ni = 15
                //alert("Quartier");
            break;
        };
     
        //bati+WMS itinéraire
        var docdiv = document.getElementById("choix_bati");
        var index = docdiv.selectedIndex;
        switch (index) {
            case 0:
                var SDL_choix3 = "http://localhost/SLD/SLD_bati_point_simple.xml";
                var val_opacity3 = 0;
                var layer3 = "bati";
                var http_wms3 = "http://localhost/cgi-bin/mapserv?map=/var/www/mapfile/bati_wms.map&";
                var http_wms4 = "http://localhost/cgi-bin/mapserv?map=/var/www/mapfile/itineraire_tous_wms2.map&";
                //alert("Sans");
            break;
            case 1:
                var SDL_choix3 = "http://localhost/SLD/SLD_bati_point_simple_unique.xml";
                var val_opacity3 = 1;
                var layer3 = "bati";
                var http_wms3 = "http://localhost/cgi-bin/mapserv?map=/var/www/mapfile/bati_wms.map&";
                var http_wms4 = "http://localhost/cgi-bin/mapserv?map=/var/www/mapfile/itineraire_unique_wms.map&";
                //alert("bleu");
            break;     
            case 2:
                var SDL_choix3 = "http://localhost/SLD/SLD_bati_icone_simple_unique.xml";
                var val_opacity3 = 1;
                var layer3 = "bati";
                var http_wms3 = "http://localhost/cgi-bin/mapserv?map=/var/www/mapfile/bati_wms.map&";
                var http_wms4 = "http://localhost/cgi-bin/mapserv?map=/var/www/mapfile/itineraire_unique_wms.map&";
                //alert("rouge");
            break;
            case 3:
                var SDL_choix3 = "http://localhost/SLD/SLD_bati_forme_simple_unique.xml";
                var val_opacity3 = 1;
                var layer3 = "BATI_FORME";
                var http_wms3 = "http://localhost/cgi-bin/mapserv?map=/var/www/mapfile/bati_forme_wms.map&";
                var http_wms4 = "http://localhost/cgi-bin/mapserv?map=/var/www/mapfile/itineraire_unique_wms.map&";
                //alert("ppri");
            break;
            case 4:
                var SDL_choix3 = "http://localhost/SLD/SLD_bati_point_simple.xml";
                var val_opacity3 = 1;
                var layer3 = "bati";
                var http_wms3 = "http://localhost/cgi-bin/mapserv?map=/var/www/mapfile/bati_wms.map&";
                var http_wms4 = "http://localhost/cgi-bin/mapserv?map=/var/www/mapfile/itineraire_tous_wms2.map&";
                //alert("azi");
            break;
            case 5:
                var SDL_choix3 = "http://localhost/SLD/SLD_bati_point_total.xml";
                var val_opacity3 = 1;
                var layer3 = "bati";
                var http_wms3 = "http://localhost/cgi-bin/mapserv?map=/var/www/mapfile/bati_wms.map&";
                var http_wms4 = "http://localhost/cgi-bin/mapserv?map=/var/www/mapfile/itineraire_tous_wms2.map&";
                //alert("azi");
            break;
            case 6:
                var SDL_choix3 = "http://localhost/SLD/SLD_bati_pourcent_creneau.xml";
                var val_opacity3 = 1;
                var layer3 = "bati";
                var http_wms3 = "http://localhost/cgi-bin/mapserv?map=/var/www/mapfile/bati_wms.map&";
                var http_wms4 = "http://localhost/cgi-bin/mapserv?map=/var/www/mapfile/itineraire_tous_wms2.map&";
                //alert("azi");
            break;
            case 7:
                var SDL_choix3 = "http://localhost/SLD/SLD_bati_pourcent_debut.xml";
                var val_opacity3 = 1;
                var layer3 = "bati";
                var http_wms3 = "http://localhost/cgi-bin/mapserv?map=/var/www/mapfile/bati_wms.map&";
                var http_wms4 = "http://localhost/cgi-bin/mapserv?map=/var/www/mapfile/itineraire_tous_wms2.map&";
                //alert("azi");
            break;
            case 8:
                //var SDL_choix3 = "http://localhost/SLD/SLD_bati_tot_pourc.xml";
                var SDL_choix3 = "http://localhost/SLD/SLD_bati_point_simple.xml";
                var val_opacity3 = 1;
                var layer3 = "bati";
                var http_wms3 = "http://localhost/cgi-bin/mapserv?map=/var/www/mapfile/bati_wms.map&";
                var http_wms4 = "http://localhost/cgi-bin/mapserv?map=/var/www/mapfile/itineraire_tous_wms2.map&";
                alert("actuellement non fonctionnel");
            break;
            case 9:
                var SDL_choix3 = "http://localhost/SLD/SLD_bati_forme_simple.xml";
                var val_opacity3 = 1;
                var layer3 = "BATI_FORME";
                var http_wms3 = "http://localhost/cgi-bin/mapserv?map=/var/www/mapfile/bati_forme_wms.map&";
                var http_wms4 = "http://localhost/cgi-bin/mapserv?map=/var/www/mapfile/itineraire_tous_wms2.map&";
                //alert("azi");
            break;
            case 10:
                var SDL_choix3 = "http://localhost/SLD/SLD_bati_forme_pourcent_creneau.xml";
                var val_opacity3 = 1;
                var layer3 = "BATI_FORME";
                var http_wms3 = "http://localhost/cgi-bin/mapserv?map=/var/www/mapfile/bati_forme_wms.map&";
                var http_wms4 = "http://localhost/cgi-bin/mapserv?map=/var/www/mapfile/itineraire_tous_wms2.map&";
                //alert("azi");
            break;
            case 11:
                var SDL_choix3 = "http://localhost/SLD/SLD_bati_forme_pourcent_debut.xml";
                var val_opacity3 = 1;
                var layer3 = "BATI_FORME";
                var http_wms3 = "http://localhost/cgi-bin/mapserv?map=/var/www/mapfile/bati_forme_wms.map&";
                var http_wms4 = "http://localhost/cgi-bin/mapserv?map=/var/www/mapfile/itineraire_tous_wms2.map&";
                //alert("azi");
            break;
        };
     
        //itinéraire sans WMS
        var docdiv = document.getElementById("choix_iti_evac");
        var index = docdiv.selectedIndex;
        switch (index) {
            case 0:
                var SDL_choix4 = "http://localhost/SLD/SLD_itineraire_simple.xml";
                var val_opacity4 = 0;
                //alert("Sans");
            break;
            case 1:
                var SDL_choix4 = "http://localhost/SLD/SLD_itineraire_simple.xml";
                var val_opacity4 = 1;
                //alert("bleu");
            break;     
            case 2:
                var SDL_choix4 = "http://localhost/SLD/SLD_itineraire_nombre.xml";
                var val_opacity4 = 1;
                //alert("rouge");
            break;
            case 3:
                var SDL_choix4 = "http://localhost/SLD/SLD_itineraire_saturation.xml";
                var val_opacity4 = 1;
                //alert("ppri");
            break;
            case 4:
                var SDL_choix4 = "http://localhost/SLD/SLD_itineraire_nombre_saturation.xml";
                //var SDL_choix4 = "http://localhost/SLD/SLD_itineraire_simple.xml";
                var val_opacity4 = 1;
                //alert("actuellement non fonctionnel");
            break;
        };
     
    //définition des couches dans OL
        var map = new OpenLayers.Map('map', {projection: new OpenLayers.Projection("EPSG:900913"),controls:[]});
        var osmLayer = new OpenLayers.Layer.OSM("OSM"
            /*{sphericalMercator: true,
            srs: "epsg:900913"
            }*/
        );
        var wms = new OpenLayers.Layer.MapServer("communes", "http://localhost/cgi-bin/mapserv?map=/var/www/mapfile/admin.map&",
            {layers: "COMMUNE_WGS84",
            isBaseLayer: true,
            transparent: false,
            srs: "epsg:2154"
            }
        ); 
        var wms_alea = new OpenLayers.Layer.WMS("alea", "http://localhost/cgi-bin/mapserv?map=/var/www/mapfile/alea_wms.map&",
            {layers: "alea_raster",
            transparent: true,
            SLD: SDL_choix1
            },
            {opacity: val_opacity1
            }
        );
        /*var wms_bati_point = new OpenLayers.Layer.WMS("bati", "http://localhost/cgi-bin/mapserv?map=/var/www/mapfile/bati_wms.map&",
            {layers: "bati",
            transparent: true,
            SLD: SDL_choix3
            },
            {opacity: val_opacity3
            }
        );
        var wms_bati_forme = new OpenLayers.Layer.WMS("bati", "http://localhost/cgi-bin/mapserv?map=/var/www/mapfile/bati_forme_wms.map&",
            {layers: "BATI_FORME",
            transparent: true,
            }
        );*/
        var wms_bati = new OpenLayers.Layer.WMS("bati", http_wms3,
            {layers: layer3,
            transparent: true,
            SLD: SDL_choix3
            },
            {opacity: val_opacity3
            }
        );
        var wms_itineraire = new OpenLayers.Layer.WMS("itinéraire", http_wms4,
            {layers: "chemin",
            transparent: true,
            SLD: SDL_choix4
            },
            {opacity: val_opacity4
            }
        );
        var wms_itineraire2 = new OpenLayers.Layer.WMS("itinéraire", "http://localhost/cgi-bin/mapserv?map=/var/www/mapfile/itineraire_tous_wms2.map&",
            {layers: "chemin",
            transparent: true
            },
            {opacity: 1
            }
        );
        /*var wms3 = new OpenLayers.Layer.WMS("alea_background", "http://localhost/cgi-bin/mapserv?map=/var/www/mapfile/alea_wms.map&",
            {layers: "alea_raster",
            isBaseLayer: true}
        );*/
        projection: new OpenLayers.Projection("EPSG:900913"),
        //affichage couche de base
        map.addLayer(osmLayer);
        map.addLayer(wms);
        //affichage couche overlay
        map.addLayer(wms_alea);
        //map.addLayer(wms_bati_forme);
        //map.addLayer(wms_bati_point);
        map.addLayer(wms_itineraire);
        map.addLayer(wms_bati);
        //map.addLayer(wms3);
        //map.zoomToMaxExtent();
        //controles
        map.setCenter(new OpenLayers.LonLat(Xi, Yi), Ni);
        map.addControl(new OpenLayers.Control.LayerSwitcher());
        map.addControl(new OpenLayers.Control.Navigation());
        //map.addControl(new OpenLayers.Control.PanZoomBar());
        //map.addControl(new OpenLayers.Control.MousePosition());
    }

  4. #4
    Membre expérimenté
    Homme Profil pro
    Inscrit en
    Septembre 2009
    Messages
    875
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Septembre 2009
    Messages : 875
    Points : 1 313
    Points
    1 313
    Par défaut
    je t'avoue que je n'ai pas trop d'idées. Pour moi il y'a peu de chance qu' openlayers possède sa session si c'est juste du js. peux tu essayer de faire un après ta session_start?

  5. #5
    Membre actif
    Profil pro
    Loisir
    Inscrit en
    Novembre 2011
    Messages
    159
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Loisir

    Informations forums :
    Inscription : Novembre 2011
    Messages : 159
    Points : 284
    Points
    284
    Par défaut
    voici ce que donne var_dump avec les doctype inclus :

    Code html : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    array(2) {
      ["login"]=>
      string(6) "xxxxxx"
      ["pass"]=>
      string(10) "wwwwwwwwww"
    }
    <!Doctype html>

    et xxxxxx et wwwwwwwwww sont bien le login et le mot de passe de l'utilisateur.

Discussions similaires

  1. Extjs ! (problème d'affichage de résultat du code Javascript
    Par nabil.brarou dans le forum Ext JS / Sencha
    Réponses: 3
    Dernier message: 30/07/2012, 21h05
  2. Récupérer le résultat des validators en javascript
    Par lutecefalco dans le forum ASP.NET
    Réponses: 1
    Dernier message: 20/07/2007, 12h16
  3. Réponses: 10
    Dernier message: 31/05/2007, 16h16
  4. Mettre le résultat d'un javascript dans une variable php??
    Par kahya dans le forum Général JavaScript
    Réponses: 19
    Dernier message: 19/05/2006, 09h43
  5. blocage de site web avec javascript
    Par aminotma dans le forum Général JavaScript
    Réponses: 7
    Dernier message: 23/09/2005, 14h15

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo