MMCT TEAM
Server IP : 103.191.208.50  /  Your IP : 216.73.216.53
Web Server : LiteSpeed
System : Linux orion.herosite.pro 4.18.0-553.53.1.lve.el8.x86_64 #1 SMP Wed May 28 17:01:02 UTC 2025 x86_64
User : celkcksm ( 1031)
PHP Version : 7.4.33
Disable Function : show_source, system, shell_exec, passthru, popen, exec
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/celkcksm/demoadmin.ncriptech.com/../bmtrust.org.in/admin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/celkcksm/demoadmin.ncriptech.com/../bmtrust.org.in/admin/image_of_gallery.php
<?php 
include("include/header.php");
include("include/sidebar.php");
if(!empty($_REQUEST['idid'])){
	$deleteQ=mysqli_query($con,"select image from image_of_gallery where id='".$_REQUEST['idid']."'");
	unlink("images/".$deleteR['image']);
	mysqli_query($con,"delete from image_of_gallery where id='".$_REQUEST['idid']."'");
	$_SESSION['msg']="Image deleted";
	echo '<META HTTP-EQUIV="Refresh" Content="0; URL=image_of_gallery.php">';
	exit;
}
if(!empty($_REQUEST['did'])){
	$deleteQ=mysqli_query($con,"select image from image_of_gallery where gallery_id='".$_REQUEST['did']."'");
	while($deleteR=mysqli_fetch_array($deleteQ)){
		unlink("images/".$deleteR['image']);
	}
	mysqli_query($con,"delete from gallery where id='".$_REQUEST['did']."'");
	mysqli_query($con,"delete from image_of_gallery where gallery_id='".$_REQUEST['did']."'");
	$_SESSION['msg']="Gallery deleted";
	echo '<META HTTP-EQUIV="Refresh" Content="0; URL=image_of_gallery.php">';
	exit;
}
$dovalue="ImageofGallery";
$doid=''; 
?>
<style>
    #loader{
        display:none;
        position:fixed;
        z-index:1000;
        top:0;
        left:0;
        width:100%;
        height:100%;
        background-image:url(images/uploads/loader.gif);
        background-position:50% 50%;
        background-color:rgba(255,255,255,0.6);
        background-repeat:no-repeat;
    }
    body.loading{
        overflow:hidden;
    }
    body.loading #loader{
        display:block;
    }
