diff --git a/SRC/admin.php b/SRC/admin.php index ac811aa..b3ff2aa 100755 --- a/SRC/admin.php +++ b/SRC/admin.php @@ -8,7 +8,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST[' header('Location: admin.php'); exit; } else { - $error = 'Identifiants incorrects.'; + $error = 'Incorrect credentials.'; } } @@ -35,29 +35,29 @@ if (isset($_SESSION['admin_logged_in']) && $_SESSION['admin_logged_in'] === true $url = $_POST['url']; $description = $_POST['description']; - $tablesAutorisees = [ - 'mercure' => 'MERCURY', 'venus' => 'VENUS', 'terre' => 'EARTH', - 'mars' => 'MARS', 'jupiter' => 'JUPITER', 'saturne' => 'SATURN', + $allowedTables = [ + 'mercury' => 'MERCURY', 'venus' => 'VENUS', 'earth' => 'EARTH', + 'mars' => 'MARS', 'jupiter' => 'JUPITER', 'saturn' => 'SATURN', 'uranus' => 'URANUS', 'neptune' => 'NEPTUNE' ]; - if (array_key_exists($planete, $tablesAutorisees)) { - $nomTable = $tablesAutorisees[$planete]; + if (array_key_exists($planete, $allowedTables)) { + $nomTable = $allowedTables[$planete]; $stmt = $pdo->prepare("INSERT INTO $nomTable (title, date, url, explanation) VALUES (?, ?, ?, ?)"); $stmt->execute([$nom, $date, $url, $description]); - $message = "

Ligne ajoutée avec succès dans la table $nomTable !

"; + $message = "

Row successfully added to the $nomTable table!

"; } } catch (PDOException $e) { - $message = "

Erreur SQL : " . $e->getMessage() . "

"; + $message = "

SQL Error: " . $e->getMessage() . "

"; } } ?> - + - Panel Admin - OpenPlanetsMaps + Admin Panel - OpenPlanetsMaps