Bonjour
je developpe un diaporama
Mon souci c'est de changer de photos toutes les x secondes.
je voudrais le faire avec la variables $inc_time.
voici la page des miniatures :
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
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
<script> 
  document.cookie = "slidex = " + screen.width + "; SameSite=Strict";
  document.cookie = "slidey = " + screen.height + "; SameSite=Strict"; 
</script>
<!DOCTYPE html>
<html>
<head>
    <link href="../css/grid.css" rel="stylesheet" type="text/css" />
    <link href="../css/nbr-tof.css" rel="stylesheet" type="text/css" />
    <link href="../css/range.css" rel="stylesheet" type="text/css" />
    <link href="../css/custom.css" rel="stylesheet" type="text/css" />
    <link href="../css/text.css" rel="stylesheet" type="text/css" />
    <link href="../css/area.css" rel="stylesheet" type="text/css" />
    <link href="../css/custom_nbr.css" rel="stylesheet" type="text/css" />
    <script src="../css/custom_nbr.js"></script>
</head> 
 
<body bgcolor= "#FFF">
    <div class="block">
        <div style "border 1px solid #CA0000" class="wrapper">
        <div style="width:250px; border: 1px solid #000000" class="one">
        <form method="GET" action="index.php">
<?php
 
session_start();
 
$pdo = new PDO('mysql:host=IP;dbname=TABLE', 'ID', '*****');
 
    if (isset($_GET['dos'])) {
        $dos = $_GET['dos'];
    } else { 
        $dos = "Dossier_1";
    }
 
  
    $sql_count = 'SELECT COUNT(name_tof) AS new_tof FROM demo WHERE dos_tof = :dos_tof';
    $count_less = $pdo->prepare($sql_count); 
    $count_less->execute(array('dos_tof' => $dos)); 
    $count_tof = $count_less->fetch();
    $nbr_tof = $count_tof['new_tof'];
   
    if ($nbr_tof<=50) {
   
        $lot1 = 1;
        $lot3 = $nbr_tof;
        
    } else { 
                
                $lot1 = 1; 
        $lot3 = 50;
        
        }
 
    $sql_done = 'SELECT min(height), max(height), min(width), max(width), name_tof, dos_tof FROM demo WHERE dos_tof = :dos_tof';
    $sth_less = $pdo->prepare($sql_done); 
    $sth_less->execute(array('dos_tof' => $dos)); 
    $done_pics = $sth_less->fetch();
    $nbr_tof = $sth_less -> rowCount();
 
        $heightmin = $done_pics['min(height)'];
    $heightmax  = $done_pics['max(height)'];
    $widthmin = $done_pics['min(width)'];
    $widthmax = $done_pics['max(width)'];
 
if (!isset($_GET['hmin']) && !isset($_GET['hmax']) && !isset($_GET['wmin']) && !isset($_GET['wmax'])) {
    
        $hmin_get = $heightmin;
        $hmax_get = $heightmax;
        $wmin_get = $widthmin;
        $wmax_get = $widthmax;
 
} else {
        
        $hmin_get = $_GET['hmin'];
        $hmax_get = $_GET['hmax'];
        $wmin_get = $_GET['wmin'];
        $wmax_get = $_GET['wmax'];
 
}
         if (!isset($_GET['incr']) || $_GET['incr']="") {
            $inc_time = 4;
         } else { $inc_time = $_GET['incr'];
         }
?>
<ul   id="menu-accordeon">
    <li style="width: 250px"><a href="#">Categories</a>
        <ul style="width: 250px; z-index: 1000;">
<?php
$dir = 'tofs/';
$fil_dir = scandir($dir);
$nbr_dir = count($fil_dir);
$nbr_dir = $nbr_dir-1;
 
===============================>
 
         if (!isset($_GET['incr']) || $_GET['incr']="") {
            $inc_time = 4;
         } else { $inc_time = $_GET['incr'];
         }
 
 for ($t=2; $t<=$nbr_dir; $t++) {
 
        $str = $fil_dir[$t];
        $order = '_';
        $replace = ' ';
 
        $fil_com[$t] = str_replace($order, $replace, $str);
         
                    echo '<li><a href="index.php?dos='.$fil_dir[$t].'&hmax='.$hmax_get.'&hmin='.$hmin_get.'&wmin='.$wmin_get.'&wmax='.$wmax_get.'$incr='.$inc_time.'&pics=De_'.$lot1.'_à_'.$lot3.'">'.$fil_com[$t].'</a></li>';
                                         
        }
                        
            echo '<input id="dos" name="dos" type="hidden" value="'.$dos.'">';
                   
