MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 3.145.33.230
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/pccaterers.in/admin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/ppcad7no/pccaterers.in/admin/addedit-header-flash.php
<?php
require_once("../includes/dbsmain.inc.php");
ob_start();
$header_flash_id=$_REQUEST['header_flash_id'];
if(is_post_back()){
//*************** UPDATE EXISTING CATEGORY START ************************//
if($_REQUEST['header_flash_id']!='') {

 	$imgName =$_FILES["file"]["name"];
	$uploadedfile = $_FILES['file']['tmp_name']; 
 	if ($imgName) { //**** Change Duplicate Image name Start Here****//
		 $ext = substr($imgName, strrpos($imgName, "."));		 
		 $imageDupli = db_scalar("select count(*) from tbl_header_flash where 1 and header_flash_image_name='$imgName'"); 
		 if($imageDupli > 0){
		  $imgName = basename($imgName, $ext);
		  $imgName = basename($imgName, $ext) . rand(1,1000) . $ext;
		   move_uploaded_file($_FILES['file']['tmp_name'],"../flash_images/$imgName");
		 }else{
		  $imgName = $imgName;
		   move_uploaded_file($_FILES['file']['tmp_name'],"../flash_images/$imgName");
		 }
		 //**** Change Duplicate Image name End Here****//
		
	 }else{
$imgName=db_scalar("select header_flash_image_name from tbl_header_flash where 1 and header_flash_id = '$header_flash_id'");
}

////////////****************** IMAGE RESIZING END HERE *****************************//
$sql = "update tbl_header_flash set        
				header_flash_title='$header_flash_title',
				header_flash_description='$header_flash_description',
				header_flash_image_name='$imgName',
				header_flash_link='$header_flash_link',
				header_flash_brand_name='$header_flash_brand_name',
				header_flash_type='Main', 	
				header_flash_add_date=now(),
				header_flash_status='$header_flash_status'
				where header_flash_id = '$header_flash_id' ";

db_query($sql);
set_session_msg("Header Updated Successfully !");
header("Location:addedit-header-flash.php?header_flash_id=$_REQUEST[header_flash_id]");
exit;
//*************** UPDATE EXISTING CATEGORY END ************************//
}else{

$imgName =$_FILES["file"]["name"];
	$uploadedfile = $_FILES['file']['tmp_name']; 
 	if ($imgName) { //**** Change Duplicate Image name Start Here****//
		 $ext = substr($imgName, strrpos($imgName, "."));		 
		 $imageDupli = db_scalar("select count(*) from tbl_header_flash where 1 and header_flash_image_name='$imgName'"); 
		 if($imageDupli > 0){
		  $imgName = basename($imgName, $ext);
		  $imgName = basename($imgName, $ext) . rand(1,1000) . $ext;
		   move_uploaded_file($_FILES['file']['tmp_name'],"../flash_images/$imgName");
		 }else{
		  $imgName = $imgName;
		   move_uploaded_file($_FILES['file']['tmp_name'],"../flash_images/$imgName");
		 }
		 //**** Change Duplicate Image name End Here****//
		
	 }

////////////****************** IMAGE RESIZING END HERE *****************************//
$sql = "insert into tbl_header_flash set 
                header_flash_title='$header_flash_title',
				header_flash_description='$header_flash_description',
				header_flash_image_name='$imgName',
				header_flash_link='$header_flash_link',
				header_flash_type='Main', 					
				header_flash_brand_name='$header_flash_brand_name', 	
				header_flash_add_date=now(),
				header_flash_status='$header_flash_status'";

db_query($sql);
set_session_msg("Header Added Successfully !");
header("Location:addedit-header-flash.php");
exit;
//*************** INSERT NEW CATEGORY END ************************//
 }
}

if($header_flash_id!='') {
	$result = db_query("select * from tbl_header_flash where header_flash_id = '$header_flash_id'");
	if ($line_raw = mysqli_fetch_array($result)) {
	 @extract($line_raw);
	}
}
?>
<script src="ckeditor/ckeditor.js"></script>
<style>
p.fck {
    width: 90%;
	float:left;
    margin: 0 auto;
 }
</style>
<link href="styles.css" rel="stylesheet" type="text/css">
<?php include("top.inc.php");?>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td id="pageHead"><div id="txtPageHead">Add/Edit Header Flash</div></td>
              </tr>
            </table>
            <div align="right"><a href="manage-header-flash.php" style="font-size:12px; font-weight:bold; margin-right:15px;">Back to Header Flash List</a>&nbsp;</div>
            <form name="form1" method="post" enctype="multipart/form-data">
              <table width="95%"  border="0" align="center" cellpadding="0" cellspacing="0" class="tableForm">
                <tr>
                  <td width="20%" class="tdLabel">&nbsp;</td>
                  <td width="80%" class="tdData" style="padding-left:7px;"><strong><font color="green">
                    <?=display_sess_msg();?>
                    </font></strong></td>
                </tr>
				<tr>
                  <td width="20%" class="tdLabel" style="font-size:12px; padding:7px;">Brand Name :</td>
                  <td width="80%" class="tdData" style="font-size:12px; padding:7px;"><input name="header_flash_brand_name" style="width:350px; height:28px;" type="text" id="header_flash_brand_name"  value="<?=$header_flash_brand_name?>" class="textfield"  ></td>
                </tr>
				
              
                <?php if($header_flash_image_name){ ?>
                <tr>
                  <td width="177" class="tdLabel" style="font-size:12px; padding:5px;">Current Image  :</td>
                  <td width="721" class="tdData" style="font-size:12px; padding:5px;"><img src="../flash_images/<?=$header_flash_image_name?>" height="70" width="70"  border="0" /> </td>
                </tr>
                <? } ?>
                <tr>
                  <td class="tdLabel" style="font-size:12px; padding:5px;">Flash Image :</td>
                  <td class="tdData" style="font-size:12px; padding:5px;"><input type="file" name="file" id="file" /></td>
                </tr>
				<tr>
                  <td width="20%" class="tdLabel" style="font-size:12px; padding:7px;">Flash Description :</td>
                  <td width="80%" class="tdData" style="font-size:12px; padding:7px;"><textarea name="header_flash_description" style="width:350px;" rows="6" id="header_flash_description" class="textfield"><?=$header_flash_description?></textarea></td>
                </tr>
				
                <tr>
                  <td class="tdLabel" style="font-size:12px; padding:7px;">Status:</td>
                  <td class="tdData" style="font-size:12px; padding:7px;"><select name="header_flash_status" style="width:350px; height:26px;">
                      <option value="Active" <?php if($header_flash_status=='Active'){ ?> selected="selected" <? } ?>>Active</option>
                      <option value="Inactive" <?php if($header_flash_status=='Inactive'){ ?> selected="selected" <? } ?>>Inactive</option>
                    </select></td>
                </tr>
                <tr>
                  <td class="tdLabel" style="font-size:12px; padding:7px;">&nbsp;</td>
                  <td class="tdData" style="font-size:12px; padding:7px;">
                    <input type="image" name="imageField" src="images/buttons/submit.gif" style="width:100px; margin-bottom:25px;" /></td>
                </tr>
              </table>
            </form>
            <? include("bottom.inc.php");?>

MMCT - 2023