From d29c222a15f8ceb5ab9a9ca2c4b205fcd861de47 Mon Sep 17 00:00:00 2001 From: Jean-Marc Pigeon Date: Mon, 8 Sep 2025 20:20:52 -0400 Subject: [PATCH] Button seems to be working --- www/devsql.php | 18 ++++++++++++++++++ www/directives.js | 10 +--------- www/gessql.php | 2 ++ www/lvlusr.php | 42 ++++++++++++++++++++++++++++++++++-------- 4 files changed, 55 insertions(+), 17 deletions(-) diff --git a/www/devsql.php b/www/devsql.php index a73995f..5e88526 100644 --- a/www/devsql.php +++ b/www/devsql.php @@ -124,5 +124,23 @@ function sql_query($conn,$reqst) $dbtype=getenv("DB_TYPE"); } +//============================================================== +// +// Function to return the number of record within a +// database table. +// +//============================================================== +function sql_getnumrec($dbsql,$table) + +{ +$OPEP="gessql.php:sql_getnumrec"; + +$recnum=NULL; +if ($dbsql!=NULL) { + $stmt=$dbsql->Select("Select count(*) from $table"); + $recnum=$stmt->fetchColumn(); + } +return $recnum; +} ?> diff --git a/www/directives.js b/www/directives.js index 50ecc1f..89d557f 100644 --- a/www/directives.js +++ b/www/directives.js @@ -1,14 +1,6 @@ // vim: smarttab tabstop=8 shiftwidth=2 expandtab //============================================================== -//function to update screen limit +//all system functions //============================================================== -function updatelimit() - -{ -let limitvalue=document.getElementById("limit-choice").value; -limitvalue*=10; -document.getElementById("demo").innerHTML = limitvalue; -window.location.reload(); -} diff --git a/www/gessql.php b/www/gessql.php index f83c303..80fe7cf 100644 --- a/www/gessql.php +++ b/www/gessql.php @@ -175,6 +175,8 @@ $strskip=""; $strsel="Select * from emails order by email 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/lvlusr.php b/www/lvlusr.php index 13e63ab..2e8123f 100644 --- a/www/lvlusr.php +++ b/www/lvlusr.php @@ -10,16 +10,39 @@ include_once "unienv.php"; include_once "gesdis.php"; include_once "gessql.php"; -function tblheader(int $limit) +function tblheader(int $numrec,int $offset,int $limit) { $STR = << -LEFT -

+ +
+ + +$offset/$numrec + + +
+
- @@ -42,14 +65,17 @@ global $isadmin; global $logname; $limit=20; +$scanner=$_POST['scanner']; +rou_alert(0,"JMPDBG scanner=$scanner"); $agent_id=$_POST['tbllim']; if ( $agent_id!=NULL) $limit=intval($agent_id); -rou_alert(0,"JMPDBG agent_id=$agent_id limit=$limit"); +$offset=2*$limit; $line=""; -$count=0; $dbsql=sql_connect(); -$emails=sql_getemaillist($dbsql,$limit,NULL); +$numrec=sql_getnumrec($dbsql,"emails"); +$emails=sql_getemaillist($dbsql,$limit,$offset); +$count=$offset; foreach($emails as $email) { $bgcolor="white"; if ($count & 1 ) { @@ -76,7 +102,7 @@ $start=starthtml("directives"); $stop=endhtml(); $top=topper($isadmin,$logname,"lvlusr"); $footer=footer("lvlusr"); -$tblheader=tblheader($limit); +$tblheader=tblheader($numrec,$offset,$limit); $STR = <<