MINI MINI MANI MO

Path : /home/phaetpan/domains/phaetpanya.com/public_html/vibharamadmin/
File Upload :
Current File : /home/phaetpan/domains/phaetpanya.com/public_html/vibharamadmin/service.php

<!doctype html>
<?php
	session_start();
	if($_SESSION['admin_id'] == "")
	{
		include("session.php");   
	}    

		include("connect.php");

		$strSQL = "SELECT * FROM admin WHERE admin_id = '".$_SESSION['admin_id']."'";
		$objQuery = mysqli_query($objCon,$strSQL);
		$objResult = mysqli_fetch_array($objQuery,MYSQLI_ASSOC); 
			
		if (isset($_POST['id'])) {
		
		$strSQL3 = "UPDATE service SET 
		status = '".$_POST["status"]."',admin_id = '".$_SESSION["admin_id"]."'
		WHERE service_id = '".$_POST["id"]."' ";
		$objQuery3 = mysqli_query($objCon,$strSQL3);
	}
?>
<html>
<head>
<?php include("assets/include/link.php"); ?>
</head>
<body>
<div class="wrapper">
     
        <?php include("nav-menu.php"); ?> 
    	 	
	<div class="main-panel">
		<?php include("assets/include/account.php"); ?>          
			<div class="content">
				<div class="container-fluid">
					<div class="row">
						<div class="col-md-12">
							<div class="card card-plain">
								<div class="header">
									<h4 class="title"><a href="service.php">Services</a></h4>
								</div>
										<?php
											$strSQL ="SELECT a.*, b.admin_id, b.username
											FROM service a
											LEFT JOIN admin b
											ON a.admin_id=b.admin_id";
											$objQuery = mysqli_query($objCon,$strSQL);
											$Num_Rows = mysqli_num_rows($objQuery);

											$Per_Page = 6;   // Per Page
									
											error_reporting( error_reporting() & ~E_NOTICE );
											$Page = $_REQUEST["Page"];
										
											if(!$_GET["Page"])
											{
												$Page=1;
											}

											$Prev_Page = $Page-1;
											$Next_Page = $Page+1;

											$Page_Start = (($Per_Page*$Page)-$Per_Page);      
											if($Num_Rows<=$Per_Page)
											{
												$Num_Pages =1;
											}
											else if(($Num_Rows % $Per_Page)==0)
											{
												$Num_Pages =($Num_Rows/$Per_Page) ;
											}
											else
											{
												$Num_Pages =($Num_Rows/$Per_Page)+1;
												$Num_Pages = (int)$Num_Pages;
											}

											$strSQL .=" order  by service_id DESC LIMIT $Page_Start , $Per_Page";
											$objQuery  = mysqli_query($objCon,$strSQL);
										?>
										<div class="content table-responsive table-full-width">      
											<a href="add_service.php">
												<button type="button" rel="tooltip" class="btn btn-info btn-simple btn-icon">      
													<i class="fa fa-plus-circle"></i> Add Service
												</button>
											</a>
											<table class="table table-hover">    
												<thead>
													<th style="width:15%;">Images</th>  
													<th style="width:15%;">Icons</th>  
													<th style="width:25%;">Service (TH)</th>  
													<th style="width:10%;">Status</th>  
													<th style="width:10%;"><div align="center">Last Modified</div></th>      
													<th style="width:25%;"><div align="center">Manage</div></th>
												</thead>
											<?php
											while($objResult = mysqli_fetch_array($objQuery,MYSQLI_ASSOC))
												{ 
											?>
												<tbody>
													<tr>
														<td><img src="../upload_file/<?php echo $objResult["img"];?>" alt="image" height="85"/></td>  
														<td><i class="<?php echo $objResult["icon"];?>"></i> <?php echo $objResult["icon"];?></td>  
														<td><?php echo $objResult["service1"];?></td>  
														<td>
															<input type="checkbox" id="<?php echo $objResult["service_id"]; ?>" class="toggle-event" name="<?php echo $objResult["service_id"]; ?>" data-size="small"
															<?php $status = $objResult["status"];?>
															<?php if ($status == '1') { echo "checked"; } ?> data-toggle="toggle" data-on="On" data-off="Off" data-onstyle="primary" data-offstyle="default">
														</td>  
														<td><div align="center"><?php echo $objResult["username"];?></div></td>  
														<td>
															<div align="center">
															<a href="add_servicepic.php?service_id=<?php echo $objResult['service_id'];?>">
																<button type="button" rel="tooltip" class="btn btn-default btn-simple btn-icon" title="เพิ่มรูปภาพ">      
																	<i class="fa fa-rss-square"></i> Blog
																</button>
															</a>
															<button type="button" rel="tooltip" class="btn btn-default btn-sm btn-simple" onclick="window.location.href='edit_service.php?service_id=<?php echo $objResult['service_id'];?>'" title="แก้ไขข้อมูล">
																<i class="fa fa-pencil-square" aria-hidden="true"></i> Edit
															</button>
															<?php
																	
																	$strSQL3 = "SELECT * FROM service_pic WHERE service_id ='".$objResult["service_id"]."'";   
																	$objQuery3 = mysqli_query($objCon,$strSQL3);
																	$objResult3 = mysqli_fetch_array($objQuery3,MYSQLI_ASSOC); 
																	
															?>
															<?php 
															if($objResult3["pic"] == "")  
															{
																?>
																	<a href="JavaScript:if(confirm('Are you sure you want to delete this item ?')==true){window.location='deleteservice.php?service_id=<?php echo $objResult['service_id'];?>&img=<?php echo $objResult["img"];?>'}">
																		<button type="button" rel="tooltip" class="btn btn-danger btn-simple btn-icon" title="ลบข้อมูล">  
																			<i class="fa fa-window-close" aria-hidden="true"></i> Remove 
																		</button>
																	</a>
																<?php
															}else{
																?>
																	<a href="JavaScript:if(confirm('Are you sure you want to delete this item ?')==true){window.location='deleteservice.php?service_id=<?php echo $objResult['service_id'];?>&img=<?php echo $objResult["img"];?>'}">
																		<button type="button" rel="tooltip" class="btn btn-danger btn-simple btn-icon" disabled>  
																			<i class="fa fa-window-close" aria-hidden="true"></i> Remove 
																		</button>
																	</a>
																<?php
																}
															?>
															</div>     
														</td>
													</tr>
												</tbody>
											<?php
												}
											?>
											</table>
											<table class="table">    
												<tr><td> </td></tr>      
											</table>   
											</div>
											<nav aria-label="Page navigation">
												<ul class="pagination">
												<?php
													if($Prev_Page)
													{
														echo "<li><a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page' aria-label='Previous'><span aria-hidden='true'>&laquo;</span></a></li>";
													}

													for($i=1; $i<=$Num_Pages; $i++){
														if($i != $Page)
														{
															echo "<li><a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a></li>";
														}
														else
														{
															echo "<li class='active'><a> $i </a></li>";
														}
													}
													if($Page!=$Num_Pages)
													{
														echo "<li><a href='$_SERVER[SCRIPT_NAME]?Page=$Next_Page' aria-label='Next'><span aria-hidden='true'>&raquo;</span></a></li>";
													}
												?>
												</ul>
											</nav>
										</div>
							</div>
						</div>
					</div>
				</div>
			</div>
	</div>
</div>
</body>
<?php include("assets/include/script.php"); ?>
<?php include "texteditor.php"; ?>
</html>
<?php 
	mysqli_close($objCon);
?>

OHA YOOOO