Subversion Repositories ALCASAR

Rev

Rev 2011 | Rev 2170 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2011 Rev 2142
1
<!DOCTYPE html>
1
<!DOCTYPE html>
2
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
2
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
3
<TITLE>ALCASAR Report</TITLE>
3
<TITLE>ALCASAR Report</TITLE>
4
<link rel="stylesheet" type="text/css" href="../../../css/bootstrap.min.css">
4
<link rel="stylesheet" type="text/css" href="../../../css/bootstrap.min.css">
5
<script src="../../../js/jquery.js"></script>
5
<script src="../../../js/jquery.js"></script>
6
<script src="../../../js/bootstrap.min.js"></script>
6
<script src="../../../js/bootstrap.min.js"></script>
7
<style>
7
<style>
8
body{
8
body{
9
	background-color: #EFEFEF;
9
	background-color: #EFEFEF;
10
}
10
}
11
</style>
11
</style>
12
</HEAD>
12
</HEAD>
13
<body>
13
<body>
14
 
14
 
15
<?php
15
<?php
16
 
16
 
17
#Cette page permet de générer les journaux d'imputabilité dans une archive avec mot de passe.
17
#Cette page permet de générer les journaux d'imputabilité dans une archive avec mot de passe.
18
#Lors de la création de cette archive, tous les utilisateurs d'alcasar seront prévenus lors de leur prochaine connexion par un message d'alerte.
18
#Lors de la création de cette archive, tous les utilisateurs d'alcasar seront prévenus lors de leur prochaine connexion par un message d'alerte.
19
#Cette page a été créé suite à la demande d'une préfecture de police afin de faciliter le déroulement des affaires judiciaires UNIQUEMENT.
19
#Cette page a été créé suite à la demande d'une préfecture de police afin de faciliter le déroulement des affaires judiciaires UNIQUEMENT.
20
 
20
 
21
 
21
 