?>	 
	 </ul>
   </li>
</ul>
 
================================>
 
<?php   
    $dir_pics  = $dos;
    $less = "_";
    $dir_done   = " ";
    $dos_one = str_replace($less, $dir_done, $dos);
   
        echo '<span class="gris6">dossier : </span><span class="vio">'.$dos_one.'<br></span>'
  if (!isset($_GET['incr']) || $_GET['incr']="") {
            $inc_time = 4;
         } else { $inc_time = $_GET['incr'];
         }
?>    
<span class="gris6">durée du diaporama : <br><span style="height: 30px; width: 57px;" class="custom-input-number">
    <input name="incr" id="incr" style="font-size: 17px" type="number" min="4" max="100" value="<?=$inc_time?>">
        <span class="input-number-control">
        <span style="color: #000" data-action="inc"></span>
        <span  style="color: #000" data-action="dec"></span>
        </span> 
    </span>
</span>
 
<?php
 
    if (isset($_GET['reset'])) {
   
        $heightmin = $done_pics['min(height)'];
        $heightmax  = $done_pics['max(height)'];
        $widthmin = $done_pics['min(width)'];
        $widthmax = $done_pics['max(width)'];    
        
        }
        
        $mult = ceil($nbr_tof/50)-1;
 
?>
 
</div>
	<div   class="boxcenter two"> 
 
    	<span class="gris9">hauteur comprise entre
        <input type="range" class="custom-slider custom-slider-bullet" name="hmin" id="hmin"
	    value="<?php  if (isset($_GET['reset'])) { echo $heightmin; } else { echo $hmin_get; }; ?>"
	    min="<?php echo $heightmin ?>"
	    max="<?php echo $heightmax ?>" 
	    oninput="this.nextElementSibling.textContent = this.value"/>
        <output><?php echo  $hmin_get ?>
		</output><br>
 
        et<br>
 
	    <input type="range"  class="custom-slider custom-slider-bullet" name="hmax" id="hmax" 
	    value="<?php  if (isset($_GET['reset'])) { echo $heightmax; } else { echo $hmax_get; }; ?>"
	    min="<?php echo $heightmin; ?>"
	    max="<?php echo $heightmax; ?>" 
	    oninput="this.nextElementSibling.textContent = this.value"/>
        <output><?php echo $hmax_get  ?>
	    </output>
        </span>
    </div>
    <div	class="boxcenter three"> 
 
	    <span class="gris9">largeur comprise entre
        <input type="range"  class="custom-slider custom-slider-bullet" name="wmin"id="wmin" 
	    value="<?php  if (isset($_GET['reset'])) { echo $widthmin; } else { echo $wmin_get; }; ?>"
	    min="<?php echo $widthmin  ?>"
	    max="<?php echo $widthmax ?>"
	    oninput="this.nextElementSibling.textContent = this.value"/>
        <output><?php echo $wmin_get ?>
	    </output><br>
 
	    et<br>
 
	    <input type="range"  class="custom-slider custom-slider-bullet" name="wmax"id="wmax" 
	    value="<?php  if (isset($_GET['reset'])) { echo $widthmax; } else { echo $wmax_get; }; ?>"
    	min="<?php echo $widthmin  ?>"
	    max="<?php echo $widthmax ?>"
    	oninput="this.nextElementSibling.textContent = this.value"/>
        <output><?php echo $wmax_get ?>
	    </output>  </span>
<?php
    $sql_calc = 'SELECT height, width, name_tof, dos_tof FROM demo WHERE dos_tof = :dos_tof AND height <= :hmax_get AND height >= :hmin_get AND width >= :wmin_get AND width <= :wmax_get';
    $sth_calc = $pdo->prepare($sql_calc); 
    $sth_calc->execute(array('dos_tof' => $dos,
                             'hmax_get' => $hmax_get,
                                                     'hmin_get' =>$hmin_get,
                                                      'wmax_get' => $wmax_get,
                                                      'wmin_get' => $wmin_get
                                            )); 
        $done_calc = $sth_calc->fetchAll();
        $nbr_tof = $sth_calc -> rowCount();
 
