PK

ADDRLIN : /home/anibklip/aelogifts.com/cms/
FLL :
Current File : //home/anibklip/aelogifts.com/cms/product_reviews_view.php

<?php
if($_GET['saction']=="del" && $_GET['review_id']!=""){
	$q = "SELECT * from prd_reviews where review_id = '$_GET[review_id]'";
	$q = mysqli_query($GLOBALS["conn"], $q) or die(mysqli_error($GLOBALS["conn"]));
	if($r=mysqli_fetch_array($q)){
		$q1="DELETE from prd_reviews where review_id = '$_GET[review_id]'";
		mysqli_query($GLOBALS["conn"], $q1) or die(mysqli_error($GLOBALS["conn"]));

		$_SESSION['errmsg']="Record Deleted Successfully.";
		echo "<script>window.location.href='main.php?action=product_reviews_view';</script>";
		die;
	}
}

if($_SESSION['msg']){$msg=$_SESSION['msg']; unset($_SESSION['msg']);}
if($_SESSION['errmsg']){$errmsg=$_SESSION['errmsg']; unset($_SESSION['errmsg']);}
?>
<div class="content-wrapper">
	<!-- Content Header (Page header) -->
	<section class="content-header">
		<div class="container-fluid">
			<div class="row mb-2">
				<div class="col-sm-6">
					<h1>View Product Reviews</h1>
				</div>
				<div class="col-sm-6">
					<ol class="breadcrumb float-sm-right">
						<li class="breadcrumb-item"><a href="#">Home</a></li>
						<li class="breadcrumb-item active">View Product Reviews</li>
					</ol>
				</div>
			</div>
		</div><!-- /.container-fluid -->
	</section>

	<!-- Main content -->
	<section class="content">

		<div class="row">
			<div class="col-md-12">
				<?php if($msg){?><div class="alert alert-success"><strong>Success!</strong> <?php echo $msg;?></div><?php }?>
				<?php if($errmsg){?><div class="alert alert-danger"><strong>Error!</strong> <?php echo $errmsg;?></div><?php }?>
				
				<div class="card card-outline card-info">
					<!-- <div class="card-header">
						<h3 class="card-title">Body</h3>
					</div> -->
					<!-- /.card-header -->
					<!-- /.card-header -->
					<div class="card-body">
						<table id="example2" class="table table-striped table-bordered table-advance table-hover">
							<thead>
								<tr>
									<th width="5%" nowrap>Sr No</th>
									<th>Product</th>
									<th>Review</th>
									<th>Ratings</th>
									<th>Post By</th>
									<th>Image</th>
									<!-- <th>Details</th> -->
									<th style="text-align:center" width="150">Actions</th>
								</tr>
							</thead>
							<tbody>
								<?php
									if($_GET['per_page']){
										$noprd=$_GET['per_page'];
									}else{
										$noprd=50;
									}
									$cpage=$_REQUEST['page'];
									if ($cpage == 0){
										$cpage=1;
										$cnt=1;
									}else{
										$cnt=($cpage * $noprd) - $noprd + 1;
									}
									$frm=($cpage * $noprd) - $noprd;
									if($_GET['sort']!=""){
										$orderby=" order by $_GET[sort]";
									}else{
										$orderby=" order by review_id desc ";
									}
									
									$whr=1;
									if($_GET['keywrd']){
										$whr.=" and titl like '%$_GET[keywrd]%' ";
									}
									if($_GET['product_id']){
										$whr.=" and product_id='$_GET[product_id]' ";
									}
									//$query = "SELECT * from models m, prd_reviews mr where $whr and m.product_id=mr.product_id";
									$query = "SELECT * from prd_reviews mr where $whr ";
									$sql=$query;
									$query.=" $orderby LIMIT $frm, $noprd";
									//echo "$query<br />";
									$query = mysqli_query($GLOBALS["conn"], $query) or die (mysqli_error($GLOBALS["conn"]));
									while($row = mysqli_fetch_array($query)){
										$q="SELECT * from prd where pid='$row[product_id]' ";
										$q = mysqli_query($GLOBALS["conn"], $q) or die (mysqli_error($GLOBALS["conn"]));
										if($rr=mysqli_fetch_array($q)){
											$model=$rr['pname'];
										}
										?>
										<tr>
											<td><?php echo $cnt?></td>
											<td><?php echo $model;?></td>
											<td><?php echo $row['review'];?></td>
											<td><?php echo $row['ratings'];?></td>
											<td>
												<?php
												if(!$row['member_id']){
													?>
													<?php echo $row['postby'];?>
													<?php
												}else{
													echo $row['postby']." - ";
												}
												?> 
												(ID: <?php echo $row['member_id'];?>)
											</td>
											<td>
												<?php
												if($rr['pic1']){
													?>
													<img src="../products/<?php echo $rr['pic1'];?>" width="50" />
													<?php
												}
												?>
											</td>
											<!-- <td><?php //echo substr(strip_tags($row[details]),0,200);?>...</td> -->
											<td class="text-right">
												<a href="main.php?action=product_reviews_add&review_id=<?php echo $row['review_id']?>" class="btn btn-primary"><i class="fas fa-edit"></i></a>
												<a href="javascript:;" onclick="del('main.php?action=<?php echo $_GET['action']?>&saction=del&review_id=<?php echo $row['review_id']?>')" class="btn btn-danger"><i class="fas fa-solid fa-trash"></i></a>
											</td>
										</tr>
										<?php
										$cnt++;
									}
									?>
							</tbody>
						</table>
					</div>
					<!-- /.card-body -->
				</div>
			</div>
			<!-- /.col-->
		</div>
	</section>
	<!-- /.content -->
</div>


PK 99