MOON
Server: Apache
System: Linux ip-208-109-13-31.ip.secureserver.net 3.10.0-1160.119.1.el7.tuxcare.els4.x86_64 #1 SMP Sat Aug 31 06:58:57 UTC 2024 x86_64
User: durgeshpandey215 (1013)
PHP: 8.1.29
Disabled: NONE
Upload Files
File: /home/durgeshpandey215/public_html/zeeroprice.skilladders.com/admin/categories.php
<? require "../application_top.php";
require('protect-admin.php');
$searchkey = isset($_REQUEST['key'])? $_REQUEST['key'] : "";
if(isset($_REQUEST['catname'])){
	$insertdata = array(
		'catname'=> $_REQUEST['catname']
	);
	$db->insert('categories',$insertdata);
	$_SESSION['msg'] = "Category added successfully";
	header('location:'.$_SERVER["HTTP_REFERER"]);exit;
}
$pagename="categories"; 
require "header.php";?>
	<?
	if($searchkey){
	$db->where('catname','%'.$searchkey.'%','like');
	}
	$db->where('catid',0,'>');
	$db->orderBy('catname','desc');
	
	//---------------Paginate BOF---------------------------------------
	$paginatetable = 'categories'; //table name
	$extra ="key="; //use '&' in between if more than 1 parameter
	$adjacents = 2;
	$limit = 30;		//how many items to show per page
	$db->pageLimit = $limit;
	$targetpage = $_SERVER['PHP_SELF']; //your file name  (the name of this file)
	require "../paginate.php";
	//------------------------------------------------------------------			
		?>
		
		<div class="w3-row">
			<div class="w3-col m12">
			<h1>Categories</h1>
			<div style="margin:0 auto;max-width:400px;margin-bottom:20px;">
			<form action="<?=$_SERVER['PHP_SELF'];?>" method="post" id="commonform">
			<input type="text" name="catname" class="w3-border w3-padding" required placeholder="New Category Name" style="max-width:250px;"/>
			<input type="submit" name="sub" value="SAVE" class="w3-btn w3-black"/>
			</form>
			</div>
			<div style="float:right;">
			<a href="subcategories.php" class="w3-btn w3-blue w3-border">+ Add Subcategory</a>
			</div>
			
			<?
			if($total_rows){ 
			?>	Total <?=$total_rows;?> categories
				<table class="w3-table-all">
				<tr class="w3-dark-gray">
					<th>Category Name</th>
					<th>Manage</th>
				</tr>
				<?foreach($rows as $row){
				?>
				<tr class="odd">
					<td> <?=$row['catname'];?></td>
					<td align="center">
						<a href="<?=HTTP_SERVER;?>admin/handle.php?action=catistatus&id=<?=encode($row['catid']);?>&newstatus=<?=($row['istatus'])? 0 : 1;?>" title="Click to <?=($row['istatus'])? "Deactivte" : "Activate";?> "><img src="<?=HTTP_SERVER;?>/images/icons/istatus-<?=($row['istatus'])? "on" : "off";?>.png" border="0" class="icons"/></a>&nbsp;
						<a href="<?=HTTP_SERVER;?>admin/category-edit.php?catid=<?=encode($row['catid']);?>" class="icon"><img src="<?=HTTP_SERVER;?>images/icons/edit.png" border="0" class="icons"/></a>&nbsp;
						<a href="<?=HTTP_SERVER;?>admin/handle.php?action=catdel&id=<?=encode($row['catid']);?>" title="Click to Delete" onclick="return confirm('Are you sure you want to delete?')"><img src="<?=HTTP_SERVER;?>images/icons/delete.png" border="0" class="icons"/></a>
					</td>					
				</tr>
				<?}?>
				</table>
				<center><?=$pagination;?></center>
			<? } ?>
			<br/><br/>
			</div>
		</div>
<? require "../footer.php";?>