| Server IP : 192.169.170.185 / Your IP : 216.73.216.97 Web Server : Apache System : Linux p3plmcpnl495852.prod.phx3.secureserver.net 4.18.0-553.52.1.lve.el8.x86_64 #1 SMP Wed May 21 15:31:29 UTC 2025 x86_64 User : akhilnew ( 1712764) PHP Version : 5.6.40 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/akhilnew/public_html/ |
Upload File : |
<?php
require_once('header.php');
$productsubjects = productsubjects('Book');
echo <<<EOJ
<div class="row head main"><div class="col s12 m12 l12 center-align"><h1>{$pagetitle}</h1></div></div>
{$page_content}
<div class="row">
<div class="col s12 m12 l3 hide-on-med-and-down sidebar">
<ul class="collection"><li class="collection-item main">Browse By Subject</li>{$productsubjects}</ul>
</div>
<div class="col s12 m12 l9">
EOJ;
$pagenumber = isset($_GET['page']) ? strip_tags($fn->remaspace($fn->sanitize($fn->escape($_GET['page'])))) : null;
$limit = 16;
$start = $pagenumber ? ($pagenumber - 1) * $limit : 0;
$subject = str_replace('-', ' ', $option1);
if($subject):
$both = "%,$subject,%";$left = "%,$subject";$right = "$subject,%";$none = $subject;
$stmt = $mysqli->prepare("SELECT productid, title, volume, image, link FROM products WHERE (subject LIKE ? OR subject LIKE ? OR subject LIKE ? OR subject LIKE ?) AND (category = 'Book' AND status = 'enabled') ORDER BY productid DESC") or die('An error occurred. Please try after some time.');
$stmt->bind_param('ssss', $both, $left, $right, $none);
else:
$stmt = $mysqli->prepare("SELECT productid, title, volume, image, link FROM products WHERE (category = 'Book' AND status = 'enabled') ORDER BY productid DESC LIMIT $start, $limit") or die('An error occurred. Please try after some time.');
endif;
$stmt->execute();
$stmt->store_result();
if($stmt->num_rows() > 0):
echo '<div class="row books">';
$stmt->bind_result($id, $title, $volume, $image, $link);
while($stmt->fetch()):
if(!$image || !file_exists($uploadpath.$image)):
$image = 'product-ico.png';
endif;
$volume = $volume ? ' (Volume - '.$volume.')' : '';
echo '<div class="col s6 m3 l3 book">';
echo '<a href="'.$baseurl.'products/'.$id.'/'.$link.'" title="'.$title.$volume.'" class="center-align"><img src="'.$imageurl.$image.'" alt="'.$title.$volume.'" title="'.$title.$volume.'" width="193" height="269" /><br clear="all">'.$title.$volume.'</a>';
echo '</div>';
endwhile;
echo '</div>';
endif;
$stmt->close();
$stmt = $mysqli->prepare("SELECT * FROM products WHERE (category = 'Book' AND status = 'enabled')") or die('An error occurred. Please try after some time.');
$stmt->execute();
$stmt->store_result();
$totalpages = $stmt->num_rows();
$stmt->close();
if($pagenumber == 0):
$pagenumber = 1;
endif;
$mainurl = $baseurl.'books';
$stages = 3;
$prev = $pagenumber - 1;
$next = $pagenumber + 1;
$lastpage = ceil($totalpages / $limit);
$lastpagem1 = $lastpage - 1;
$paginate = '';
if($lastpage > 1):
$paginate .= '<div class="fluid pagination">';
if($pagenumber > 1):
$paginate .= '<a href="'.$mainurl.'?page='.$prev.'">Previous</a>';
else:
$paginate .= '<span class="grey-text">Previous</span>';
endif;
if($lastpage < 7 + ($stages * 2)):
for($counter = 1; $counter <= $lastpage; $counter++):
if($counter == $pagenumber):
$paginate .= '<span class="blue accent-3 white-text">'.$counter.'</span>';
else:
$paginate .= '<a href="'.$mainurl.'?page='.$counter.'">'.$counter.'</a>';
endif;
endfor;
elseif($lastpage > 5 + ($stages * 2)):
if($pagenumber < 1 + ($stages * 2)):
for($counter = 1; $counter < 4 + ($stages * 2); $counter++):
if($counter == $pagenumber):
$paginate .= '<span class="blue accent-3 white-text">'.$counter.'</span>';
else:
$paginate .= '<a href="'.$mainurl.'?page='.$counter.'">'.$counter.'</a>';
endif;
endfor;
$paginate .= '<b>...</b>';
$paginate .= '<a href="'.$mainurl.'?page='.$lastpagem1.'">'.$lastpagem1.'</a>';
$paginate .= '<a href="'.$mainurl.'?page='.$lastpage.'">'.$lastpage.'</a>';
elseif($lastpage - ($stages * 2) > $pagenumber && $pagenumber > ($stages * 2)):
$paginate .= '<a href="'.$mainurl.'?page=1">1</a>';
$paginate .= '<a href="'.$mainurl.'?page=2">2</a>';
$paginate .= '<b>...</b>';
for($counter = $pagenumber - $stages; $counter <= $pagenumber + $stages; $counter++):
if($counter == $pagenumber):
$paginate .= '<span class="blue accent-3 white-text">'.$counter.'</span>';
else:
$paginate .= '<a href="'.$mainurl.'?page='.$counter.'">'.$counter.'</a>';
endif;
endfor;
$paginate .= '<b>...</b>';
$paginate .= '<a href="'.$mainurl.'?page='.$lastpagem1.'">'.$lastpagem1.'</a>';
$paginate .= '<a href="'.$mainurl.'?page='.$lastpage.'">'.$lastpage.'</a>';
else:
$paginate .= '<a href="'.$mainurl.'?page=1">1</a>';
$paginate .= '<a href="'.$mainurl.'?page=2">2</a>';
$paginate.= '<b>...</b>';
for($counter = $lastpage - (2 + ($stages * 2)); $counter <= $lastpage; $counter++):
if($counter == $pagenumber):
$paginate .= '<span class="blue accent-3 white-text">'.$counter.'</span>';
else:
$paginate .= '<a href="'.$mainurl.'?page='.$counter.'">'.$counter.'</a>';
endif;
endfor;
endif;
endif;
if($pagenumber < $counter - 1):
$paginate .= '<a href="'.$mainurl.'?page='.$next.'">Next</a>';
else:
$paginate .= '<span class="grey-text">Next</span>';
endif;
$paginate .= '</div>';
endif;
if(empty($subject)): echo $paginate; endif;
echo <<<EOJ
</div>
<div class="col s12 m12 l3 show-on-medium-and-down sidebar" style="display:none">
<ul class="collection"><li class="collection-item main">Browse By Subject</li>{$productsubjects}</ul>
</div>
</div>
EOJ;
require_once('footer.php');
?>