22
# Choice of language
22
# Choice of language
23
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
23
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
24
{
24
{
25
	$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
25
	$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
26
	$Language = strtolower(substr(chop($Langue[0]),0,2));
26
	$Language = strtolower(substr(chop($Langue[0]),0,2));
27
}
27
}
28
if($Language == 'fr')
28
if($Language == 'fr')
29
{
29
{
30
	$l_info = "Génération des journaux d'imputabilité";
30
	$l_info = "Génération des journaux d'imputabilité";
31
	$l_log_info = "Vous allez générer des journaux qui avertiront tous les utilisateurs. En effet, cette pratique est réservée uniquement de le cadre d'une enquête judiciaire. Vous comprenez donc les risques en continuant ici.";
31
	$l_log_info = "Vous allez générer un document réservé aux autorités dans le cadre d'une enquête judiciaire. Tout les utilisateurs seront avertis de la génération de ce document.";
32
	$l_password = "Entrez votre mot de passe afin de protéger votre archive contenant le PDF des journaux d'imputabilité";
32
	$l_password = "Entrez votre mot de passe afin de protéger l'archive contenant le document généré";
33
	$l_submit = "Continuer";
33
	$l_submit = "Continuer";
34
	$l_date1="Commençant le ...";
34
	$l_date1="Commençant le ...";
35
	$l_date2="Terminant le ...";
35
	$l_date2="Terminant le ...";
36
	$l_hours="Jusqu\'au ...";
36
	$l_hours="à ...";
37
	$l_options_info = "Que désirez vous?";
37
	$l_options_info = "Que désirez vous?";
38
	$l_options_1="Tous les journaux";
38
	$l_options_1="Tous les journaux";
39
	$l_options_2="Selectionnez un intervale ...";
39
	$l_options_2="Selectionnez un intervale ...";
40
	$l_options_3="Selectionnez depuis une date ...";
40
	$l_options_3="Selectionnez depuis une date ...";
41
	$l_load="Chargement...";
41
	$l_load="Chargement...";
42
	$l_create="Les utilisateurs ont été prévenus de cette action et l'archive a bien été crée, retenez bien votre mot de passe car il sera impossible de vous le redonner";
42
	$l_create="Les utilisateurs ont été prévenus de cette action et l'archive a bien été crée, retenez bien votre mot de passe car il sera impossible de vous le redonner";
43
	$l_download="Télécharger l'archive";
43
	$l_download="Télécharger l'archive";
44
	$l_error="Vous devez remplir les informations du formulaire!";
44
	$l_error="Vous devez remplir les informations du formulaire!";
45
	$l_demandeur="Nom du demandeur :";
45
	$l_demandeur="Nom du demandeur :";
46
	$l_commentary="Raison :";
46
	$l_commentary="Raison :";
47
	$l_info_form="Information du demandeur :";
47
	$l_info_form="Information du demandeur :";
48
	$l_logtab="Dernières entrées :";
48
	$l_logtab="Dernières entrées :";
49
	$l_empty_log="Les journaux sont vides";
49
	$l_empty_log="Les journaux sont vides";
50
	
50
	
51
}
51
}
52
else
52
else
53
{
53
{
54
	$l_info = "Imputabilities logs generation";
54
	$l_info = "Imputabilities logs generation";
55
	$l_log_info = "You are generating logs which will warn users. In fact, this action is only reserved for a judicial investigation. So, you understand risks if you proceed.";
55
	$l_log_info = "You are in progress to generate a document reserved for a judicial investigation. All users will be warned.";
56
	$l_password = "Enter your password to protect your archive which contains the PDF of imputabilities logs.";
56
	$l_password = "Enter your password to protect the archive which contains the document.";
57
	$l_submit = "Proceed";
57
	$l_submit = "Proceed";
58
	$l_date1="Start at ...";
58
	$l_date1="Start at ...";
59
	$l_date2="End at ...";
59
	$l_date2="End at ...";
60
	$l_hours="At ...";
60
	$l_hours="at ...";
61
	$l_options_info = "What do you want?";
61
	$l_options_info = "What do you want?";
62
	$l_options_1="All logs";
62
	$l_options_1="All logs";
63
	$l_options_2="Select a range ...";
63
	$l_options_2="Select a range ...";
64
	$l_options_3="Select from a specific date ...";
64
	$l_options_3="Select from a specific date ...";
65
	$l_create="Users have been warned and your archive has been created! Don't forget your password!";
65
	$l_create="Users have been warned and your archive has been created! Don't forget your password!";
66
	$l_load="Loading...";
66
	$l_load="Loading...";
67
	$l_download="Download archive";
67
	$l_download="Download archive";
68
	$l_error="You need to submit form informations!!";
68
	$l_error="You need to submit form informations!!";
69
	$l_demandeur="Applicant name :";
69
	$l_demandeur="Applicant name :";
70
	$l_commentary="Reason :";
70
	$l_commentary="Reason :";
71
	$l_info_form="User Information";
71
	$l_info_form="User Information";
72
	$l_logtab="Last entries :";
72
	$l_logtab="Last entries :";
73
	$l_empty_log="Logs are empty";
73
	$l_empty_log="Logs are empty";
74
}
74
}
75
 
75
 
76
 
76
 
77
$filename='/var/www/html/acc/backup/log_info.txt';
77
$filename='/var/www/html/acc/backup/log_info.txt';
78
 
78
 
