From: Jean-Marc Pigeon Date: Sat, 13 Sep 2025 11:05:34 +0000 (-0400) Subject: Starting to implement user log display within web "main screen" X-Git-Tag: tag-0.17~70 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=9136061d834a3054c728ca29f6daaeb73abdec42;p=jmp%2Fmailleur Starting to implement user log display within web "main screen" --- diff --git a/lib/geseml.c b/lib/geseml.c index fb19cc9..df161ac 100644 --- a/lib/geseml.c +++ b/lib/geseml.c @@ -194,14 +194,14 @@ if (tra!=(TRATYP *)0) { status=true; (void) strftime(temps,sizeof(temps),"#%Y-%m-%d %H:%M:%S", localtime(&(tra->date))); - (void) snprintf(line,sizeof(line),"%c\t%lu\t%05u%*s %*s %*s \"%*s\" %s", + (void) snprintf(line,sizeof(line),"%c\t%lu\t%05u %*s %*s %*s \"%*s\" %s", tra->code, tra->date, tra->delay, - 32,tra->sessid, - 30,tra->rcptto, - 30,tra->sfrom, - 30,tra->hfrom, + -32,tra->sessid, + -30,tra->rcptto, + -30,tra->sfrom, + -30,tra->hfrom, tra->hsubject ); (void) print_tra(qfile,line,temps); @@ -243,12 +243,12 @@ if (tra!=(TRATYP **)0) { (void) fprintf(qfile,"#'C', completed email task\n"); (void) fprintf(qfile,"#'L', Local email\n"); (void) fprintf(qfile,"#'R', Remote email\n"); - (void) fprintf(qfile,"#code\tdate\t\tdelay" - "%*s %*s %*s %*s\n", - 32,"session-id", - 30,"recipient", - 30,"sfrom", - 30,"efrom"); + (void) fprintf(qfile,"#code\tdate\t\tdelay " + "%*s %*s %*s %*s subject\n", + -32,"session-id", + -30,"recipient", + -30,"sfrom", + -30,"efrom"); } while (*tra!=(TRATYP *)0) { (void) eml_dump_one_tra(qfile,*tra); @@ -304,6 +304,7 @@ if (tra!=(TRATYP *)0) { dup->delay=tra->delay; dup->sfrom=strdup(tra->sfrom); dup->hfrom=strdup(tra->hfrom); + dup->hsubject=strdup(tra->hsubject); dup->rcptto=strdup(tra->rcptto); dup->sessid=strdup(tra->sessid); if (tra->resp!=(char **)0) { diff --git a/www/gessql.php b/www/gessql.php index 9d4b26e..7f456e9 100644 --- a/www/gessql.php +++ b/www/gessql.php @@ -162,7 +162,7 @@ rou_alert(0,"$OPEP, now logname=<$logname>"); //============================================================== // -// Function to retreive a some email record +// Function to retreive user email list // //============================================================== function sql_getemaillist($dbsql,$username,$limit,$skip) @@ -200,4 +200,29 @@ if ($username!=NULL) $select="where email like '%$username%'"; return sql_getnumrec($dbsql,$select,"emails"); } +//============================================================== +// +// Function to retreive user actions list +// +// +//============================================================== +function sql_getactionslist($dbsql,$username,$limit,$skip) + +{ +$OPEP="gessql.php:sql_getactions"; + +$strlim=""; +$strskip=""; +$select=""; +if ($username!=NULL) + $select="where (smtpfrom like '%$username%') or (rcptto like '%username')"; +$strsel="Select * from actions $select order by creation asc"; +if ($limit!=NULL) + $strlim="limit $limit"; +if ($skip!=NULL) + $strskip="offset $skip"; +$stmt=$dbsql->Select("$strsel $strlim $strskip"); +return $stmt->fetchAll(); +} + ?> diff --git a/www/lvllog.php b/www/lvllog.php index cc08d95..cf86ae5 100644 --- a/www/lvllog.php +++ b/www/lvllog.php @@ -42,7 +42,7 @@ $STR = << Email: - + + Show diff --git a/www/lvlmai.php b/www/lvlmai.php index 1c01adc..fd36102 100644 --- a/www/lvlmai.php +++ b/www/lvlmai.php @@ -20,24 +20,75 @@ $start=starthtml(NULL); $stop=endhtml(); $top=topper($isadmin,$logname,"lvlmai"); $footer=footer("lvlmai"); -$cook="???"; -if (isset($_COOKIE[getenv("APPNAME")])==true) - $cook=$_COOKIE[getenv("APPNAME")]; + +$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); +$line=""; +$count=$offset; +foreach($actions as $action) { + $bgcolor="white"; + if ($count & 1 ) { + $bgcolor="green"; + } + $date=$action['creation']; + $smtpfrom=$action['smtpfrom']; + $emailfrom=$action['emailfrom']; + $emailfrom=str_replace("<","<",$emailfrom); + $emailfrom=str_replace(">",">",$emailfrom); + rou_alert(0,"JMPDBG <$emailfrom>"); + $recipient=$action['rcptto']; + $line=$line."\r\n"; + $line=$line."$count \r\n"; + $line=$line."$date\r\n"; + $line=$line."$smtpfrom\r\n"; + $line=$line."$emailfrom\r\n"; + $line=$line."$recipient\r\n"; + $line=$line.""; + $count++; + } +sql_close($dbsql); $STR = << -Within mailleur -
-LOGNAME=$logname -
-ADMIN=$isadmin -
-The cookies=$cook -
-
+ +
+ +
+ + + + + + + +$line +
DateSMTP OriginatorEmail FromRecipient
+ +

$footer $stop