?>
 
        </div>
        <div style="width: 200px" class="boxthree four">
     <input style="width: 90px; height: 30px; font-size: 15px;" type="submit" name="val" value="Valider" />
             	<?php 
           $mult = ceil($nbr_tof/50)-1;
           if ($mult == 0) { ?>
		   <input type="hidden" name="pics" value="De_1_à_<?=$nbr_tof?>">
	   <?php
           } if ($mult >= 1) { ?>
		   <input type="hidden" name="pics" value="De_<?=$lot1?>_à_<?=$lot3?>">
	   <?php
           }
           ?> 
	 	<input style="width: 90px; height: 30px; font-size: 15px;" type="submit" name="reset" value="reset" />
 
<?php
 
    echo "<br><span class='gris9'>".$nbr_tof." photos dans la base</span>";
   $mult = ceil($nbr_tof/50)-1;                 
 
if ($mult == 0) { 
                $lot1= 1; 
                $lot3 = $nbr_tof;
}
 
 
 
?> <ul   id="menu-accordeon">
     <li style="width: 200px;"><span class="vio"><a href="#">De_<?php echo $lot1; ?>_à_<?php echo $lot3; ?></a></span>
  <ul style="width: 200px; z-index: 1000;">
<?php
if ($mult==1) {
    $lot1=1;
    $lot3=50;
        echo '<li><a href="index.php?dos='.$dos.'&hmax='.$hmax_get.'&hmin='.$hmin_get.'&wmin='.$wmin_get.'&wmax='.$wmax_get.'&incr='.$inc_time.'&pics=De_'.$lot1.'_à_'.$lot3.'">De_'.$lot1.'_à_'.$lot3.'</a></li>';
    $lot1 = 51;
    $lot3 = $nbr_tof;
        echo '<li><a href="index.php?dos='.$dos.'&hmax='.$hmax_get.'&hmin='.$hmin_get.'&wmin='.$wmin_get.'&wmax='.$wmax_get.'&incr='.$inc_time.'&pics=De_'.$lot1.'_à_'.$lot3.'">De_'.$lot1.'_à_'.$lot3.'</a></li>';
        
}
 
 
 
$t="";
if ($mult>1) {
                for ($t=1; $t<=$mult; $t++) {
            $lot3 = $t*50;
            $lot1 = $lot3-49;
         
            echo '<li><a href="index.php?dos='.$dos.'&hmax='.$hmax_get.'&hmin='.$hmin_get.'&wmin='.$wmin_get.'&wmax='.$wmax_get.'&incr='.$inc_time.'&pics=De_'.$lot1.'_à_'.$lot3.'">De_'.$lot1.'_à_'.$lot3.'</a></li>';
 
        }
      
        $lot1 = $lot3+1;
    $lot3 = $nbr_tof;
            
        echo '<li><a href="index.php?dos='.$dos.'&hmax='.$hmax_get.'&hmin='.$hmin_get.'&wmin='.$wmin_get.'&wmax='.$wmax_get.'&incr='.$inc_time.'&pics=De_'.$lot1.'_à_'.$lot3.'">De_'.$lot1.'_à_'.$lot3.'</a></li>';
 
}
 
?>
 
  </ul>
	 </li>
        </ul>
 
</div>
 
<div class="five">
 <?php
$l = 1;
$m = 1;
 
global $data;
 
if ($nbr_tof <= 50) {
  
    $lot1 = 1;
    $lot3 = $nbr_tof;
  
} else {  
 
    $values = explode("_", $_GET['pics']);
        $lot1 = $values[1];
        $lot3 = $values[3];
 
}
 
$l = 1;
 
foreach ($done_calc as $done_file) {
 
    $data[$l]['dim']      = array($done_file['height'],  $done_file['width']);
    $data[$l]['dos']      = $dos;
        $data[$l]['incr']     = $inc_time;
        $data[$l]['name_tof'] = $done_file['name_tof'];
    $data[$l]['lot']      = array($lot1, $lot3);
    $data[$l]['nbr_tof']  = $nbr_tof;
    $data[$l]['selecta']  = $l;
 
        $l++;
 
}       
 
$_SESSION['data'] = $data;
        