79
if(isset($_POST['submit']))
79
if(isset($_POST['submit']))
80
{
80
{
81
	$password=$_POST['password'];
81
	$password=$_POST['password'];
82
	$demandeur=$_POST['demandeur'];
82
	$demandeur=$_POST['demandeur'];
83
	$raison=$_POST['comment'];
83
	$raison=$_POST['comment'];
84
 
84
 
85
	#si le mot de passe est vide ou si il contient des espaces
85
	#si le mot de passe est vide ou si il contient des espaces
86
	if($password != "" && $demandeur != "" && $raison != "")
86
	if($password != "" && $demandeur != "" && $raison != "")
87
	{
87
	{
88
		#Génération de log
88
		#Génération de log
89
		$text=date("Y-m-d H:i:s")."|||".$demandeur."|||".$raison."|||".$_SERVER['REMOTE_ADDR']."|||";
89
		$text=date("Y-m-d H:i:s")."|||".$demandeur."|||".$raison."|||".$_SERVER['REMOTE_ADDR']."|||";
90
		#supprimer les nouvelles lignes
90
		#supprimer les nouvelles lignes
91
		$text = str_replace("\n", ' ', $text);
91
		$text = str_replace("\n", ' ', $text);
92
		$text = str_replace("\r", ' ', $text);
92
		$text = str_replace("\r", ' ', $text);
93
 
93
 
94
		
94
		
95
		file_put_contents($filename, $text.PHP_EOL, FILE_APPEND);
95
		file_put_contents($filename, $text.PHP_EOL, FILE_APPEND);
96
		
96
		
97
 
97
 
98
 
98
 
99
		#Création des journaux dans une archive avec mot de passe.
99
		#Création des journaux dans une archive avec mot de passe.
100
		$filename_logs="imputabilities_logs.zip";
100
		$filename_logs="imputabilities_logs.zip";
101
		switch($_POST['submit'])
101
		switch($_POST['submit'])
102
		{
102
		{
103
			case 'query_all':
103
			case 'query_all':
104
				exec("sudo alcasar-generate_log.sh '$password'");
104
				exec("sudo alcasar-generate_log.sh '$password'");
105
				break;
105
				break;
106
			case 'query_range':
106
			case 'query_range':
107
				$date1_selected= $_POST['start-year'].'-'.$_POST['start-month'].'-'.$_POST['start-day'].' '.$_POST['start-hour'].':'.$_POST['start-min'].':'.$_POST['start-sec'];
107
				$date1_selected= $_POST['start-year'].'-'.$_POST['start-month'].'-'.$_POST['start-day'].' '.$_POST['start-hour'].':'.$_POST['start-min'].':'.$_POST['start-sec'];
108
				$date2_selected= $_POST['stop-year'].'-'.$_POST['stop-month'].'-'.$_POST['stop-day'].' '.$_POST['stop-hour'].':'.$_POST['stop-min'].':'.$_POST['stop-sec'];
108
				$date2_selected= $_POST['stop-year'].'-'.$_POST['stop-month'].'-'.$_POST['stop-day'].' '.$_POST['stop-hour'].':'.$_POST['stop-min'].':'.$_POST['stop-sec'];
109
				exec("sudo alcasar-generate_log.sh '$password' '$date1_selected' '$date2_selected' ");
109
				exec("sudo alcasar-generate_log.sh '$password' '$date1_selected' '$date2_selected' ");
110
				break;
110
				break;
111
			case 'query_simple':
111
			case 'query_simple':
112
				$date1_selected= $_POST['start-year'].'-'.$_POST['start-month'].'-'.$_POST['start-day'].' '.$_POST['start-hour'].':'.$_POST['start-min'].':'.$_POST['start-sec'];
112
				$date1_selected= $_POST['start-year'].'-'.$_POST['start-month'].'-'.$_POST['start-day'].' '.$_POST['start-hour'].':'.$_POST['start-min'].':'.$_POST['start-sec'];
113
				exec("sudo alcasar-generate_log.sh '$password' '$date1_selected'");
113
				exec("sudo alcasar-generate_log.sh '$password' '$date1_selected'");
114
				break;
114
				break;
115
		
115
		
116
		}
116
		}
117
 
117
 
118
 
118
 
119
		#Interface permettant de télécharger les journaux d'imputabilité
119
		#Interface permettant de télécharger les journaux d'imputabilité
120
		echo "<h3>$l_create</h3>";
120
		echo "<h3>$l_create</h3>";
121
		echo "<a href=\"$filename_logs\" class=\"btn btn-info btn-lg\">";
121
		echo "<a href=\"$filename_logs\" class=\"btn btn-info btn-lg\">";
122
		echo "	<span class=\"glyphicon glyphicon-download-alt\"></span> $l_download";
122
		echo "	<span class=\"glyphicon glyphicon-download-alt\"></span> $l_download";
123
		echo "</a>";
123
		echo "</a>";
124
	}
124
	}
125
	else
125
	else
126
	{
126
	{
127
		echo "$l_error";	
127
		echo "$l_error";	
128
	}
128
	}
129
 
129
 
130
 
130
 
131
 
131
 
132
	
132
	
133
}
133
}
134
else
134
else
135
{
135
{
136
	#Interface permettant de configurer la génération des journaux d'imputabilité.
136
	#Interface permettant de configurer la génération des journaux d'imputabilité.
137
	echo "<div>";
137
	echo "<div>";
138
	echo "	<div style=\"margin-top:20px\">";
138
	echo "	<div style=\"margin-top:20px\">";
139
	echo "		<div>";
139
	echo "		<div>";
140
	
140
	
141
	echo "				<fieldset>";
141
	echo "				<fieldset>";
142
	echo "					<h3>$l_info</h3>";
142
	echo "					<h3>$l_info</h3>";
143
	echo "					<p>$l_log_info</p>";
143
	echo "					<p>$l_log_info</p>";
144
	echo "				</fieldset>";
144
	echo "				</fieldset>";
145
 
145
 
146
	echo "<h4> $l_options_info  </h4>";
146
	echo "<h4> $l_options_info  </h4>";
147
	echo "<div class=\"radio\">";
147
	echo "<div class=\"radio\">";
148
	echo "<label><input type=\"radio\" name=\"optradio\" onclick=\"radio_interact1()\" checked> $l_options_1 </label>";
148
	echo "<label><input type=\"radio\" name=\"optradio\" onclick=\"radio_interact1()\" checked> $l_options_1 </label>";
149
	echo "</div>";
149
	echo "</div>";
150
	echo "<div class=\"radio\">";
150
	echo "<div class=\"radio\">";
151
	echo "<label><input type=\"radio\" name=\"optradio\" onclick=\"radio_interact2()\"> $l_options_2 </label>";
151
	echo "<label><input type=\"radio\" name=\"optradio\" onclick=\"radio_interact2()\"> $l_options_2 </label>";
152
	echo "</div>";
152
	echo "</div>";
153
	echo "<div class=\"radio\">";
153
	echo "<div class=\"radio\">";
154
	echo "<label><input type=\"radio\" name=\"optradio\" onclick=\"radio_interact3()\"> $l_options_3 </label>";
154
	echo "<label><input type=\"radio\" name=\"optradio\" onclick=\"radio_interact3()\"> $l_options_3 </label>";
155
	echo "</div>";
155
	echo "</div>";
156
	echo "<form name=\"form_log\" method=\"post\" action=\"log_generation.php\" role=\"form\">";
156
	echo "<form name=\"form_log\" method=\"post\" action=\"log_generation.php\" role=\"form\">";
157
	echo "<p> $l_password </p><input name=\"password\" type=\"password\" size=\"25\">";
157
	echo "<p> $l_password </p><input name=\"password\" type=\"password\" size=\"25\">";
158
	echo "<h2>$l_info_form</h2>";
158
	echo "<h2>$l_info_form</h2>";
159
	echo "<p>$l_demandeur</p><textarea name='demandeur' style=\"height:25px;\"></textarea>";
159
	echo "<p>$l_demandeur</p><textarea name='demandeur' style=\"height:25px;\"></textarea>";
160
	echo "<p>$l_commentary</p><textarea name='comment'></textarea>";
160
	echo "<p>$l_commentary</p><textarea name='comment'></textarea>";
161
	echo "<p id=\"query_option\"></br></br><button type=\"submit\" onClick=\"this.classList.add('disabled');\" class=\"btn btn-primary\" name=\"submit\" value=\"query_all\"> $l_submit </button></p>";	
161
	echo "<p id=\"query_option\"></br></br><button type=\"submit\" onClick=\"this.classList.add('disabled');\" class=\"btn btn-primary\" name=\"submit\" value=\"query_all\"> $l_submit </button></p>";	
162
 
162
 
163
 
163
 
164
 
164
 
165
}
165
}
166
 
