mirror of https://github.com/itsmrval/subway
Compare commits
7 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
dce7330f73 | |
|
|
db71adc9f2 | |
|
|
9d36d93ad6 | |
|
|
ee12ab5324 | |
|
|
9801bc99d9 | |
|
|
c80e41c953 | |
|
|
8d942f4e78 |
|
|
@ -30,7 +30,7 @@ Note: This app is not intended for production use, but for personal or education
|
||||||
This section list major frameworks/libraries used
|
This section list major frameworks/libraries used
|
||||||
|
|
||||||
* 
|
* 
|
||||||
* 
|
* 
|
||||||
* 
|
* 
|
||||||
|
|
||||||
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
||||||
|
|
@ -74,7 +74,9 @@ Then, create a user with a database
|
||||||
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
||||||
|
|
||||||
|
|
||||||
|
## Known issues
|
||||||
|
|
||||||
|
- Some stations with RER A doesnt display timetables
|
||||||
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
|
||||||
|
|
@ -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>
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,8 @@ function getStopName($stopId) {
|
||||||
function getFavorites($lineId) {
|
function getFavorites($lineId) {
|
||||||
global $conn;
|
global $conn;
|
||||||
try {
|
try {
|
||||||
$query = $conn->prepare("SELECT stopId FROM favorites WHERE lineId = ?");
|
$query = $conn->prepare("SELECT stopId FROM favorites WHERE lineId = ? AND userId = ?");
|
||||||
$query->execute([$lineId]);
|
$query->execute([$lineId, $_SESSION['user_id']]);
|
||||||
$result = $query->fetchAll(PDO::FETCH_ASSOC);
|
$result = $query->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
|
@ -26,8 +26,6 @@ $query = $conn->prepare("SELECT DISTINCT lineId FROM favorites WHERE userId = ?"
|
||||||
$query->execute([$_SESSION['user_id']]);
|
$query->execute([$_SESSION['user_id']]);
|
||||||
$lineIds = $query->fetchAll(PDO::FETCH_COLUMN);
|
$lineIds = $query->fetchAll(PDO::FETCH_COLUMN);
|
||||||
|
|
||||||
echo $_SERVER['REMOTE_ADDR'];
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="px-4 my-5 text-center">
|
<div class="px-4 my-5 text-center">
|
||||||
|
|
|
||||||
|
|
@ -13,13 +13,15 @@ $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 ($departureTime > $currentTime) {
|
||||||
if (!isset($directions[$direction])) {
|
if (!isset($directions[$direction])) {
|
||||||
$directions[$direction] = [];
|
$directions[$direction] = [];
|
||||||
}
|
}
|
||||||
|
|
@ -29,6 +31,8 @@ if (isset($data['Siri']['ServiceDelivery']['StopMonitoringDelivery'][0]['Monitor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$finalDirections = [];
|
$finalDirections = [];
|
||||||
foreach ($directions as $direction => $times) {
|
foreach ($directions as $direction => $times) {
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,13 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($errorMessage)) {
|
if (!isset($errorMessage)) {
|
||||||
|
try {
|
||||||
|
$password = password_hash($_POST['password'], PASSWORD_DEFAULT);
|
||||||
$query = $conn->prepare("INSERT INTO users (firstName, lastName, email, password) VALUES (:firstName, :lastName, :email, :password)");
|
$query = $conn->prepare("INSERT INTO users (firstName, lastName, email, password) VALUES (:firstName, :lastName, :email, :password)");
|
||||||
$query->bindParam(':firstName', $_POST['firstName']);
|
$query->bindParam(':firstName', $_POST['firstName']);
|
||||||
$query->bindParam(':lastName', $_POST['lastName']);
|
$query->bindParam(':lastName', $_POST['lastName']);
|
||||||
$query->bindParam(':email', $_POST['email']);
|
$query->bindParam(':email', $_POST['email']);
|
||||||
$query->bindParam(':password', password_hash($_POST['password'], PASSWORD_DEFAULT));
|
$query->bindParam(':password', $password);
|
||||||
$query->execute();
|
$query->execute();
|
||||||
|
|
||||||
$query = $conn->prepare("SELECT COUNT(*) as count FROM users");
|
$query = $conn->prepare("SELECT COUNT(*) as count FROM users");
|
||||||
|
|
@ -33,6 +35,9 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||||
|
|
||||||
header("Location: login.php");
|
header("Location: login.php");
|
||||||
exit();
|
exit();
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
$errorMessage = "Please fill correct values";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,8 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Subway schedules</title>
|
<title>Subway</title>
|
||||||
|
<link rel="icon" href="assets/logo/favicon.png">
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
|
||||||
<?php
|
<?php
|
||||||
if (!isset($_SESSION['user_id'])) {
|
if (!isset($_SESSION['user_id'])) {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
Binary file not shown.
|
After Width: | Height: | Size: 42 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 20 KiB |
Loading…
Reference in New Issue