From fb533ff683f8f7ac1babb24d2035249641e59d87 Mon Sep 17 00:00:00 2001 From: Jean-Marc Pigeon Date: Thu, 30 Oct 2025 10:28:58 -0400 Subject: [PATCH] Starting to add remote server access --- www/gesdis.php | 9 ++- www/gessql.php | 17 ++++ www/lvlmai.php | 39 ++++++--- www/lvlrmt.php | 210 +++++++++++++++++++++++++++++++++++++++++++++++++ www/unilng.php | 6 +- 5 files changed, 269 insertions(+), 12 deletions(-) create mode 100644 www/lvlrmt.php diff --git a/www/gesdis.php b/www/gesdis.php index 3cfdd44..edcf008 100644 --- a/www/gesdis.php +++ b/www/gesdis.php @@ -34,7 +34,7 @@ switch ($pageref) { if ($isadmin==true) { $remotes=gettranslate($userlang,"SMTP server"); $users=gettranslate($userlang,"User Management"); - $click1="$remotes"; + $click1="$remotes"; $click2="$users"; } $click3="$out"; @@ -46,6 +46,13 @@ switch ($pageref) { $click2="$main"; $click3="$out"; break; + case "lvlrmt" : + $entete=gettranslate($userlang,"Remote server Management"); + $main=gettranslate($userlang,"Main screen"); + $out=gettranslate($userlang,"Logout"); + $click2="$main"; + $click3="$out"; + break; default : $color="red"; $data="???"; diff --git a/www/gessql.php b/www/gessql.php index 64e36eb..02152cf 100644 --- a/www/gessql.php +++ b/www/gessql.php @@ -226,4 +226,21 @@ $stmt=$dbsql->Select("$strsel $strlim $strskip"); return $stmt->fetchAll(); } +//============================================================== +// +// Function to return the number of record within actions +// table according a select. +// +//============================================================== +function sql_getnumactions($dbsql,$username) + +{ + $OPEP="gessql.php:sql_getnumactions"; + +$select=NULL; +if ($username!=NULL) + $select="where rcptto like '%$username%'"; +return sql_getnumrec($dbsql,$select,"actions"); +} + ?> diff --git a/www/lvlmai.php b/www/lvlmai.php index c72aa97..e72dc9c 100644 --- a/www/lvlmai.php +++ b/www/lvlmai.php @@ -10,7 +10,30 @@ include_once "unienv.php"; include_once "gesdis.php"; include_once "gessql.php"; -//section to generate the main screen body +//============================================================== +// +// Procedure to extract the list of actions +// +//============================================================== +function getactions($dbsql,$offset) + +{ +$limit=20; +if (isset($_POST['username'])) + $username=trim(($_POST['username'])); +if (isset($_POST['limit'])) + $limit=intval($_POST['limit']); +$numrec=sql_getnumactions($dbsql,$username); +$actions=sql_getactionslist($dbsql,$username,$limit,$offset); + +return $actions; +} + +//============================================================== +// +// section to generate the main screen body +// +//============================================================== function body($logname) { @@ -21,21 +44,16 @@ $stop=endhtml(); $top=topper($isadmin,$logname,"lvlmai"); $footer=footer("lvlmai"); -$limit=20; $offset=0; $username=""; -$dbsql=sql_connect(); -if (isset($_POST['username'])) - $username=trim(($_POST['username'])); -if (isset($_POST['limit'])) - $limit=intval($_POST['limit']); if (isset($_POST['offset'])) $offset=intval($_POST['offset']); - -$actions=sql_getactionslist($dbsql,$username,$limit,$offset); +$dbsql=sql_connect(); +$actions=getactions($dbsql,$offset); $line=""; $count=$offset+1; foreach($actions as $action) { + rou_alert(0,"JMPDBG count=$count"); $info=substr($action['info'],3,1); $status=$action['status']; $subject=htmlspecialchars($action['subject'],ENT_QUOTES); @@ -49,6 +67,9 @@ foreach($actions as $action) { $bgcolor="#ff6666"; //light red $subject=htmlspecialchars($action['info'],ENT_QUOTES); break; + case 551 : + $bgcolor="#FF7F50"; //coral (orange red) + break; case 555 : $bgcolor="#D3D3D3"; //light gray break; diff --git a/www/lvlrmt.php b/www/lvlrmt.php new file mode 100644 index 0000000..d466cf9 --- /dev/null +++ b/www/lvlrmt.php @@ -0,0 +1,210 @@ + + +
+ + + + + + + +$debut/$numrec +
+ + +
+ +$email: + + + +
+ + +
+ + + + +
+ + +EOT; + +return $STR; +} + +//section to generate the main screen body +function body($logname) + +{ +$OPEP="lvlusr.php:body"; + +global $isadmin; +global $logname; + +$limit=20; +$offset=0; +$username=""; +$dbsql=sql_connect(); +if (isset($_POST['username'])) + $username=trim(($_POST['username'])); +if (isset($_POST['limit'])) + $limit=intval($_POST['limit']); +if (isset($_POST['offset'])) + $offset=intval($_POST['offset']); +$numrec=sql_getnumemail($dbsql,$username); +if (isset($_POST['scanner'])) { + $scanner=$_POST['scanner']; + switch ($scanner) { + case "golast" : + $offset=$numrec-$limit; + break; + case "gonext" : + + $offset+=$limit; + if ($offset>($numrec-$limit)) + $offset=$numrec-$limit; + break; + case "goprevious" : + $offset-=$limit; + if ($offset<0) + $offset=0; + break; + case "gofirst" : + $offset=0; + break; + default : + break; + } + } +$emails=sql_getemaillist($dbsql,$username,$limit,$offset); +$line=""; +$count=$offset; +foreach($emails as $email) { + $count++; + $bgcolor="white"; + if ($count & 1 ) { + $bgcolor="green"; + } + $name=$email['email']; + $last=$email['lastemail']; + $max=$email['mxspace']; + $lock=$email['locked']; + $line=$line."\r\n"; + $line=$line."$count \r\n"; + $line=$line."\r\n"; + $line=$line." $name\r\n"; + $line=$line."\r\n"; + $line=$line."$last\r\n"; + $line=$line."$max\r\n"; + $line=$line."$lock\r\n"; + $line=$line.""; + } +sql_close($dbsql); + +$start=starthtml("directives"); +$stop=endhtml(); +$top=topper($isadmin,$logname,"lvlrmt"); +$footer=footer("lvlusr"); +$tblheader=tblheader($username,$numrec,$offset,$limit); + +$STR = << +.table-userlist tr:nth-child(odd) + { + background-color: #66ff99; /*light green */ + color: black ; + } + +.table-userlist tr:nth-child(even) + { + background-color: white; + color: black ; + } + + +
+ +$tblheader +
+ + + + + + +$line +
Emaillastemailmxspacelocked
+ +
+
+
+$footer +$stop +EOT; + +return $STR; +} + + +$dbsql=sql_connect(); +sql_setlogname($dbsql); +sql_close($dbsql); +rou_closelog(); + +if ($logname!=NULL) { + echo body($logname); + } +else { + header('Location: lvllog.php'); + } +?> + + + diff --git a/www/unilng.php b/www/unilng.php index 08bae4d..0e135e5 100644 --- a/www/unilng.php +++ b/www/unilng.php @@ -19,8 +19,9 @@ $english =array ( "Email", "Logout", "Main screen", - "SMTP server", + "Remote SMTP server", "User Management", + "Remote SMTP server Management", "???" ); @@ -28,8 +29,9 @@ $francais=array ( "Courriel", "Deconnexion", "Ecran Principal", - "Serveur SMTP", + "Serveur SMTP distant", "Gestion des usagers", + "gestion des serveurs SMTP distants", "???" ); -- 2.47.3