Bonjour,

Je me trouve devant un problème que je n'arrive pas résoudre. D'ailleurs le script fonctionnait auparavant donc je ne sais pas trop quoi penser.
Voici le script :

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
<html>
    <head>
        <meta charset="utf-8" />
        <meta name="format-detection" content="telephone=no" />
        <meta name="msapplication-tap-highlight" content="no" />
        <!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
        <title>AÏGO</title>
		<!--<link href="C:/APPLICATION/www/img" /> -->
		<link rel="stylesheet" type="text/css" href="css/index.css" />
		<link rel="stylesheet" href="css/leaflet.css" />
		<script src="js/leaflet.js"></script>
		<script type="text/javascript" src="cordova.js"></script>
		<script type="text/javascript" src="js/capture.js"></script>
		<link rel="stylesheet" href="jquery/jquery.mobile-1.4.5.min.css">
		<script src="jquery/jquery-1.11.3.min.js"></script>
		<script src="jquery/jquery.mobile-1.4.5.min.js"></script>
		<script type="text/javascript" src="js/date_heure.js"></script>
 
</head>
    <body>
<center>
 
 
 
	<div data-role="page" id="identification">
		<div data-theme="b" data-role="header">
			 <h1>Identification</h1>
        </div>
 
		<div data-role="content">
			<div>
						<br/> 
						<br/> 
						<br/>
						<br/>
				<label>Identifiant</label> 
 
			<input type="text" maxlength="14" style="font-size:11; border:solid 1px black;" id="identifiant" value="admin"/> 
						<br/> 
						<br/>
				<label>Mot de passe</label> 
 
			<input type="password"  style="font-size:10; border:solid 1px black;" id="motdepasse" value="2676"/> 
						<br/> 
						<br/> 
			<input type="button" value="Valider" onclick="verif();" class="bouton-valider;"/>
			</div>
						<br/> 
						<br/> 
			<div data-theme="b" data-role="footer">
				AÏGO
				<br/>
				Tous droits réservés au Contrat de Canal Crau-Sud Alpilles (CCCSA) et ses ASA
				<br/>
				2015 - version 1.0
			</div>
		</div>
	</div>
 
</center>
 
<script>
	document.addEventListener("deviceready", onDeviceReadyuser, false);
 
	function onDeviceReadyuser() {
		db = window.sqlitePlugin.openDatabase({name: "my.db"});	
		db.transaction(function(tx) {
			tx.executeSql('DROP TABLE user');
			tx.executeSql('CREATE TABLE IF NOT EXISTS user ( id_user TEXT, pass TEXT, nom TEXT, prenom TEXT, asa TEXT)'); //créer la table table_photo avec les champs et leur type
 
			tx.executeSql('INSERT INTO user (id_user, pass, nom, prenom, asa) VALUES ("...","...", "...", "...", "...")');			
			tx.executeSql('INSERT INTO user (id_user, pass, nom, prenom, asa) VALUES ("...","...", "...", "...", "...")');			
 
		});
	}   
 
	function verif() {
 
		db.transaction(function(tx) {
 
		nom_user=$("#identifiant").val();
			tx.executeSql('SELECT * FROM user WHERE id_user="'+nom_user+'"', [], function(tx, res){	
 
				if (res.rows.length == 0){
					alert('Votre identifiant est incorrect');
				}
 
				if (res.rows.length <= 1){
					compteur=res.rows.length-1;
					i=0;
					while (i <= compteur){
						if (res.rows.item(i).pass==$("#motdepasse").val()){						
							localStorage.user = res.rows.item(i).id_user;
							localStorage.asa = res.rows.item(i).asa;
							// Displaying the previous variable
							location.href="map.html";
 
						}else{
							alert('Votre mot de passe est incorrect');
						}
						i++;							
					}
				}
			});	
		});
	}
 
</script>
 
 
    </body>
</html>
Donc le soucis vient de la fonction "verif" qui se déclenche au clique du bouton pour vérifier si l'identifiant puis le mot de passe sont correctes et s'ils le sont ouvrir la page "map". Après des tests j'ai pu constater que la lecture est "stoppée" à "tx.executeSql('SELECT * FROM user WHERE id_user="'+nom_user+'"', [], function(tx, res){ " (ligne 83), du code JS issue de cordova.

Voici le script de la page "map" :
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
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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
<html>
    <head>
        <meta charset="utf-8" />
        <meta name="format-detection" content="telephone=no" />
        <meta name="msapplication-tap-highlight" content="no" />
        <!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
        <title>AÏGO</title>
		<!--<link href="C:/APPLICATION/www/img" /> -->
		<link rel="stylesheet" type="text/html" href="www/index.html" />
		<link rel="stylesheet" type="text/css" href="css/index.css" />
		<link rel="stylesheet" href="css/leaflet.css" />
		<script src="js/leaflet.js"></script>
		<script type="text/javascript" src="cordova.js"></script>
		<script type="text/javascript" src="js/capture.js"></script>
		<link rel="stylesheet" href="jquery/jquery.mobile-1.4.5.min.css">
		<script src="jquery/jquery-1.11.3.min.js"></script>
		<script src="jquery/jquery.mobile-1.4.5.min.js"></script>
		<script type="text/javascript" src="js/date_heure.js"></script>
 
