Server IP : 162.241.126.129 / Your IP : 18.220.94.189 Web Server : Apache System : Linux 162-241-126-129.cprapid.com 4.18.0-477.27.2.el8_8.x86_64 #1 SMP Fri Sep 29 08:21:01 EDT 2023 x86_64 User : rvway5nu4 ( 1018) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/rvway5nu4/public_html/phplib/ |
Upload File : |
<?php session_start(); class Paging { var $sql; var $rs; var $numrows; var $limit; var $noofpage; var $offset; var $page; var $style; var $parameter; var $activestyle; var $buttonstyle; /* function Paging($query,$db) { $this->offset=0; $this->page=1; $this->sql=$query; $this->rs=$db->query($this->sql); $this->numrows=$db->num_rows($this->rs); } */ public function __construct() { $this->offset=0; $this->page=1; $this->sql=$query; $this->rs=$db->query($this->sql); $this->numrows=$db->num_rows($this->rs); } function getNumRows() { return $this->numrows; } function setLimit($no) { $this->limit=$no; } function getLimit() { return $this->limit; } function getNoOfPages() { return ceil($this->noofpage=($this->getNumRows()/$this->getLimit())); } function getPageNo() { $str=""; $str=$str."<table border=0 cellspacing=0 cellpadding=0 width=100%><tr>"; $str=$str."<td align='center' valign='top' colspan='2'>"; $str=$str."<form name='frmPage' action='".$_SERVER['PHP_SELF']."' method='get'>"; //$str=$str."<div class=navigationlinks>Go to Page : "; $str=$str."<div class=navigationlinks> "; $str=$str."<input type='hidden' name='category_id' value=".$_SESSION['category_id'].">"; $str=$str."<input type='hidden' name='i_id' value=".$_SESSION['category_id'].">"; $str=$str."<select name='page' id='page' class='".$this->getStyle()."' >"; for($i=1;$i<=$this->getNoOfPages();$i++) { if($i==$this->getPage()) { $str=$str."<option value='".$i."' selected>".$i."</option>"; } else { $str=$str."<option value='".$i."' >".$i."</option>"; } } $str=$str."</select>"; //$str=$str."Go to Page <input type='text' name='page' size='3' class='".$this->getStyle()."'> "; $param=split("[& =]",$this->getParameter()); for($i=2;$i<=count($param);$i=$i+2) { $str=$str."<input type='hidden' name='".$param[$i-1]."' value='".$param[$i]."'>"; } $str=$str." <input type='submit' width='40' height='30' src='../images/go.gif' name='btnGo' value='Go!' class='".$this->getButtonStyle()."'>"; $str=$str."</div>"; $str=$str."</form></td>"; $str=$str."</tr></table>"; return $str; } function getOffset($page) { if($page>$this->getNoOfPages()) { $page=$this->getNoOfPages(); } if($page=="") { $this->page=1; $page=1; } else { $this->page=$page; } if($page=="1") { $this->offset=0; return $this->offset; } else { for($i=2;$i<=$page;$i++) { $this->offset=$this->offset+$this->getLimit(); } return $this->offset; } } function getPage() { return $this->page; } function setStyle($style) { $this->style=$style; } function getStyle() { return $this->style; } function setActiveStyle($style) { $this->activestyle=$style; } function getActiveStyle() { return $this->activestyle; } function setButtonStyle($style) { $this->buttonstyle=$style; } function getButtonStyle() { return $this->buttonstyle; } function setParameter($parameter) { $this->parameter=$parameter; } function getParameter() { return $this->parameter; } } ?>