Przeglądaj źródła

Only Admin User Can Use Lang-Check Page (#637)

* Lock Down Lang-Check Page

* Lock Down Lang-Check Page

* Lock Down Lang-Check Page
OwN-3m-All 1 rok temu
rodzic
commit
62548577d2
1 zmienionych plików z 13 dodań i 1 usunięć
  1. 13 1
      lang/lang-check.php

+ 13 - 1
lang/lang-check.php

@@ -28,6 +28,19 @@ require_once("includes/helpers.php");
 require_once("includes/config.inc.php");
 require_once("includes/lang.php");
 require_once("includes/functions.php");
+
+define("CONFIG_FILE", __dir__ . "/../includes/config.inc.php");
+
+require_once CONFIG_FILE;
+// Connect to the database server and select database.
+$db = createDatabaseConnection($db_type, $db_host, $db_user, $db_pass, $db_name, $table_prefix);
+
+startSession();
+
+if(!isset($_SESSION['user_id']) || !$db->isAdmin($_SESSION['user_id'])){
+	die("You must be logged in and an admin user to use this page!");
+}
+
 function curPageURL() {
 	$pageURL = ( isset($_SERVER['HTTPS']) and  get_true_boolean($_SERVER['HTTPS']) ) ? "https://" : "http://";
 	if ($_SERVER["SERVER_PORT"] != "80")
@@ -264,4 +277,3 @@ foreach ($locale_files as $lang_name)
 }
 ?>
 </html>
-