mirror of https://github.com/itsmrval/subway
parent
8d942f4e78
commit
fd3c5b2454
|
|
@ -71,10 +71,21 @@ $userDetails = getUserDetails($_SESSION['user_id']);
|
||||||
<button type="submit" class="btn btn-primary">Save Changes</button>
|
<button type="submit" class="btn btn-primary">Save Changes</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$query = $conn->prepare("SELECT logs.ip, logs.date, users.email FROM logs JOIN users ON logs.userId = users.id");
|
function getUserLogs($userId) {
|
||||||
$query->execute();
|
global $conn;
|
||||||
$logDetails = $query->fetchAll(PDO::FETCH_ASSOC);
|
try {
|
||||||
|
$query = $conn->prepare("SELECT logs.ip, logs.date, users.email FROM logs JOIN users ON logs.userId = users.id WHERE logs.userId = ?");
|
||||||
|
$query->execute([$userId]);
|
||||||
|
return $query->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
} catch(PDOException $e) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$logDetails = getUserLogs($_SESSION['user_id']);
|
||||||
?>
|
?>
|
||||||
<table class="table mt-4">
|
<table class="table mt-4">
|
||||||
<thead>
|
<thead>
|
||||||
|
|
|
||||||
|
|
@ -13,18 +13,22 @@ $directions = [];
|
||||||
if (isset($data['Siri']['ServiceDelivery']['StopMonitoringDelivery'][0]['MonitoredStopVisit'])) {
|
if (isset($data['Siri']['ServiceDelivery']['StopMonitoringDelivery'][0]['MonitoredStopVisit'])) {
|
||||||
foreach ($data['Siri']['ServiceDelivery']['StopMonitoringDelivery'][0]['MonitoredStopVisit'] as $visit) {
|
foreach ($data['Siri']['ServiceDelivery']['StopMonitoringDelivery'][0]['MonitoredStopVisit'] as $visit) {
|
||||||
$vehicleJourney = $visit['MonitoredVehicleJourney'];
|
$vehicleJourney = $visit['MonitoredVehicleJourney'];
|
||||||
if (isset($vehicleJourney['MonitoredCall']['ExpectedArrivalTime'])) {
|
if (strpos($vehicleJourney['OperatorRef']['value'], '.' . $lineId . '.' . $lineId . ':')) {
|
||||||
$direction = $vehicleJourney['DirectionName'][0]['value'];
|
if (isset($vehicleJourney['MonitoredCall']['ExpectedDepartureTime'])) {
|
||||||
$expectedArrival = $vehicleJourney['MonitoredCall']['ExpectedArrivalTime'];
|
$direction = $vehicleJourney['DestinationName'][0]['value'];
|
||||||
$expectedDeparture = $vehicleJourney['MonitoredCall']['ExpectedDepartureTime'];
|
$expectedDeparture = $vehicleJourney['MonitoredCall']['ExpectedDepartureTime'];
|
||||||
|
|
||||||
$departureTime = date('H:i', strtotime($expectedArrival . ' +2 hours'));
|
$departureTime = date('H:i', strtotime($expectedDeparture . ' +2 hours'));
|
||||||
|
$currentTime = date('H:i', strtotime('now' . ' +2 hours'));
|
||||||
|
|
||||||
if (!isset($directions[$direction])) {
|
if ($departureTime > $currentTime) {
|
||||||
$directions[$direction] = [];
|
if (!isset($directions[$direction])) {
|
||||||
}
|
$directions[$direction] = [];
|
||||||
if (count($directions[$direction]) < 2) {
|
}
|
||||||
$directions[$direction][] = $departureTime;
|
if (count($directions[$direction]) < 2) {
|
||||||
|
$directions[$direction][] = $departureTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue