]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Starting to add remote server access
authorJean-Marc Pigeon <jmp@safe.c>
Thu, 30 Oct 2025 14:28:58 +0000 (10:28 -0400)
committerJean-Marc Pigeon <jmp@safe.c>
Thu, 30 Oct 2025 14:28:58 +0000 (10:28 -0400)
www/gesdis.php
www/gessql.php
www/lvlmai.php
www/lvlrmt.php [new file with mode: 0644]
www/unilng.php

index 3cfdd4427ee84bd119890376dd8936bbd9482fdc..edcf008f0ecfb482af961d52b2638233d3705259 100644 (file)
@@ -34,7 +34,7 @@ switch ($pageref) {
     if ($isadmin==true) {
       $remotes=gettranslate($userlang,"SMTP server");
       $users=gettranslate($userlang,"User Management");
-      $click1="<a href='/lvlusr.php'>$remotes</a>";
+      $click1="<a href='/lvlrmt.php'>$remotes</a>";
       $click2="<a href='/lvlusr.php'>$users</a>";
       }
     $click3="<a href='/lvllog.php'>$out</a>";
@@ -46,6 +46,13 @@ switch ($pageref) {
     $click2="<a href='/lvlmai.php'>$main</a>";
     $click3="<a href='/lvllog.php'>$out</a>";
     break;
+  case "lvlrmt"        :
+    $entete=gettranslate($userlang,"Remote server Management");
+    $main=gettranslate($userlang,"Main screen");
+    $out=gettranslate($userlang,"Logout");
+    $click2="<a href='/lvlmai.php'>$main</a>";
+    $click3="<a href='/lvllog.php'>$out</a>";
+    break;
   default      :
     $color="red";
     $data="???";
index 64e36ebba858958b98b87003831bbbea6cecc697..02152cf40c8dd97a8459ef6a266673723bb35663 100644 (file)
@@ -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");
+}
+
 ?>
index c72aa9719ae5ab7e84eb7256557d53508c3a0bb9..e72dc9c1df8fb34ea194f9f909787a45695ea784 100644 (file)
@@ -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 (file)
index 0000000..d466cf9
--- /dev/null
@@ -0,0 +1,210 @@
+<?php
+// vim: smarttab tabstop=8 shiftwidth=2 expandtab
+//==============================================================
+//
+//     Main screen management
+//
+//==============================================================
+include_once "subrou.php";
+include_once "unienv.php";
+include_once "gesdis.php";
+include_once "gessql.php";
+
+function tblheader(string $username,int $numrec,int $offset,int $limit)
+
+{
+global $userlang;
+
+$debut=$offset+1;
+$email=gettranslate($userlang,"Remote SMTP server");
+
+$STR  = <<<EOT
+<TR>
+<TD align=left>
+<FORM action="lvlusr.php" method="post">
+<input type="hidden" name="username" value="$username"/>
+<input type="hidden" name="offset" value="$offset"/>
+<input type="hidden" name="limit" value="$limit"/>
+<button name="scanner" value="gofirst">
+<FONT SIZE=+3>
+&larrb;
+</FONT>
+</Button>
+<button name="scanner" value="goprevious">
+<FONT SIZE=+3>
+&larr;
+</FONT>
+</Button>
+<button name="scanner" value="gonext">
+<FONT SIZE=+3>
+&rarr;
+</FONT>
+</Button>
+<button name="scanner" value="golast">
+<FONT SIZE=+3>
+&rarrb;
+</FONT>
+</Button>
+<FONT SIZE=+2>$debut/$numrec</FONT>
+</FORM>
+</TD>
+<TD align=left>
+<FORM action="lvlusr.php" method="post">
+<FONT SIZE=+1>
+$email:
+<input type="text" value="$username" name="username" size=20 style="font-size: 100%;">
+<input type="submit" style="display:none"/>
+</FONT>
+</FORM>
+</TD>
+<TD align=right>
+<FORM method="post">
+<input type="hidden" name="username" value="$username"/>
+<input type="hidden" name="offset" value="$offset"/>
+<input type="hidden" name="limit" value="$limit"/>
+<select name="limit" style="font-size: 130%;" onchange='if (this.value!=0) {this.form.submit();}'>
+<option selected="selected">$limit</option>
+<option value=20>20</option>
+<option value=40>40</option>
+<option value=80>80</option>
+<option value=100>100</option>
+</SELECT>
+</FORM>
+</TD>
+</TR>
+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."<TR>\r\n";
+  $line=$line."<TD><FONT SIZE=-1>$count&nbsp</FONT>\r\n";
+  $line=$line."<INPUT TYPE=IMAGE SRC=\"/reg-icons/folder.gif\" alt=\"ouvrir le dossier\" title=\"ouvrir le dossier\">\r\n";
+  $line=$line."&nbsp;$name\r\n";
+  $line=$line."</TD>\r\n";
+  $line=$line."<TD align=center>$last</TD>\r\n";
+  $line=$line."<TD align=center>$max</TD>\r\n";
+  $line=$line."<TD align=center>$lock</TD>\r\n";
+  $line=$line."</TR>";
+  }
+sql_close($dbsql);
+
+$start=starthtml("directives");
+$stop=endhtml();
+$top=topper($isadmin,$logname,"lvlrmt");
+$footer=footer("lvlusr");
+$tblheader=tblheader($username,$numrec,$offset,$limit);
+
+$STR  = <<<EOT
+$start
+$top
+<style type="text/css">
+.table-userlist tr:nth-child(odd)
+  {
+  background-color: #66ff99;    /*light green   */
+  color: black ;
+  }
+
+.table-userlist tr:nth-child(even)
+  {
+  background-color: white;
+  color: black ;
+  }
+</style>
+
+<CENTER>
+<table WIDTH="100%" BORDER="0" CellSpacing="0">
+$tblheader
+<table class="table-userlist" WIDTH="100%" BORDER="1" CellSpacing="0">
+<TR>
+<TH align=center>Email</TH>
+<TH align=center>lastemail</TH>
+<TH align=center>mxspace</TH>
+<TH align=center>locked</TH>
+</TR>
+$line
+</Table>
+</Table>
+</CENTER>
+<BR>
+<BR>
+$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');
+  }
+?>
+
+
+
index 08bae4d0f06e4341955f063373e9517d2ae565f5..0e135e5537b691efd3c1f2eb2f87a8b513cdf0fd 100644 (file)
@@ -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",
                "???"
                );