for($m=$lot1; $m<=$lot3; $m++) {
 
    $name_time = $_SESSION['data'][$m]['name_tof']; 
 
    echo '<span class="ombre"><a href="transmit.php?dos='.$dos.'&hmax='.$hmax_get.'&hmin='.$hmin_get.'&wmin='.$wmin_get.'&wmax='.$wmax_get.'&selecta='.$m.'&pics=De_'.$lot1.'_à_'.$lot3.'&incr='.$inc_time.'&zoom=off#tof"><img src="min/'.$dos.'/'.$name_time.'"/></a></span>';
 
}
 
?>
 
    </div>
   </form>
  </div>
 </body>
</html>
la partie qui nous intéresse :
Code php : 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
 
===============================>
 
	 if (!isset($_GET['incr']) || $_GET['incr']="") {
            $inc_time = 4;
	 } else { $inc_time = $_GET['incr'];
	 }
 
 for ($t=2; $t<=$nbr_dir; $t++) {
 
        $str = $fil_dir[$t];
        $order = '_';
        $replace = ' ';
 
        $fil_com[$t] = str_replace($order, $replace, $str);
 
		    echo '<li><a href="index.php?dos='.$fil_dir[$t].'&hmax='.$hmax_get.'&hmin='.$hmin_get.'&wmin='.$wmin_get.'&wmax='.$wmax_get.'$incr='.$inc_time.'&pics=De_'.$lot1.'_à_'.$lot3.'">'.$fil_com[$t].'</a></li>';
 
	}
 
            echo '<input id="dos" name="dos" type="hidden" value="'.$dos.'">';
 
?>	 
	 </ul>
   </li>
</ul>
 
================================>
la page photo une par une :
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
<!DOCTYPE html>
<html>
 <head>
   <link href="../css/grid-rama.css" rel="stylesheet" type="text/css" />
   <link href="../css/text.css" rel="stylesheet" type="text/css" />
   <link href="../css/custom_nbr.css" rel="stylesheet" type="text/css" />
   <script src="../css/custom_nbr.js"></script>
 </head>
<body bgcolor= "#FFF">
<?php
 session_start();
 
$dos = $_GET['dos'];
 
$inc_time =  $_GET['incr'];     
 
?> 
 
<div id='tof' class="boxcenter second"><span class="gris6">durée du diaporama : <span class="vio"><?=$inc_time?>s</span>
</div>
<?php
 
$height_tof = $_COOKIE['slidey']-175;
 
$zoom = $_GET['zoom'];
 
$hmin = $_GET['hmin'];
$hmax = $_GET['hmax'];
$wmin = $_GET['wmin'];
$wmax = $_GET['wmax'];
 
$lot1 =  $_SESSION['data'][1]['lot'][0];
$lot3 =  $_SESSION['data'][1]['lot'][1];
 
for ($i = 1; $i <= $lot3; $i ++) {
    $selecta[$i] =  $_SESSION['data'][$i]['selecta'];
    $name_tof[$i] = $_SESSION['data'][$i]['name_tof'];
    $up_height[$i] = $_SESSION['data'][$i]['dim'][0];
    $up_width[$i] = $_SESSION['data'][$i]['dim'][1];
    $min_width[$i] = round(($height_tof*$up_width[$i])/$up_height[$i]);
}
$min_height = $height_tof;
 
$url_base = "&hmin=$hmin&hmax=$hmax&wmin=$wmin&wmax=$wmax";
 
?>
 
<div class="wrapper">
    <div class="one txt-right" >
	    <a href="index.php?dos=<?=$dos.$url_base?>&incr=<?=$inc_time?>&pics=De_<?=$lot1?>_à_<?=$lot3?>&incr=<?=$inc_time?>">«« Retour</a>
    </div>
 
<?php
 