166
 
167
echo "<br><div style=\"height:1px;background:#717171;border-bottom:1px solid #313030:\"></div>";
167
echo "<br><div style=\"height:1px;background:#717171;border-bottom:1px solid #313030:\"></div>";
168
echo "<h2>$l_logtab</h2>";
168
echo "<h2>$l_logtab</h2>";
169
if(file_exists($filename)){
169
if(file_exists($filename)){
170
 
170
 
171
	echo "<div class=\"container\">";     
171
	echo "<div class=\"container\">";     
172
	echo "<table class=\"table table-striped\">";
172
	echo "<table class=\"table table-striped\">";
173
	echo "<thead>";
173
	echo "<thead>";
174
	echo "<tr>";
174
	echo "<tr>";
175
	echo "<th>Date</th>";
175
	echo "<th>Date</th>";
176
	echo "<th>User</th>";
176
	echo "<th>User</th>";
177
	echo "<th>Reason</th>";
177
	echo "<th>Reason</th>";
178
	echo "<th>IP address</th>";
178
	echo "<th>IP address</th>";
179
	echo "</tr>";
179
	echo "</tr>";
180
	echo "</thead>";
180
	echo "</thead>";
181
	echo "<tbody>";
181
	echo "<tbody>";
182
        $fichier = fopen($filename, "r");
182
        $fichier = fopen($filename, "r");
183
        $content = file($filename);
183
        $content = file($filename);
184
	        foreach($content as $line){
184
	        foreach($content as $line){
185
		$infos=explode("|||", $line);
185
		$infos=explode("|||", $line);
186
		echo "<tr>";
186
		echo "<tr>";
187
		echo "<td>$infos[0]</td>";	
187
		echo "<td>$infos[0]</td>";	
188
		echo "<td>$infos[1]</td>";	
188
		echo "<td>$infos[1]</td>";	
189
		echo "<td>$infos[2]</td>";	
189
		echo "<td>$infos[2]</td>";	
190
		echo "<td>$infos[3]</td>";	
190
		echo "<td>$infos[3]</td>";	
191
		echo "</tr>";
191
		echo "</tr>";
192
        }
192
        }
193
 
193
 
194
echo "</tbody>";
194
echo "</tbody>";
195
echo "</table>";
195
echo "</table>";
196
echo "</div>";
196
echo "</div>";
197
 
197
 
198
 
198
 
199
}
199
}
200
else
200
else
201
{
201
{
202
	echo "<p>$l_empty_log</p>";
202
	echo "<p>$l_empty_log</p>";
203
}
203
}
204
 
