directory cleanup

This commit is contained in:
2023-07-10 13:36:21 +02:00
parent b71bc255ab
commit d152ebf4a2
8 changed files with 23 additions and 21 deletions
+4 -4
View File
@@ -8,7 +8,7 @@ if (!isset($_SESSION["username"])) {
$username = $_SESSION["username"];
$env = parse_ini_file(".env");
$env = parse_ini_file("../config/.env");
// Connect to db
$conn = new mysqli($env["HOST"], $env["DBUSER"], $env["DBPASS"], $env["TABLE"]);
@@ -19,7 +19,7 @@ if ($conn->connect_error) {
$user_id = $conn->query("SELECT * FROM users WHERE username = '$username'")->fetch_assoc()["id"];
require_once 'vendor/autoload.php';
require_once '../vendor/autoload.php';
// start http client
$client = new GuzzleHttp\Client();
@@ -34,6 +34,7 @@ $response = $client->request('GET', 'https://api.themoviedb.org/3/search/multi?q
]);
$json = json_decode($response->getBody(), true)["results"][0];
$season = $_POST["season"];
$episode = $_POST["episode"];
$name = $_POST["title"];
@@ -50,7 +51,6 @@ if($result) {
exit;
} else {
$conn->close();
echo "Error inserting value into database";
die("Error inserting value into database");
}
?>
+2 -3
View File
@@ -1,7 +1,7 @@
<?php
session_start();
$env = parse_ini_file(".env");
$env = parse_ini_file("../config/.env");
// Connect to db
$conn = new mysqli($env["HOST"], $env["DBUSER"], $env["DBPASS"], $env["TABLE"]);
@@ -11,7 +11,6 @@ if ($conn->connect_error) {
}
if ($_SERVER["REQUEST_METHOD"] == "POST") { // When user posts data
$username = $_POST["username"];
$password = $_POST["password"];
@@ -23,7 +22,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { // When user posts data
if ($password == $dbPassword) {
$_SESSION["username"] = $username;
header("Location: dashboard.php");
header("Location: /dashboard.php");
} else {
header("Location: /?wrongpass");
die;
View File
+2 -2
View File
@@ -1,7 +1,7 @@
<?php
session_start();
$env = parse_ini_file(".env");
$env = parse_ini_file("../config/.env");
// Connect to db
$conn = new mysqli($env["HOST"], $env["DBUSER"], $env["DBPASS"], $env["TABLE"]);
@@ -45,7 +45,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { // When user posts data
}
$_SESSION["username"] = $username;
header("Location: dashboard.php");
header("Location: /dashboard.php");
$conn->close();
exit;
}
+4 -4
View File
File diff suppressed because one or more lines are too long
+8 -4
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+2 -3
View File
@@ -9,7 +9,7 @@ if (!isset($_SESSION["username"])) {
$username = $_SESSION["username"];
require_once 'vendor/autoload.php';
$env = parse_ini_file(".env");
$env = parse_ini_file("config/.env");
// start http client
$client = new GuzzleHttp\Client();
@@ -60,7 +60,7 @@ $json = json_decode($response->getBody(), true)["results"];
echo ($data["first_air_date"] != null) ? " (" . explode("-", $data["first_air_date"])[0] . ")" : '';
?>
</p>
<form method='post' action='add.php'>
<form method='post' action='/backend/add.php'>
<input value='<?php echo $data["name"] . $data["title"]; ?>' class='invisible_input' name='title' required>
<input type='number' name='season' value='1' min='1' required>
<input type='number' name='episode' value='1' min='1' required>
@@ -70,7 +70,6 @@ $json = json_decode($response->getBody(), true)["results"];
<?php endforeach ?>
</div>
<?php else: ?>
<h2>Nothing found...</h2>
<?php endif ?>