$i = $_GET['selecta'];
if ($zoom == "off") {
 
?>
	<div class="two">
        <a href="transmit.php?dos=<?=$dos.$url_base?>&selecta=<?=$selecta[$i]?>&heightz=<?=$height_tof?>&widthz=<?=$min_width[$i]?>&incr=<?=$inc_time?>&zoom=on#tof">
		<img  src="tofs/<?=$dos?>/<?=$name_tof[$i]?>" height="<?=$height_tof?>" width="<?=$min_width[$i]?>"/></a>
 
<?php
 
} else if ($zoom == "on") {
 
?>
	<div class="two">
        <a href="transmit.php?dos=<?=$dos.$url_base?>&selecta=<?=$selecta[$i]?>&heightz=<?=$up_height[$i]?>&widthz=<?=$up_width[$i]?>&incr=<?=$inc_time?>&zoom=off#tof">
		<img id='tof' src="tofs/<?=$dos?>/<?=$name_tof[$i]?>" height="<?=$up_height[$i]?>" width="<?=$up_width[$i]?>"/></a>
 
<?php 
 
}
 
?>
	</div>
 
<?php 
 
if ($zoom == "off") { ?>
	<div class="three">
	 <a href="transmit.php?dos=<?=$dos.$url_base?>&selecta=<?=$selecta[$i]?>&heightz=<?=$height_tof?>&widthz=<?=$min_width[$i]?>&incr=<?=$inc_time?>&zoom=on#tof">Zoom +</a>
 
		<?php
 
} else if ($zoom == "on") {
        
?>
 
	<div class="three">
         <a href="transmit.php?dos=<?=$dos.$url_base?>&selecta=<?=$selecta[$i]?>&heightz=<?=$up_height[$i]?>&widthz=<?=$up_width[$i]?>&incr=<?=$inc_time?>&zoom=off#tof">Zoom -</a>
 
<?php 
 
}
 
?>
 
    </div>
 
<div class="four txt-right">
 
<?php
 
if ($selecta[$i] <= $lot1) {
 
?>
    <a href="index.php?dos=<?=$dos.$url_base?>&pics=De_<?=$lot1?>_à_<?=$lot3?>&incr=<?=$inc_time?>">«« Back</a>
 
<?php
} else {
 
?>
    <a href="transmit.php?dos=<?=$dos.$url_base?>&selecta=<?=$selecta[$i]-1?>&incr=<?=$inc_time?>&zoom=off#tof">«« Back</a>
<?php 
 
} 
 
?>
 
    </div>
 	<div class="five">
 
<?php 
 
if ($selecta[$i] >= $lot3) {
 
?>
 
    <a href="index.php?dos=<?=$dos.$url_base?>&pics=De_<?=$lot1?>_à_<?=$lot3?>&incr=<?=$inc_time?>">Next »»</a>
 
<?php
 
} else { 
 
?>
    <a href="transmit.php?dos=<?=$dos.$url_base?>&selecta=<?=$selecta[$i]+1?>&incr=<?=$inc_time?>&zoom=off#tof">Next »»</a>
 
<?php 
 
} 
                        
$name_tof_time =  $_SESSION['data'][$i]['name_tof'];
 
echo $name_tof_time.' '.$i.' '.$inc_time;
 
?>
 
</div>
 
<?php
 
include ("diapo.js");
 
?> 
   </div>
</body>
</html>
la page javascript
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
<script>
let i=1;
var lot1_js = <?php echo json_encode($lot1); ?>
var lot3_js = <?php echo json_encode($lot3); ?>
var inc_time_js = <?php echo json_encode($inc_time[$i]); ?>;
var dos_js = <?php echo json_encode($dos); ?>;
var selecta =  <?php echo json_encode($selecta[$i]); ?>; 
var zoom = "off";
var hmin_js = <?php echo json_encode($hmin); ?>;
var hmax_js = <?php echo json_encode($hmax); ?>;
var wmin_js = <?php echo json_encode($wmin); ?>;
var wmax_js = <?php echo json_encode($wmax); ?>;
var up_height_js = <?php echo json_encode($up_height[$i]); ?>; 
var up_width_js = <?php echo json_encode($up_width[$i]); ?>
var min_height_js = <?php echo json_encode($min_height); ?>
var $min_width_js = <?php echo json_encode($min_width[$i]); ?>
 
const param = "dos=" + dos_js + "&hmin=" + hmin_js + "&hmax=" + hmax_js + "&wmin=" + wmin_js + "&wmax=" + wmax_js + "&selecta=" + i_js + "&incr=" + inc_time_js + "&zoom=off";
 
setTimeout(() => window.location = "transmit.php?" + param, inc_time_js*1000);           
i++;
 
 
</script>
le site -> oOo
alors comment faire pour afficher et garder la valeur $inc_time dans le chanps number ??