204
 
205
#javascript permettant de generer les dropdown des dates. Il faut s'assurer que les données envoyées soient au bon format afin d'etre traité dans alcasar-generation_logs.sh
205
#javascript permettant de generer les dropdown des dates. Il faut s'assurer que les données envoyées soient au bon format afin d'etre traité dans alcasar-generation_logs.sh
206
 
206
 
207
echo "<script>";
207
echo "<script>";
208
 
208
 
209
echo "function radio_interact1() {";
209
echo "function radio_interact1() {";
210
echo "document.getElementById(\"query_option\").innerHTML = '";
210
echo "document.getElementById(\"query_option\").innerHTML = '";
211
echo "</br></br><button type=\"submit\" class=\"btn btn-primary\" name=\"submit\" value=\"query_all\"> $l_submit</button>";
211
echo "</br></br><button type=\"submit\" class=\"btn btn-primary\" name=\"submit\" value=\"query_all\"> $l_submit</button>";
212
echo "';}";
212
echo "';}";
213
 
213
 
214
echo "function radio_interact2() {";
214
echo "function radio_interact2() {";
215
echo "    document.getElementById(\"query_option\").innerHTML = '";
215
echo "    document.getElementById(\"query_option\").innerHTML = '";
216
 
216
 
217
echo "$l_date1 <select name=\"start-year\">";
217
echo "$l_date1 <select name=\"start-year\">";
218
$year = date('Y');
218
$year = date('Y');
219
$years = $year-50;
219
$years = $year-50;
220
for ($i = $year; $i >= $years; $i--) {
220
for ($i = $year; $i >= $years; $i--) {
221
    $sel = ($i == $year) ? ' selected="selected"' : '';
221
    $sel = ($i == $year) ? ' selected="selected"' : '';
222
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
222
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
223
    echo "<option value=\"$i\"$sel>$i</option>";
223
    echo "<option value=\"$i\"$sel>$i</option>";
224
}
224
}
225
echo "</select>";
225
echo "</select>";
226
echo "-<select name=\"start-month\">";
226
echo "-<select name=\"start-month\">";
227
$month = date('m');
227
$month = date('m');
228
for ($i = 1; $i <= 12; $i++) {
228
for ($i = 1; $i <= 12; $i++) {
229
    $sel = ($i == $month) ? ' selected="selected"' : '';
229
    $sel = ($i == $month) ? ' selected="selected"' : '';
230
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
230
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
231
    echo "<option value=\"$i\"$sel>$i</option>";
231
    echo "<option value=\"$i\"$sel>$i</option>";
232
}
232
}
233
 
