]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Adding unienv.php file
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Wed, 27 Aug 2025 15:34:44 +0000 (11:34 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Wed, 27 Aug 2025 15:34:44 +0000 (11:34 -0400)
www/unienv.php [new file with mode: 0644]

diff --git a/www/unienv.php b/www/unienv.php
new file mode 100644 (file)
index 0000000..6486e4b
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+
+//==============================================================
+//
+//     To load environement variable
+//
+//==============================================================
+function loadenv()
+
+{
+$var_arrs=array();
+$phase=0;
+$proceed=true;
+while ($proceed==true) {
+  switch ($phase) {
+    case 0     :               //Loading environment variable
+      $env_file_path=realpath("/etc/mailleur/"."mailleur.conf");
+      echo $env_file_path;
+      break;
+    case 1     :               //checking if file exist
+      if(!is_file($env_file_path)){
+        throw new ErrorException("Environment File is Missing.");
+       $phase=999;             //no need to go further
+        }
+      break;
+    case 2     :               //opening file 
+      $fopen=fopen($env_file_path,'r');
+      if (!$fopen) {
+       throw new ErrorException("Unable to read file <".($env_file_path).">");
+       $phase=999;
+      break;
+    case 3     :               //scanning file
+      break;
+    case 4     :               //closing file
+      fclose($fopen);
+      break;
+    default    :               //SAFE Guard
+      $proceed=false;
+      break;
+    }
+  $phase++;
+  }
+}
+
+?>