</head>
 
 
 
<body>
 
	<div data-role="page" id="carte">
 
		<div data-role="content">
			<div id="map" ></div>
			<button onclick='centrageauto();'>Ma position</button>
			<a href="#infopoint" data-role="button" onclick='Picture();'>Photo</a>
			<button onclick='confirm_envoi_donnees();'>Envoi au SIG</button>
			<!--<button onclick='effacer_icones();'>Effacer icônes</button>-->
		</div>
 
		<div data-role="popup" id="popupParis" data-overlay-theme="a" data-theme="d" data-corners="false">
			<a href="#" data-rel="back" data-role="button" data-theme="a" data-icon="delete" data-iconpos="notext" class="ui-btn-right">Fermer</a><img class="popphoto" src='cheminphoto' style="max-height:512px;" alt="Paris, France">
		</div>
		<!--  -->
	</div>
 
 
 
<!-- Début de la seconde page -->
	<div data-role="page" id="infopoint">
 
		<div data-role="content">
 
			<center>
 
				<br>
					<!--<form name="formulaire" action="page.php" method="post" target="_blank">-->
				<label>Date et heure : </label>
					<span id="date_heure"></span>
						<script id="date_heure" type="text/javascript">window.onload = date_heure('date_heure');</script>
				<br/>
				<br/>
 
				<label>Intérêt : </label>
					<select id="interet">
						<option>Fuite</option>
						<option>Bouche</option>
						<option>Vegetation</option>
						<option>Degradation</option>
					</select> 
				<br/>
				<br/>
 
				<label>Commentaire : </label>
					<!--<input type="text" rows="4" cols="25" id="commentaire"/>-->
					<textarea id="commentaire"></textarea>
 
				<br/>
				<br/>
 
				<a href="#carte" class="ui-btn" onclick='onDeviceReadytb();'>Valider</a>	
 
					<!--</form>-->
			</center>
 
		</div><!-- /content -->
 
 
	</div><!-- /page -->
 
	<script>
		$( document ).on( "pageinit", function() {
			$( ".photopopup" ).on({
				popupbeforeposition: function() {
					var maxHeight = $( window ).height() - 60 + "px";
					$( ".photopopup img" ).css( "max-height", maxHeight );
				}
			});
		});
	</script>	
 
	<script>
		/*------------------------------Initialisation de la carte------------------------------*/
		document.addEventListener("deviceready", onDeviceReady, false);
 
		function onDeviceReady() {
 
			alert("Bienvenue à toi "+localStorage.prenom+" "+localStorage.nom);
			prenom=localStorage.prenom;
			nom=localStorage.nom;
			id_user=localStorage.user;
			asa=localStorage.asa;
 
			// ouverture de la base 
			db = window.sqlitePlugin.openDatabase({name: "my.db"});	
 
			//chargment de la carte
			$('#map').load('pagecreate',function() {			
 
				//création de la variable carte : 'map'
				map = L.map('map').setView([10, 4.6495853], 18); 
 
				//création de la couche de fond Open Street Map (OSM) avec options d'affichage à l'ouverture
				L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
					maxZoom: 26,
					minZoom: 2,
					attribution: 'Map data © ; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>' +
						'<a href="http://creativecommons.org/licenses/by-sa/2.0/"></a>',
					id: 'examples.map-i875mjb7'	
				}).addTo(map);
 
				setTimeout(function(){
					map.invalidateSize();
				}, 1);	
 
				/*création de la couche photo*/	
				points_photos = new  L.layerGroup();			
				points_photos.addTo(map);
 
				iconephoto = L.icon({iconUrl: 'img/iconephoto.png'}); //icone photo 
 
				//ajout des markers photos (un marqueur par photo tous contenus dans la couche points_photos)	
				db.transaction(function(tx) {
 
					//creation de la table
					tx.executeSql("DROP TABLE IF EXISTS table_photo");
					tx.executeSql("CREATE TABLE IF NOT EXISTS table_photo (id_photo TEXT, date_heure TEXT, asa TEXT, id_user TEXT, interet TEXT, coor_x REAL, coor_y REAL, commentaire TEXT, photo TEXT, envoi TEXT)"); //créer la table table_photo avec les champs et leur type
 
					//chargement des marqueurs
					tx.executeSql("SELECT * FROM table_photo", [], function(tx, res) {
						var i = 0;
						while (i <= res.rows.length-1 && res.rows.length!=0){						
							L.marker([res.rows.item(i).coor_x , res.rows.item(i).coor_y], {icon : iconephoto}).addTo(points_photos)
																		  .bindPopup('<img src="'+res.rows.item(i).photo+'" alt="image" style = "max-width : 50%; max-height=50;">');																				
																		//'<a href="#popupParis" data-rel="popup" data-position-to="window" data-transition="fade"><img class="popphoto" src="'+cheminphoto+'" alt="Paris, France" style="width:50%"></a>'
																		//
							i=i+1;
						}
					});
				});
 
 
		/*------------------------------exécution du GPS du mobile------------------------------*/
 
				//la variable 'centrageautoactive' a pour valeure 'true'
				centrageautoactive = true;
 
				//activation du GPS
				navigator.geolocation.watchPosition(onSuccess,error,{ maximumAge: 0, timeout: 10000, enableHighAccuracy: true });
 
				//pour 'centrageautoactive' égale 'true' la fonction détermine les coordonnées x et y et exécute centrageauto
				function onSuccess(position) {
					x = position.coords.latitude;
					y = position.coords.longitude;
					if (centrageautoactive==true){	
						centrageauto();
					}
				}
 
				//applique la valeure 'false' à la variable 'centrageautoactive' au déplacement de la map
				map.on('dragstart', function() {
					centrageautoactive = false;
				});
 
				//réapplique la valeure 'true' à la variable 'centrageautoactive' et réexécute la fonction 'centrageauto'
				function reactivecentrageauto () {
					centrageautoactive = true;
					centrageauto();
				}
 
				//lancement d'une alerte en cas d'erreur
				function error(erreur) {
				var info = "Erreur lors de la géolocalisation : ";
					switch (erreur.code) {
						case error.PERMISSION_DENIED:
							alert ('Vous n’avez pas donné la permission');
					break;
						case erreur.TIMEOUT :
							alert ('Délais de recherche dépassé, vérifier si le GPS fonctionne');	
					break;
						case error.POSITION_UNAVAILABLE:
							alert ('La position n’a pu être déterminée');
					break;
						case error.UNKNOW_ERROR:
							alert ('Erreur inconnue');
					break;
					}
				}
 
 
		/*------------------------------gestion de l'icone et 'centrageauto' permet de centrer la carte sur la position------------------------------*/	
 
				//mise en forme du marker
				var monIcone = L.icon({iconUrl: 'img/monIcone.png'});		
				marker = L.marker([0 , 0], {icon : monIcone}).addTo(map);
 
			});
		}
 
		function centrageauto() {
 
			map.setView([x,y], 18);
			//map.setZoom(18,{animate:true});
			marker.setLatLng([x,y]);
		}
 
		/*------------------------------gestion de l'icone------------------------------	
 
		//pour effacer les markers sur la carte
		function effacer_icones(){
			//alert('efface');
			var confirm_effacer_icones=confirm ('Effacer les icônes ?');
				if (confirm_effacer_icones){
					points_photos.addTo(map);
				} else {
					alert('Non');
				}
		}*/
 
 
		/*------------------------------utilisation de l'appareil photo du mobile------------------------------*/
 
		//lancement de l'appareil photo avec options et succès ou non
		function   Picture (){																	  
			navigator.camera.getPicture(succesphoto, onFail, {quality: 100, destinationType: Camera.DestinationType.FILE_URI, targetWidth: 800, targetHeight: 800, mediaType: Camera.MediaType.ALLMEDIA,correctOrientation: true});
		}
 
		//succès de la prise de photo
		function succesphoto(imageURI) {
			cheminphoto=imageURI;
			tempx=x;
			tempy=y;
				$( "#popupPhoto" )
					.find( "img" )
					.attr( "src", imageURI );
			//document.getElementById("chemindelaphoto").innerHTML =  cheminphoto ;
		}
 
		//erreur en cas de non prise de photo
		function onFail(message) {
			alert('Echec: ' + message);
		}
 
		/*------------------------------enregistrement du point et de ses données sur la base de données mobile sqlite------------------------------*/
 
 
		function onDeviceReadytb() {
 
			db.transaction(function(tx) {
 
				//creer id photo
				var d = new Date();
				var d_photo = d.getTime()+""; //date et heure de la prise de vue temps en seconde depuis 1970
				var id_photo=d_photo+id_user; //creation de l id photo
 
				//insertion dans la table de la photo
				tx.executeSql('INSERT INTO table_photo (id_user, asa,id_photo,date_heure,interet, commentaire, photo, coor_x, coor_y, envoi) VALUES ("'+id_user+'","'+asa+'","'+id_photo+'","'+d_photo+'","'+$('#interet').val()+'","'+$('#commentaire').val()+'","'+cheminphoto+'","'+tempx+'","'+tempy+'","non")');
				//Creation du nouveau marqueur
				L.marker([tempx,tempy], {icon : iconephoto}).addTo(points_photos)
																		  .bindPopup('<img src="'+cheminphoto+'" alt="image" style = "max-width : 50; max-height=50;">');
																		  //'<a href="#popupParis" data-rel="popup" data-position-to="window" data-transition="fade"><img class="popphoto" src="'+cheminphoto+'" alt="Paris, France" style="width:50%"></a>'
																		  //
			});
		}
		/*------------------------------Enregistrement des photos dans la base de données sur serveur dédié------------------------------*/
 
		function confirm_envoi_donnees(){
			var confirm_envoi_donnees=confirm ('Envoyer au SIG ?');
				if (confirm_envoi_donnees){
					envoi_donnees();
				} else {
					alert('Les points ne sont pas envoyés');
				}
		}
		function envoi_donnees(){
 
			//on liste les photos pas encore envoyées
			db.transaction(function(tx) {
				tx.executeSql('SELECT * FROM table_photo WHERE envoi="non"', [], function(tx, res) {
					if (res.rows.length!=0) {
						i = 0;
						nombre_envoi = res.rows.length-1;
 
						while (i <= res.rows.length-1){
 
							json_envoi="["+JSON.stringify(res.rows.item(i))+"]";	
							//alert(json_envoi);							
 
							var lien_photo = res.rows.item(i).photo;
							var nom_photo = res.rows.item(i).id_photo;
							if(i != res.rows.length-1){
								envoi_photo(lien_photo,nom_photo,json_envoi,i); //appel de la fonction envoi_photo
							}else{
								envoi_derniere_photo(lien_photo,nom_photo,json_envoi,i);
							}
							/*$.ajax({ //on crée une communication avec le serveur via protocole ajax
								url : '......', //fichier du serveur vers lequel on va envoyer nos données
								type : 'GET', 		// protocole d'envoi
								data: {data:json_envoi}, // données que l'on envoi
								dataType: 'jsonp', // type de données qui javascript doit recevoir de php
								success: function(res){	//fonction executée en cas de succes, doit recevoir du jsonp
									if (res.envoi="envoi réussi"){
										db.transaction(function(tx) {
											tx.executeSql('UPDATE table_photo SET envoi = "oui" WHERE envoi ="non"', [], function() {
												alert(res.envoi);
											});
										});
									}else{
										alert(res.envoi);
									}
								}
 
							});*/
							i=i+1;
						}
 
					} else{
						alert('Photos déjà envoyées');
					}
				});		
			});
 
			// fonction envoi_photo, envoi les photos (jusqu'à la l'avant dernnière comprise), écrit à partir de cordova plugin FileTransfer
			function envoi_photo(adresse_photo,nom_photo,json_envoi,compteur){
 
 
 
				var options = new FileUploadOptions();
				options.fileKey="file";
				options.fileName=nom_photo;
				options.mimeType="image/jpeg";
				var params = {};
				params.json = json_envoi;
 
				options.params = params;
 
				var ft = new FileTransfer();
				ft.upload(adresse_photo, encodeURI('......'),win, fail, options);
 
				function win(r) {
					db.transaction(function(tx) {
						tx.executeSql('UPDATE table_photo SET envoi = "oui" WHERE envoi ="non" AND id_photo="'+r.response+'"', [], function() {
 
						});
					});
					//alert('update');
				}
 
				function fail(error) {
					alert("An error has occurred: Code = " + error.code);
				}
 
			}
			// envoi cette fois seulement la dernière
			function envoi_derniere_photo(adresse_photo,nom_photo,json_envoi,compteur){
				var options = new FileUploadOptions();
				options.fileKey="file";
				options.fileName=nom_photo;
				options.mimeType="image/jpeg";
				var params = {};
				params.json = json_envoi;
 
				options.params = params;
 
				var ft = new FileTransfer();
				ft.upload(adresse_photo, encodeURI('......'),win, fail, options);
 
				function win(r) {
					db.transaction(function(tx) {
						tx.executeSql('UPDATE table_photo SET envoi = "oui" WHERE envoi ="non" AND id_photo="'+r.response+'"', [], function() {
						});
					});
					$.ajax({ //on crée une communication avec le serveur via protocole ajax
						url : '......', //fichier du serveur vers lequel on va envoyer nos données
						type : 'GET', 		// protocole d'envoi
					});
					alert('Envoi réussi');
				}
 
				function fail(error) {
					alert("An error has occurred: Code = " + error.code);
				}
 
			}
		}
 
	</script>
 
 
</body>
</html>
Y a t il quelqu'un qui, d'après mes script, serait me mettre sur la voie d'une solution ?