233
 
234
echo "</select>";
234
echo "</select>";
235
echo "-<select name=\"start-day\">";
235
echo "-<select name=\"start-day\">";
236
$day = date('d');
236
$day = date('d');
237
for ($i = 1; $i <= 31; $i++) {
237
for ($i = 1; $i <= 31; $i++) {
238
    $sel = ($i == $day) ? ' selected="selected"' : '';
238
    $sel = ($i == $day) ? ' selected="selected"' : '';
239
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
239
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
240
    echo "<option value=\"$i\"$sel>$i</option>";
240
    echo "<option value=\"$i\"$sel>$i</option>";
241
}
241
}
242
 
242
 
243
echo "</select>";
243
echo "</select>";
244
echo "$l_hours <select name=\"start-hour\">";
244
echo "$l_hours <select name=\"start-hour\">";
245
$hour = date('G');
245
$hour = date('G');
246
for ($i = 0; $i <= 23; $i++) {
246
for ($i = 0; $i <= 23; $i++) {
247
    $sel = ($i == $hour) ? ' selected="selected"' : '';
247
    $sel = ($i == $hour) ? ' selected="selected"' : '';
248
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
248
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
249
    echo "<option value=\"$i\"$sel>$i</option>";
249
    echo "<option value=\"$i\"$sel>$i</option>";
250
}
250
}
251
echo "</select>";
251
echo "</select>";
252
echo ":<select name=\"start-min\">";
252
echo ":<select name=\"start-min\">";
253
$min = date('i');
253
$min = date('i');
254
for ($i = 0; $i <= 59; $i++) {
254
for ($i = 0; $i <= 59; $i++) {
255
    $sel = ($i == $min) ? ' selected="selected"' : '';
255
    $sel = ($i == $min) ? ' selected="selected"' : '';
256
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
256
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
257
    echo "<option value=\"$i\"$sel>$i</option>";
257
    echo "<option value=\"$i\"$sel>$i</option>";
258
}
258
}
259
echo "</select>";
259
echo "</select>";
260
echo ":<select name=\"start-sec\">";
260
echo ":<select name=\"start-sec\">";
261
$sec = date('s');
261
$sec = date('s');
262
for ($i = 0; $i <= 59; $i++) {
262
for ($i = 0; $i <= 59; $i++) {
263
    $sel = ($i == $sec) ? ' selected="selected"' : '';
263
    $sel = ($i == $sec) ? ' selected="selected"' : '';
264
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
264
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
265
    echo "<option value=\"$i\"$sel>$i</option>";
265
    echo "<option value=\"$i\"$sel>$i</option>";
266
}
266
}
267
echo "</select>";
267
echo "</select>";
268
echo "</br>";
268
echo "</br>";
269
 
269
 
270
echo "$l_date2 <select name=\"stop-year\">";
270
echo "$l_date2 <select name=\"stop-year\">";
271
$year = date('Y');
271
$year = date('Y');
272
$years = $year-50;
272
$years = $year-50;
273
for ($i = $year; $i >= $years; $i--) {
273
for ($i = $year; $i >= $years; $i--) {
274
    $sel = ($i == $year) ? ' selected="selected"' : '';
274
    $sel = ($i == $year) ? ' selected="selected"' : '';
275
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
275
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
276
    echo "<option value=\"$i\"$sel>$i</option>";
276
    echo "<option value=\"$i\"$sel>$i</option>";
277
}
277
}
278
echo "</select>";
278
echo "</select>";
279
echo "-<select name=\"stop-month\">";
279
echo "-<select name=\"stop-month\">";
280
$month = date('m')+1;
280
$month = date('m')+1;
281
for ($i = 1; $i <= 12; $i++) {
281
for ($i = 1; $i <= 12; $i++) {
282
    $sel = ($i == $month) ? ' selected="selected"' : '';
282
    $sel = ($i == $month) ? ' selected="selected"' : '';
283
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
283
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
284
    echo "<option value=\"$i\"$sel>$i</option>";
284
    echo "<option value=\"$i\"$sel>$i</option>";
285
}
285
}
286
 
