]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Starting to investiguate devsql.php
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Wed, 27 Aug 2025 17:59:03 +0000 (13:59 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Wed, 27 Aug 2025 17:59:03 +0000 (13:59 -0400)
mailleur.spec.in
www/devsql.php [new file with mode: 0644]
www/mailleur.php
www/unienv.php
www/unimar.php [new file with mode: 0644]
www/unipos.php [new file with mode: 0644]

index 142e959e3d40856528b09375d33f9aa97a10dd24..4ac9bb39a37c32bbf864284a39cd1b7da954a4db 100644 (file)
@@ -77,6 +77,8 @@ search about email exchange within time and transaction context.
 %attr(0640,root,root) %{_datadir}/%{name}/sql/Makefile
 %attr(0644,root,root) %{_datadir}/%{name}/sql/datatest.def
 %attr(0644,root,root) %{_datadir}/%{name}/sql/*.sql
+%exclude %{wwwdir}/%{name}/unipos.php
+%exclude %{wwwdir}/%{name}/unimar.php
 %exclude %{_datadir}/%{name}/sql/%{name}.mysql
 %exclude %{_datadir}/%{name}/sql/%{name}.postg
 #-----------------------------------------------------------------------------
@@ -179,6 +181,7 @@ Obsoletes   :       %{name}-mysql           <= %{version}-%{release}
 %files                 postgresql
 %defattr(-,root,root,-)
 %attr(0755,%{name},mail) %{_libexecdir}/%{name}/bin-posql/*
+%attr(0750,%{name},apache) %{wwwdir}/%{name}/unipos.php
 
 #-----------------------------------------------------------------------------
 %post                  postgresql
@@ -250,6 +253,7 @@ Obsoletes   :       %{name}-postgresql      <= %{version}-%{release}
 %files                 mysql
 %defattr(-,root,root,-)
 %attr(0755,%{name},mail) %{_libexecdir}/%{name}/bin-mysql/*
+%attr(0750,%{name},apache) %{wwwdir}/%{name}/unimar.php
 
 #-----------------------------------------------------------------------------
 
diff --git a/www/devsql.php b/www/devsql.php
new file mode 100644 (file)
index 0000000..9058775
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+//==============================================================
+//
+//     To dispatch all data base access according database type
+//
+//==============================================================
+
+function sql_connect() 
+
+{
+switch($dbtype) {
+  case 'MYSQL'         :
+    include_once "unimar.php";
+    echo ("unimar.php included");
+    break;
+  case 'POSTGRESQL'    :
+    include_once "unipos.php";
+    echo ("unipos.php included");
+    break;
+  default              :
+    throw new ErrorException("Database type $dbtype is unexpected!");
+    break;
+  }
+}
+
+?>
index ff76b1e7c26aaedabdc91e4c34d196c07289be83..becfb20b35de393bfce0a4ff53ceb750b078a10b 100644 (file)
@@ -4,13 +4,15 @@
 function body($action,$logname,$pass)
 
 {
-include "unienv.php";
-include "scrfun.php";
+include_once "unienv.php";
+include_once "scrfun.php";
+include_once "devsql.php";
 loadenv();
 $footer=footer("mailleur");
 $dbtype=getenv("DB_TYPE");
 $dbport=getenv("DB_PORT");
 
+
 $STR  = <<<EOT
 <!DOCTYPE html>
 <HTML>    
@@ -29,6 +31,7 @@ Login=$logname
 Password=$pass
 <BR>
 DBTYPE=$dbtype; DBPORT=$dbport
+sql_connect();
 </FONT></STRONG></CENTER>
 </FONT></STRONG></CENTER>
 $footer
index 4d22745baf431f963fe1d0544d1f500fbb342011..35ce6b8f9e17186cb9d4a90a2e3bf2586b01cc10 100644 (file)
@@ -16,14 +16,14 @@ while ($proceed==true) {
   switch ($phase) {
     case 0     :               //checking if file exist
       if(!is_file($env_file_path)){
-        throw new ErrorException("Environment File is Missing.");
+        throw new ErrorException("File <".$env_file_path."> is Missing!");
        $phase=999;             //no need to go further
         }
       break;
     case 1     :               //opening file 
       $fopen=fopen($env_file_path,'r');
       if (!$fopen) {
-       throw new ErrorException("Unable to read file <".($env_file_path).">");
+       throw new ErrorException("Unable to read file <".($env_file_path).">!");
        $phase=999;
        }
       break;
diff --git a/www/unimar.php b/www/unimar.php
new file mode 100644 (file)
index 0000000..144a44e
--- /dev/null
@@ -0,0 +1,9 @@
+<?php
+//==============================================================
+//
+//     To manage all access to MariaDB database
+//
+//==============================================================
+
+
+?>
diff --git a/www/unipos.php b/www/unipos.php
new file mode 100644 (file)
index 0000000..23f6294
--- /dev/null
@@ -0,0 +1,9 @@
+<?php
+//==============================================================
+//
+//     To manage all access to Postgresql database
+//
+//==============================================================
+
+
+?>