Subversion Repositories ALCASAR

Rev

Rev 2394 | Rev 2418 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2394 Rev 2413
Line 1... Line 1...
1
<?php
1
<?php
2
# $Id: status.php 2394 2017-08-27 13:28:59Z tom.houdayer $
2
# $Id: status.php 2413 2017-09-17 16:05:20Z tom.houdayer $
3
#
3
#
4
# status.php for ALCASAR captive portal
4
# status.php for ALCASAR captive portal
5
# by steweb57 & Rexy
5
# by steweb57 & Rexy
6
# 
6
# 
7
/****************************************************************
7
/****************************************************************
Line 282... Line 282...
282
		if ($link) {
282
		if ($link) {
283
			// Retrieve the last connections
283
			// Retrieve the last connections
284
			$sql = "SELECT UserName, AcctStartTime, AcctStopTime, acctsessiontime FROM radacct WHERE UserName='$user[5]' ORDER BY AcctStartTime DESC LIMIT 0, $nb_connection_history";
284
			$sql = "SELECT UserName, AcctStartTime, AcctStopTime, acctsessiontime FROM radacct WHERE UserName='$user[5]' ORDER BY AcctStartTime DESC LIMIT 0, $nb_connection_history";
285
			$res = @da_sql_query($link, $config, $sql);
285
			$res = @da_sql_query($link, $config, $sql);
286
			if ($res) {
286
			if ($res) {
287
				$a_connection = '';
-
 
288
				$a_connected = 0;
-
 
289
				$connection_history = '<ul>';
287
				$connection_history = '<ul>';
290
				while (($row = @da_sql_fetch_array($res,$config))) {
288
				while (($row = @da_sql_fetch_array($res,$config))) {
291
					$start_conn = date_create($row['acctstarttime']);
289
					$start_conn = date_create($row['acctstarttime']);
292
					if (empty($row['acctstoptime'])) {
290
					if (empty($row['acctstoptime'])) {
293
						$connected = $l_connected;
291
						$connected = $l_connected;
294
						$a_connected++;
-
 
295
					} else {
292
					} else {
296
						$connected = secondsToDuration($row['acctsessiontime']);
293
						$connected = secondsToDuration($row['acctsessiontime']);
297
					}
294
					}
298
					$connection_history .= '<li>'.date_format($start_conn, 'd M Y - H:i:s')." - ($connected)</li>";
295
					$connection_history .= '<li>'.date_format($start_conn, 'd M Y - H:i:s')." - ($connected)</li>";
299
				}
296
				}
300
				$connection_history .= '</ul>';
297
				$connection_history .= '</ul>';
-
 
298
			}
-
 
299
 
301
				if ($a_connected > 1) {
300
			// Retrieve number of open session
302
					$a_connection = $l_a_connection.' '.$a_connected.' '.$l_a_connection_time;
301
			$sql = "SELECT COUNT(*) AS nb_open FROM radacct WHERE username = '$user[5]' AND acctstoptime IS NULL;";
-
 
302
			$res = @da_sql_query($link, $config, $sql);
303
				}
303
			if ($res) {
-
 
304
				$row = @da_sql_fetch_array($search,$config);
-
 
305
				$nb_open_session = $row['nb_open'];
304
			}
306
			}
305
 
307
 
306
			// Retrieve first name & last name
308
			// Retrieve first name & last name
307
			$sql = "SELECT Name FROM userinfo WHERE UserName='$user[5]'";
309
			$sql = "SELECT Name FROM userinfo WHERE UserName='$user[5]'";
308
			$res = @da_sql_query($link, $config, $sql);
310
			$res = @da_sql_query($link, $config, $sql);
Line 368... Line 370...
368
											<?= $l_welcome ?><br><?= $cn ?>
370
											<?= $l_welcome ?><br><?= $cn ?>
369
										</td>
371
										</td>
370
									</tr>
372
									</tr>
371
									<tr>
373
									<tr>
372
										<td class="alert">
374
										<td class="alert">
373
											<?= ((isset($a_connection)) ? $a_connection : '') ?>
375
											<?= ((isset($nb_open_session) && ($nb_open_session > 1)) ? $l_a_connection.' '.$nb_open_session.' '.$l_a_connection_time : '') ?>
374
										</td>
376
										</td>
375
									</tr>
377
									</tr>
376
									<tr>
378
									<tr>
377
										<td colspan="2" align="center" class="link_logout">
379
										<td colspan="2" align="center" class="link_logout">
378
											<a href="#" onclick="return logoutWithConfirmation('<?= $l_logout_question ?>');" class="lien_deco"><?= $l_logout ?></a>
380
											<a href="#" onclick="return logoutWithConfirmation('<?= $l_logout_question ?>');" class="lien_deco"><?= $l_logout ?></a>