286
 
287
echo "</select>";
287
echo "</select>";
288
echo "-<select name=\"stop-day\">";
288
echo "-<select name=\"stop-day\">";
289
$day = date('d');
289
$day = date('d');
290
for ($i = 1; $i <= 31; $i++) {
290
for ($i = 1; $i <= 31; $i++) {
291
    $sel = ($i == $day) ? ' selected="selected"' : '';
291
    $sel = ($i == $day) ? ' selected="selected"' : '';
292
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
292
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
293
    echo "<option value=\"$i\"$sel>$i</option>";
293
    echo "<option value=\"$i\"$sel>$i</option>";
294
}
294
}
295
 
295
 
296
echo "</select>";
296
echo "</select>";
297
echo "$l_hours <select name=\"stop-hour\">";
297
echo "$l_hours <select name=\"stop-hour\">";
298
$hour = date('G');
298
$hour = date('G');
299
for ($i = 0; $i <= 23; $i++) {
299
for ($i = 0; $i <= 23; $i++) {
300
    $sel = ($i == $hour) ? ' selected="selected"' : '';
300
    $sel = ($i == $hour) ? ' selected="selected"' : '';
301
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
301
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
302
    echo "<option value=\"$i\"$sel>$i</option>";
302
    echo "<option value=\"$i\"$sel>$i</option>";
303
}
303
}
304
echo "</select>";
304
echo "</select>";
305
echo ":<select name=\"stop-min\">";
305
echo ":<select name=\"stop-min\">";
306
$min = date('i');
306
$min = date('i');
307
for ($i = 0; $i <= 59; $i++) {
307
for ($i = 0; $i <= 59; $i++) {
308
    $sel = ($i == $min) ? ' selected="selected"' : '';
308
    $sel = ($i == $min) ? ' selected="selected"' : '';
309
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
309
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
310
    echo "<option value=\"$i\"$sel>$i</option>";
310
    echo "<option value=\"$i\"$sel>$i</option>";
311
}
311
}
312
echo "</select>";
312
echo "</select>";
313
echo ":<select name=\"stop-sec\">";
313
echo ":<select name=\"stop-sec\">";
314
$sec = date('s');
314
$sec = date('s');
315
for ($i = 0; $i <= 59; $i++) {
315
for ($i = 0; $i <= 59; $i++) {
316
    $sel = ($i == $sec) ? ' selected="selected"' : '';
316
    $sel = ($i == $sec) ? ' selected="selected"' : '';
317
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
317
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
318
    echo "<option value=\"$i\"$sel>$i</option>";
318
    echo "<option value=\"$i\"$sel>$i</option>";
319
}
319
}
320
echo "</select>";
320
echo "</select>";
321
echo "</br></br><button type=\"submit\" class=\"btn btn-primary\" name=\"submit\" value=\"query_range\"> $l_submit</button>";
321
echo "</br></br><button type=\"submit\" class=\"btn btn-primary\" name=\"submit\" value=\"query_range\"> $l_submit</button>";
322
echo "';}";
322
echo "';}";
323
 
323
 
324
 
324
 
325
 
325
 
326
echo "function radio_interact3() {";
326
echo "function radio_interact3() {";
327
echo "    document.getElementById(\"query_option\").innerHTML = '";
327
echo "    document.getElementById(\"query_option\").innerHTML = '";
328
 
328
 
329
echo "$l_date1 <select name=\"start-year\">";
329
echo "$l_date1 <select name=\"start-year\">";
330
$year = date('Y');
330
$year = date('Y');
331
$years = $year-50;
331
$years = $year-50;
332
for ($i = $year; $i >= $years; $i--) {
332
for ($i = $year; $i >= $years; $i--) {
333
    $sel = ($i == $year) ? ' selected="selected"' : '';
333
    $sel = ($i == $year) ? ' selected="selected"' : '';
334
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
334
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
335
    echo "<option value=\"$i\"$sel>$i</option>";
335
    echo "<option value=\"$i\"$sel>$i</option>";
336
}
336
}
337
echo "</select>";
337
echo "</select>";
338
echo "-<select name=\"start-month\">";
338
echo "-<select name=\"start-month\">";
339
$month = date('m');
339
$month = date('m');
340
for ($i = 1; $i <= 12; $i++) {
340
for ($i = 1; $i <= 12; $i++) {
341
    $sel = ($i == $month) ? ' selected="selected"' : '';
341
    $sel = ($i == $month) ? ' selected="selected"' : '';
342
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
342
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
343
    echo "<option value=\"$i\"$sel>$i</option>";
343
    echo "<option value=\"$i\"$sel>$i</option>";
344
}
344
}
345
 
