]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Button seems to be working
authorJean-Marc Pigeon <jmp@safe.c>
Tue, 9 Sep 2025 00:20:52 +0000 (20:20 -0400)
committerJean-Marc Pigeon <jmp@safe.c>
Tue, 9 Sep 2025 00:20:52 +0000 (20:20 -0400)
www/devsql.php
www/directives.js
www/gessql.php
www/lvlusr.php

index a73995f59f8ea64ae1b6862e623b3fa8e522d677..5e88526d3eea5f9a393818aa307d9c7b2d1ce3d4 100644 (file)
@@ -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;
+}
 
 ?>
index 50ecc1f67581e9ab5ae8916417bbe1d906a674e6..89d557f8f02b8b58464e0789e7d417271340766a 100644 (file)
@@ -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();
-}
 
index f83c303146ce787bf45f757b00b1f9db360300ca..80fe7cf4e4d88befb25980a8488664b15a836032 100644 (file)
@@ -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();
 }
index 13e63ab622a9112a3112726d93ebb08ee580a833..2e8123f7aaa036e8a3a76c8cd4aa4096f4273280 100644 (file)
@@ -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  = <<<EOT
 <TR>
-<TH align=left>LEFT</TH>
-<TD align=center> <p id="demo"></p> </TD>
+<TH align=left>
+<FORM action="lvlusr.php" method="post">
+<button name="scanner" value="gottop">
+<FONT SIZE=+3>
+&larrb;
+</FONT>
+</Button>
+<button name="scanner" value="rewind">
+<FONT SIZE=+3>
+&larr;
+</FONT>
+</Button>
+<FONT SIZE=+2>$offset/$numrec</FONT>
+<button name="scanner" value="forward">
+<FONT SIZE=+3>
+&rarr;
+</FONT>
+</Button>
+<button name="scanner" value="golast">
+<FONT SIZE=+3>
+&rarrb;
+</FONT>
+</Button>
+</FORM>
+</TH>
 <TD align=right>
 <FORM method="post">
-<select name="tbllim" onchange='if(this.value!=0) {this.form.submit();}'>
+<select name="tbllim" onchange='if (this.value!=0) {this.form.submit();}'>
 <option selected="selected">$limit</option>
 <option value=20>20</option>
 <option value=40>40</option>
@@ -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  = <<<EOT
 $start