</style>
<div id="loader"></div>
<link rel="stylesheet" href="bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css">
<div class="content-wrapper">
  <!-- Content Header (Page header) -->
  <section class="content-header">
    <h1>Gallery <small></small> </h1>
    <ol class="breadcrumb">
      <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
      <li><a href="#">Gallery</a></li>
    </ol>
  </section>
  <!-- Main content -->
  <section class="content container-fluid">
    <div class="row">
      <div class="col-md-12">
	   <?php
            if(!empty($_SESSION['msg'])){
        ?>
        <div class="alert alert-success alert-dismissible">
            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
            <h4><i class="icon fa fa-circle"></i> Message:</h4>
            <?=$_SESSION['msg'];?>
        </div>
        <?php
            $_SESSION['msg']="";
            }
        ?>
        <div class="box box-info">
          <div class="box-header">
            <h3 class="box-title">Gallery <small></small></h3>
            <!-- tools box -->
            <div class="pull-right box-tools">
              <button class="btn btn-info btn-sm" data-widget="collapse" data-toggle="tooltip" title="Collapse"><i class="fa fa-minus"></i></button>
              <button class="btn btn-info btn-sm" data-widget="remove" data-toggle="tooltip" title="Remove"><i class="fa fa-times"></i></button>
            </div>
            <!-- /. tools --> 
          </div>
          <!-- /.box-header -->
          <div class="box-body pad">
            <div class="col-md-8">
              <form method="post" action="action.php" enctype="multipart/form-data" role="form">
                <input type="hidden"  name="do" value="<?php echo $dovalue;?>" />
		<div id="image_box">
			<div class="row">
			    <div class="col-md-6">
			        <div class="form-group">
			            <label>Select Gallery Name</label>
			            <select class="form-control" name="gallery_id">
			                <option value="">--Select Gallery Name--</option>
			                <?php $query=mysqli_query($con,"select * from gallery");
			                    while($row=mysqli_fetch_array($query)){?>
			                    <option value="<?=$row['id'];?>"><?=$row['name'];?></option>
		                    <?php } ?>
			            </select>
			        </div>
                    <div class="form-group">
                      <label for="image[]" class="col-sm-5 control-label">Choose Photo:</label>
                        <input type="file" name="image[]" accept="image/*" required />
                    </div>                                               
                </div> 
             </div>
			<!--Add Content here-->
		</div>
                <div class="box-footer">
                  <input type="submit" class="btn btn-primary" value="Save"/>
                  <input type="reset" value="Reset" class="btn btn-primary">
					<button type="button" class="btn btn-success" id="add">+ More Images </button>
                </div>
              </form>
            </div>
          </div>
        </div>
        <!-- /.box --> 
      </div>
      <!-- /.col--> 
    </div>
    <!-- ./row --> 
  </section>
  <!-- /.content -->
  <section class="content">
    <div class="row">
      <div class="col-xs-12">
        <div class="box">
          <div class="box-header">
            <h3 class="box-title">Gallery Report</h3>
          </div>
          <!-- /.box-header -->
          <div class="box-body table-responsive">
            <table id="example1" class="table table-bordered table-striped">
              <thead>
              <tr>                   
                    <th scope="col">Sr no</th>
                    <th scope="col">Gallery Name</th>
                    <th scope="col">Images</th>
                    <th scope="col">Action</th>
                  </tr>                
              </thead>
              <tbody> 
                <?php $q=mysqli_query($con,"select id,name from gallery");
			  		$i = 1;
	  				  while($r=mysqli_fetch_array($q)){ 
				  		$pathQ=mysqli_query($con,"select image,id from image_of_gallery where gallery_id='".$r['id']."'");
				  ?>
                <tr>
			
                  <td><?php echo $i; ?></td>
					<td><?=$r['name'];?>
                  <td> <?php while($pathR=mysqli_fetch_array($pathQ)){ ?>
					  <img width="50px" height="50px" src="images/<?=$pathR['image'];?>" /> <a href="image_of_gallery.php?idid=<?=$pathR['id'];?>" onclick="return confirm_click();"><i class="fa fa-close text-red"></i><br/>
					  <?php
						}
					  ?>
					</td>
					<td>
						<a href="image_of_gallery.php?did=<?=$r['id'];?>" onclick="return confirm_click();"><i class="fa fa-close text-red"></i></a>
					</td>
                </tr>
                <?php $i++;} ?>
              </tbody>
            </table>
          </div>
          <!-- /.box-body --> 
        </div>
        <!-- /.box --> 
      </div>
      <!-- /.col --> 
    </div>
    <!-- /.row --> 
  </section>
</div>
<?php include('include/footer.php');?>

<!-- DataTables -->
<script src="bower_components/datatables.net/js/jquery.dataTables.min.js"></script>
<script src="bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>

<script  type="text/javascript">
$(document).ready(function() {
    $('#example1').DataTable({
      'paging'      : true,
      'lengthChange': true,
      'searching'   : true,
      'ordering'    : true,
      'info'        : true,
      'autoWidth'   : true
    });
	$("#add").click(function(){
		$("#image_box").append("<div class='row'>"+
          		"<div class='col-md-5'>"+
                "<div class='form-group'>"+
                  "<label for='image[]' class='col-sm-6 control-label'>Choose Photo:</label>"+
                    "<input type='file' name='image[]' accept='image/*' required />"+
                "</div>"+                                               
                "</div>"+
				"<div class='col-md-1'><button type='button' class='btn btn-danger close_btn' style='margin-top:20px;'>X</button></div>"+
             "</div>");
	});
	$(document).on('click','.close_btn',function(){
		$(this).parent().parent().remove();
	});
} );
</script>

MMCT - 2023