345
 
346
echo "</select>";
346
echo "</select>";
347
echo "-<select name=\"start-day\">";
347
echo "-<select name=\"start-day\">";
348
$day = date('d');
348
$day = date('d');
349
for ($i = 1; $i <= 31; $i++) {
349
for ($i = 1; $i <= 31; $i++) {
350
    $sel = ($i == $day) ? ' selected="selected"' : '';
350
    $sel = ($i == $day) ? ' selected="selected"' : '';
351
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
351
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
352
    echo "<option value=\"$i\"$sel>$i</option>";
352
    echo "<option value=\"$i\"$sel>$i</option>";
353
}
353
}
354
 
354
 
355
echo "</select>";
355
echo "</select>";
356
echo "$l_hours <select name=\"start-hour\">";
356
echo "$l_hours <select name=\"start-hour\">";
357
$hour = date('G');
357
$hour = date('G');
358
for ($i = 0; $i <= 23; $i++) {
358
for ($i = 0; $i <= 23; $i++) {
359
    $sel = ($i == $hour) ? ' selected="selected"' : '';
359
    $sel = ($i == $hour) ? ' selected="selected"' : '';
360
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
360
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
361
    echo "<option value=\"$i\"$sel>$i</option>";
361
    echo "<option value=\"$i\"$sel>$i</option>";
362
}
362
}
363
echo "</select>";
363
echo "</select>";
364
echo ":<select name=\"start-min\">";
364
echo ":<select name=\"start-min\">";
365
$min = date('i');
365
$min = date('i');
366
for ($i = 0; $i <= 59; $i++) {
366
for ($i = 0; $i <= 59; $i++) {
367
    $sel = ($i == $min) ? ' selected="selected"' : '';
367
    $sel = ($i == $min) ? ' selected="selected"' : '';
368
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
368
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
369
    echo "<option value=\"$i\"$sel>$i</option>";
369
    echo "<option value=\"$i\"$sel>$i</option>";
370
}
370
}
371
echo "</select>";
371
echo "</select>";
372
echo ":<select name=\"start-sec\">";
372
echo ":<select name=\"start-sec\">";
373
$sec = date('s');
373
$sec = date('s');
374
for ($i = 0; $i <= 59; $i++) {
374
for ($i = 0; $i <= 59; $i++) {
375
    $sel = ($i == $sec) ? ' selected="selected"' : '';
375
    $sel = ($i == $sec) ? ' selected="selected"' : '';
376
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
376
    $i = str_pad($i, 2, '0', STR_PAD_LEFT);
377
    echo "<option value=\"$i\"$sel>$i</option>";
377
    echo "<option value=\"$i\"$sel>$i</option>";
378
}
378
}
379
echo "</select>";
379
echo "</select>";
380
echo "</br></br><button type=\"submit\" class=\"btn btn-primary\" name=\"submit\" value=\"query_simple\"> $l_submit</button>";
380
echo "</br></br><button type=\"submit\" class=\"btn btn-primary\" name=\"submit\" value=\"query_simple\"> $l_submit</button>";
381
echo "';}";
381
echo "';}";
382
echo "</script>";
382
echo "</script>";
383
 
383
 
384
echo "</form>";
384
echo "</form>";
385
echo "</div>";
385
echo "</div>";
386
echo "</div>";
386
echo "</div>";
387
echo "</div>";
387
echo "</div>";
388
?>
388
?>
389
 
389
 
390
</body>
390
</body>
391
</html>
391
</html>
392
 
392
 
393
 
393
 
394
 
394
 
395
 
395
 
396
 
396