<?php
ob_start(); // Start output buffering
//session_start();
include_once("../includes/main.inc.php");
$headerTitleName = "Add New Services";

$page_id = $_REQUEST['page_id'];
$country_name = isset($country_name) ? addslashes($country_name) : '';
$parent_childs = isset($parent_childs) ? addslashes($parent_childs) : '';
$title = isset($title) ? addslashes($title) : '';
$description = isset($description) ? addslashes($description) : '';
$keyword = isset($keyword) ? addslashes($keyword) : '';
$country_title = isset($country_title) ? addslashes($country_title) : '';
$country_descriptions = isset($country_descriptions)? addslashes($country_descriptions): '';
$country_descriptions1 = isset($country_descriptions1)? addslashes($country_descriptions1): '';
$country_descriptions2 = isset($country_descriptions2)? addslashes($country_descriptions2): '';
$conclusion = isset($conclusion)? addslashes($conclusion): '';


	
if(is_post_back()) {

	if($page_id!='') {
	   // print_r($_POST);exit();
$country_name = $_POST['country_name'] ?? '';
$parent_childs = isset($_POST['parent_childs']) ? intval($_POST['parent_childs']) : 0;
if($parent_childs=='0'){
    $country_url=' ';
}
$country_status = $_POST['country_status'] ?? '0'; // Default to '0' (Inactive)
$title = $_POST['title'] ?? '';
$description = $_POST['description'] ?? '';
$keyword = $_POST['keyword'] ?? '';
$country_title =$_POST['country_title'] ?? '';
$category='Metal';
//$country_url =$_POST['country_url'] ?? '';
//$GLOBALS['dbcon'];
$country_descriptions = isset($_POST['country_descriptions']) 
    ? mysqli_real_escape_string(
        $GLOBALS['dbcon'],
        str_replace(["\r", "\n"], ' ', stripslashes($_POST['country_descriptions']))
    ) 
    : '';
$country_descriptions1 = isset($_POST['country_descriptions1']) 
    ? mysqli_real_escape_string(
        $GLOBALS['dbcon'],
        str_replace(["\r", "\n"], ' ', stripslashes($_POST['country_descriptions1']))
    ) 
    : '';
    
    $country_descriptions2 = isset($_POST['country_descriptions2']) 
    ? mysqli_real_escape_string(
        $GLOBALS['dbcon'],
        str_replace(["\r", "\n"], ' ', stripslashes($_POST['country_descriptions2']))
    ) 
    : '';
     $conclusion = isset($_POST['conclusion']) 
    ? mysqli_real_escape_string(
        $GLOBALS['dbcon'],
        str_replace(["\r", "\n"], ' ', stripslashes($_POST['conclusion']))
    ) 
    : '';
/*$question1 = $_POST['question1'] ?? '';
$question2 = $_POST['question2'] ?? '';
$question3 = $_POST['question3'] ?? '';
$question4 = $_POST['question4'] ?? '';
$question5 = $_POST['question5'] ?? '';
$answer1 = isset($_POST['answer1']) ? mysqli_real_escape_string($GLOBALS['dbcon'], $_POST['answer1']) : '';
$answer2= isset($_POST['answer2']) ? mysqli_real_escape_string($GLOBALS['dbcon'], $_POST['answer2']) : '';
$answer3 = isset($_POST['answer3']) ? mysqli_real_escape_string($GLOBALS['dbcon'], $_POST['answer3']) : '';
$answer4 = isset($_POST['answer4']) ? mysqli_real_escape_string($GLOBALS['dbcon'], $_POST['answer4']) : '';
$answer5 = isset($_POST['answer5']) ? mysqli_real_escape_string($GLOBALS['dbcon'], $_POST['answer5']) : '';
*/

//print_r($question1);exit();
$sv_image_1 = $sv_image_1 ?? ''; 

		$sql = "update `tbl_country` set country_name='$country_name', parent_childs='$parent_childs', country_status='$country_status',category='$category', title='$title', description='$description', keyword='$keyword', country_title='$country_title', country_descriptions='$country_descriptions',country_descriptions1='$country_descriptions1' ,country_descriptions2='$country_descriptions2',conclusion='$conclusion' where country_id = $page_id ";
	//print_r($sql);exit();
	
		db_query($sql);
		
		########### Uploading Image ################
		if($_FILES['sv_image']['name']!='')
		{
		    $sv_image=$sv_image ?? '';
			if(strlen($sv_image) && file_exists(UP_FILES_FS_PATH."/banner/thumb/".$sv_image)){
				@unlink(UP_FILES_FS_PATH."/banner/thumb/".$sv_image);
			}
$sv_image_1 = md5(uniqid(rand(), true)) . '.' . file_ext($_FILES['sv_image']['name']);
				copy($_FILES['sv_image']['tmp_name'], UP_FILES_FS_PATH."/banner/thumb/".$sv_image_1) or die("Image is not uploaded");
				copy($_FILES['sv_image']['tmp_name'], UP_FILES_FS_PATH."/banner/original/".$sv_image_1) or die("Image is not uploaded");
			$n_width=120; // Fix the width of the thumb nail images
			$n_height=90; // Fix the height of the thumb nail imaage
			
			$tsrc=UP_FILES_FS_PATH."/banner/thumb/".$sv_image_1;
			$add=UP_FILES_FS_PATH."/banner/original/".$sv_image_1; // Path where thumb nail image will be stored
			
			//echo $tsrc;
			if (!($_FILES['sv_image']['type'] =="image/pjpeg" OR $_FILES['sv_image']['type']=="image/jpeg" OR $_FILES['sv_image']['type']=="image/png" OR $_FILES['sv_image']['type']=="image/webp")){echo "Your uploaded file must be of JPG or GIF or PNG or WEBP. Other file types are not allowed<BR>";
			exit;}
				///////// starting of JPG thumb nail creation//////////
			if($_FILES['sv_image']['type']=="image/pjpeg" OR $_FILES['sv_image']['type']=="image/jpeg")
			{
				$im=ImageCreateFromJPEG($add);
				$width=ImageSx($im); // Original picture width is stored
				$height=ImageSy($im); // Original picture height is stored
				$newimage=imagecreatetruecolor($n_width,$n_height);
				imageCopyResized($newimage,$im,0,0,0,0,$n_width,$n_height,$width,$height);
				ImageJpeg($newimage,$tsrc);
				chmod("$tsrc",0777);
			}
		if($_FILES['sv_image']['type']=="image/png"){
				$im=ImageCreateFromPNG($add);
				$width=ImageSx($im); // Original picture width is stored
				$height=ImageSy($im); // Original picture height is stored
				$newimage=imagecreatetruecolor($n_width,$n_height);
				imageCopyResized($newimage,$im,0,0,0,0,$n_width,$n_height,$width,$height);
				ImagePng($newimage,$tsrc);
				chmod("$tsrc",0777);
			}
			if ($_FILES['sv_image']['type'] == "image/webp") {
                 $im = imagecreatefromwebp($add); // Create image from WebP
                 $width = imagesx($im); // Original picture width is stored
                 $height = imagesy($im); // Original picture height is stored
                 $newimage = imagecreatetruecolor($n_width, $n_height);
                 imagecopyresized($newimage, $im, 0, 0, 0, 0, $n_width, $n_height, $width, $height);
                 imagewebp($newimage, $tsrc); // Save thumbnail as WebP
                 chmod("$tsrc", 0777);
             }
			
			db_query("update tbl_country set country_banner='".$sv_image_1."' where country_id = $page_id ");
		}
		set_session_msg("Services updated successfully.");	
	
	
	
			########### Uploading Image ################
		if($_FILES['sv_image1']['name']!='')
		{
		    $sv_image1=$sv_image1 ?? '';
			if(strlen($sv_image1) && file_exists(UP_FILES_FS_PATH."/banner/thumb/".$sv_image1)){
				@unlink(UP_FILES_FS_PATH."/banner/thumb/".$sv_image1);
			}
$sv_image_11 = md5(uniqid(rand(), true)) . '.' . file_ext($_FILES['sv_image1']['name']);
				copy($_FILES['sv_image1']['tmp_name'], UP_FILES_FS_PATH."/banner/thumb/".$sv_image_11) or die("Image is not uploaded");
				copy($_FILES['sv_image1']['tmp_name'], UP_FILES_FS_PATH."/banner/original/".$sv_image_11) or die("Image is not uploaded");
			$n_width=120; // Fix the width of the thumb nail images
			$n_height=90; // Fix the height of the thumb nail imaage
			
			$tsrc=UP_FILES_FS_PATH."/banner/thumb/".$sv_image_11;
			$add=UP_FILES_FS_PATH."/banner/original/".$sv_image_11; // Path where thumb nail image will be stored
			
			//echo $tsrc;
			if (!($_FILES['sv_image1']['type'] =="image/pjpeg" OR $_FILES['sv_image1']['type']=="image/jpeg" OR $_FILES['sv_image1']['type']=="image/png" OR $_FILES['sv_image1']['type']=="image/webp")){echo "Your uploaded file must be of JPG or GIF or PNG or Webp. Other file types are not allowed<BR>";
			exit;}
				///////// starting of JPG thumb nail creation//////////
			if($_FILES['sv_image1']['type']=="image/pjpeg" OR $_FILES['sv_image1']['type']=="image/jpeg")
			{
				$im=ImageCreateFromJPEG($add);
				$width=ImageSx($im); // Original picture width is stored
				$height=ImageSy($im); // Original picture height is stored
				$newimage=imagecreatetruecolor($n_width,$n_height);
				imageCopyResized($newimage,$im,0,0,0,0,$n_width,$n_height,$width,$height);
				ImageJpeg($newimage,$tsrc);
				chmod("$tsrc",0777);
			}
			if($_FILES['sv_image1']['type']=="image/png"){
				$im=ImageCreateFromPNG($add);
				$width=ImageSx($im); // Original picture width is stored
				$height=ImageSy($im); // Original picture height is stored
				$newimage=imagecreatetruecolor($n_width,$n_height);
				imageCopyResized($newimage,$im,0,0,0,0,$n_width,$n_height,$width,$height);
				ImagePng($newimage,$tsrc);
				chmod("$tsrc",0777);
			}
			if ($_FILES['sv_image1']['type'] == "image/webp") {
                 $im = imagecreatefromwebp($add); // Create image from WebP
                 $width = imagesx($im); // Original picture width is stored
                 $height = imagesy($im); // Original picture height is stored
                 $newimage = imagecreatetruecolor($n_width, $n_height);
                 imagecopyresized($newimage, $im, 0, 0, 0, 0, $n_width, $n_height, $width, $height);
                 imagewebp($newimage, $tsrc); // Save thumbnail as WebP
                 chmod("$tsrc", 0777);
             }
			
			db_query("update tbl_country set why_choose_image='".$sv_image_11."' where country_id = $page_id ");
		}
		set_session_msg("Services updated successfully.");	
	} else{	
	
	     ########### Uploading Image ################
		if($_FILES['sv_image']['name']!='')
		{$sv_image=$sv_image ?? '';
			if(strlen($sv_image) && file_exists(UP_FILES_FS_PATH."/banner/thumb/".$sv_image)){
				@unlink(UP_FILES_FS_PATH."/banner/thumb/".$sv_image);
			}
			$sv_image_1 = md5(uniqid(rand(), true)).'.'.file_ext($_FILES['sv_image']['name']);
				copy($_FILES['sv_image']['tmp_name'], UP_FILES_FS_PATH."/banner/thumb/".$sv_image_1) or die("Image is not uploaded");
				copy($_FILES['sv_image']['tmp_name'], UP_FILES_FS_PATH."/banner/original/".$sv_image_1) or die("Image is not uploaded");
			$n_width=120; // Fix the width of the thumb nail images
			$n_height=90; // Fix the height of the thumb nail imaage
			
			$tsrc=UP_FILES_FS_PATH."/banner/thumb/".$sv_image_1;
			$add=UP_FILES_FS_PATH."/banner/original/".$sv_image_1; // Path where thumb nail image will be stored
			
			//echo $tsrc;
			if (!($_FILES['sv_image']['type'] =="image/pjpeg" OR $_FILES['sv_image']['type']=="image/jpeg" OR $_FILES['sv_image']['type']=="image/png" OR $_FILES['sv_image']['type']=="image/webp")){echo "Your uploaded file must be of JPG or GIF or PNG. Other file types are not allowed<BR>";
			exit;}
				///////// starting of JPG thumb nail creation//////////
			if($_FILES['sv_image']['type']=="image/pjpeg" OR $_FILES['sv_image']['type']=="image/jpeg")
			{
				$im=ImageCreateFromJPEG($add);
				$width=ImageSx($im); // Original picture width is stored
				$height=ImageSy($im); // Original picture height is stored
				$newimage=imagecreatetruecolor($n_width,$n_height);
				imageCopyResized($newimage,$im,0,0,0,0,$n_width,$n_height,$width,$height);
				ImageJpeg($newimage,$tsrc);
				chmod("$tsrc",0777);
			}
				if($_FILES['sv_image']['type']=="image/png"){
				$im=ImageCreateFromPNG($add);
				$width=ImageSx($im); // Original picture width is stored
				$height=ImageSy($im); // Original picture height is stored
				$newimage=imagecreatetruecolor($n_width,$n_height);
				imageCopyResized($newimage,$im,0,0,0,0,$n_width,$n_height,$width,$height);
				ImagePng($newimage,$tsrc);
				chmod("$tsrc",0777);
			}
			if ($_FILES['sv_image']['type'] == "image/webp") {
                 $im = imagecreatefromwebp($add); // Create image from WebP
                 $width = imagesx($im); // Original picture width is stored
                 $height = imagesy($im); // Original picture height is stored
                 $newimage = imagecreatetruecolor($n_width, $n_height);
                 imagecopyresized($newimage, $im, 0, 0, 0, 0, $n_width, $n_height, $width, $height);
                 imagewebp($newimage, $tsrc); // Save thumbnail as WebP
                 chmod("$tsrc", 0777);
             }
			
			
		}
		
		if($_FILES['sv_image1']['name']!='')
		{
		    $sv_image1=$sv_image1 ?? '';
			if(strlen($sv_image1) && file_exists(UP_FILES_FS_PATH."/banner/thumb/".$sv_image1)){
				@unlink(UP_FILES_FS_PATH."/banner/thumb/".$sv_image1);
			}
			$sv_image_11 = md5(uniqid(rand(), true)).'.'.file_ext($_FILES['sv_image1']['name']);
				copy($_FILES['sv_image1']['tmp_name'], UP_FILES_FS_PATH."/banner/thumb/".$sv_image_11) or die("Image is not uploaded");
				copy($_FILES['sv_image1']['tmp_name'], UP_FILES_FS_PATH."/banner/original/".$sv_image_11) or die("Image is not uploaded");
			$n_width=120; // Fix the width of the thumb nail images
			$n_height=90; // Fix the height of the thumb nail imaage
			
			$tsrc=UP_FILES_FS_PATH."/banner/thumb/".$sv_image_11;
			$add=UP_FILES_FS_PATH."/banner/original/".$sv_image_11; // Path where thumb nail image will be stored
			
			//echo $tsrc;
			if (!($_FILES['sv_image1']['type'] =="image/pjpeg" OR $_FILES['sv_image1']['type']=="image/jpeg" OR $_FILES['sv_image1']['type']=="image/png" OR $_FILES['sv_image1']['type']=="image/webp")){echo "Your uploaded file must be of JPG or GIF or PNG. Other file types are not allowed<BR>";
			exit;}
				///////// starting of JPG thumb nail creation//////////
			if($_FILES['sv_image1']['type']=="image/pjpeg" OR $_FILES['sv_image1']['type']=="image/jpeg")
			{
				$im=ImageCreateFromJPEG($add);
				$width=ImageSx($im); // Original picture width is stored
				$height=ImageSy($im); // Original picture height is stored
				$newimage=imagecreatetruecolor($n_width,$n_height);
				imageCopyResized($newimage,$im,0,0,0,0,$n_width,$n_height,$width,$height);
				ImageJpeg($newimage,$tsrc);
				chmod("$tsrc",0777);
			}
				if($_FILES['sv_image1']['type']=="image/png"){
				$im=ImageCreateFromPNG($add);
				$width=ImageSx($im); // Original picture width is stored
				$height=ImageSy($im); // Original picture height is stored
				$newimage=imagecreatetruecolor($n_width,$n_height);
				imageCopyResized($newimage,$im,0,0,0,0,$n_width,$n_height,$width,$height);
				ImagePng($newimage,$tsrc);
				chmod("$tsrc",0777);
			}
			if ($_FILES['sv_image1']['type'] == "image/webp") {
                 $im = imagecreatefromwebp($add); // Create image from WebP
                 $width = imagesx($im); // Original picture width is stored
                 $height = imagesy($im); // Original picture height is stored
                 $newimage = imagecreatetruecolor($n_width, $n_height);
                 imagecopyresized($newimage, $im, 0, 0, 0, 0, $n_width, $n_height, $width, $height);
                 imagewebp($newimage, $tsrc); // Save thumbnail as WebP
                 chmod("$tsrc", 0777);
             }
			
			
		}
$country_name = $_POST['country_name'] ?? '';
$parent_childs = isset($_POST['parent_childs']) ? intval($_POST['parent_childs']) : 0;
if($parent_childs=='0'){
    $country_url=' ';
}
$country_status = $_POST['country_status'] ?? '0'; // Default to '0' (Inactive)
$title = $_POST['title'] ?? '';
$description = $_POST['description'] ?? '';
$keyword = $_POST['keyword'] ?? '';
$country_title =$_POST['country_title'] ?? '';
$category="Metal";
//$country_url =$_POST['country_url'] ?? '';
$country_descriptions = isset($_POST['country_descriptions']) 
    ? mysqli_real_escape_string(
        $GLOBALS['dbcon'],
        str_replace(["\r", "\n"], ' ', stripslashes($_POST['country_descriptions']))
    ) 
    : '';
$country_descriptions1 = isset($_POST['country_descriptions1']) 
    ? mysqli_real_escape_string(
        $GLOBALS['dbcon'],
        str_replace(["\r", "\n"], ' ', stripslashes($_POST['country_descriptions1']))
    ) 
    : '';
    $country_descriptions2 = isset($_POST['country_descriptions2']) 
    ? mysqli_real_escape_string(
        $GLOBALS['dbcon'],
        str_replace(["\r", "\n"], ' ', stripslashes($_POST['country_descriptions2']))
    ) 
    : '';
      $conclusion = isset($_POST['conclusion']) 
    ? mysqli_real_escape_string(
        $GLOBALS['dbcon'],
        str_replace(["\r", "\n"], ' ', stripslashes($_POST['conclusion']))
    ) 
    : '';

$sv_image_1 = $sv_image_1 ?? ''; 
$sv_image_11 = $sv_image_11 ?? ''; 

		 $sql = "insert into `tbl_country` set country_name='$country_name',  parent_childs='$parent_childs',country_status='$country_status',category='$category', title='$title', description='$description', keyword='$keyword', country_title='$country_title',country_descriptions='$country_descriptions',country_descriptions1='$country_descriptions1',country_descriptions2='$country_descriptions2',conclusion='$conclusion', country_banner='$sv_image_1',why_choose_us='$sv_image_11'";
	//	 print_r($sql);exit();
		db_query($sql);
		set_session_msg("New Services added successfully.");
	}
	header("Location: metal_service.php?start=$start");
	exit;
}

$page_id = $_REQUEST['page_id'];
if($page_id!='') {
	$sql = "select * from `tbl_country` where country_id = '$page_id'";
	$result = db_query($sql);
	if ($line_raw = mysqli_fetch_array($result)) {
		//$line_raw = ms_form_value($line_raw);
		@extract($line_raw);
	}
}
?>
<link href="styles.css" rel="stylesheet" type="text/css">

<? include("top.inc.php");?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td id="pageHead"><div id="txtPageHead">
       Add/Edit Metal Services</div></td>
  </tr>
</table>
<script type="text/javascript" src="fckeditor/fckeditor.js"></script>
<table width="80%" align="left">
		  	<tr><td>
		  	<form method="post" action="" enctype="multipart/form-data" name="form1" id="form1" onSubmit="return validate(this);">
        <table width="80%" align="center" border=0 cellpadding="0"  cellspacing="0" class="text">
    	<tr>
<?php
$start = isset($_GET['start']) ? intval($_GET['start']) : 0; // Ensure `$start` is defined
?>
<td colspan="2" height="30" align="right">
    <a href="metal_service.php?start=<?=$start?>" class="redcolor">
        <strong>Back To Services List</strong>
    </a>
</td>		</tr>    
        <tr><td height="15"><div align="center"><span class="msg"><?=display_sess_msg();?></span></div><br /></td></tr>  
		

        <tr><td>&nbsp;</td></tr>
        
        
        <tr>
		  <td class="lables"><b>Services Name</b></td>
          <td class="feildstxt"><input type="text" style="width:300px;" value="<?=stripslashes($country_name)?>" name="country_name" id="country_name"  /></td>
        </tr>
        <tr><td>&nbsp;</td></tr>
        
        <?php  $pcqry = db_query("select country_id,country_name from `tbl_country` where parent_childs='0' ");	?>
        <tr>
		  <td class="lables"><b>Parent</b></td>
          <td class="feildstxt"><select name="parent_childs" id="parent_childs">
          <option value="0" <?php if($parent_childs=='0'){ echo 'selected="selected"'; } ?>>None</option>
          <?php while($parentData = mysqli_fetch_assoc($pcqry)){ ?>  
          <option value="<?php echo $parentData['country_id']; ?>" <?php if($parentData['country_id']==$parent_childs){ echo 'selected="selected"'; } ?>><?php echo $parentData['country_name']; ?></option>      
          <?php } ?>    
          </select></td>
        </tr>
        <tr><td>&nbsp;</td></tr>
      

		<tr>
		  <td class="lables"><b>Status</b></td>
		  <?php $country_status = $country_status ?? ''; // Ensure variable exists
 ?>
          <td class="feildstxt"><select name="country_status" id="country_status">
          <option value="1" <?php if($country_status=='1'){ echo 'selected="selected"'; } ?>>Active</option>
          <option value="0" <?php if($country_status=='0'){ echo 'selected="selected"'; } ?>>InActive</option>          
          </select></td>
        </tr>
        <tr><td>&nbsp;</td></tr>
        
        <tr>
		  <td class="lables" colspan="2"><hr/></td>
        </tr>
        <tr><td>&nbsp;</td></tr>
        
        <tr>
		  <td class="lables"><b>Title </b></td>
          <td class="feildstxt"><textarea style="width:300px;" name="title" id="title"  ><?=stripslashes($title)?></textarea></td>
        </tr>
        <tr><td>&nbsp;</td></tr>
        
        <tr>
		  <td class="lables"><b>Description </b></td>
          <td class="feildstxt"><textarea style="width:300px;" name="description" id="description"  ><?=stripslashes($description)?></textarea></td>
        </tr>
        <tr><td>&nbsp;</td></tr>
        
        <tr>
		  <td class="lables"><b>Keyword</b></td>
          <td class="feildstxt"><textarea style="width:300px;" name="keyword" id="keyword"  ><?=stripslashes($keyword)?></textarea></td>
        </tr>
        <tr><td>&nbsp;</td></tr>
        <tr>
		  <td class="lables" colspan="2"><hr/></td>
        </tr>
        <tr><td>&nbsp;</td></tr>
        
        <tr>
		  <td class="lables"><b>Banner Image</b></td>
          <td class="feildstxt"><input type="file" name="sv_image" id="sv_image"  /></td>
        </tr>
        <tr><td>&nbsp;</td></tr>
        <tr>
		  <td class="lables"><b>Current Banner Image</b></td>
          <td class="feildstxt"><?php 
if (!empty($sv_image) && file_exists(UP_FILES_FS_PATH."/banner/original/".$sv_image)) {
    $imgPath = UP_FILES_FS_PATH."/banner/original/".$sv_image;
    $imgsrcBig = UP_FILES_WS_PATH."/banner/original/".$sv_image;
    $size = getimagesize($imgPath);
    
    if ($size !== false) {
        $mime = $size['mime'];

        switch ($mime) {
            case 'image/jpeg':
                $img = imagecreatefromjpeg($imgPath);
                break;
            case 'image/png':
                $img = imagecreatefrompng($imgPath);
                break;
            case 'image/gif':
                $img = imagecreatefromgif($imgPath);
                break;
            default:
                $img = false;
                echo 'Unsupported image type.';
                break;
        }

        if ($img !== false) {
            $width = imagesx($img);
            $height = imagesy($img);
            // Show image preview if you want
            echo '<img src="'.$imgsrcBig.'" width="'.$width.'" height="'.$height.'" alt="Preview">';
        } else {
            echo 'Could not load image.';
        }
    } else {
        echo 'Invalid image file.';
    }
}
?>
</td>
        </tr>
        <tr><td>&nbsp;</td></tr>
       <!-- <tr>
		  <td class="lables"><b>Services Url</b></td>
          <td class="feildstxt"><textarea style="width:300px;" name="country_url" id="country_url"  ><?=stripslashes($country_url)?></textarea></td>
        </tr>
        <tr><td>&nbsp;</td></tr>
        -->
        <tr>
		  <td class="lables"><b>Services Title</b></td>
          <td class="feildstxt"><textarea style="width:300px;" name="country_title" id="country_title"  ><?=stripslashes($country_title)?></textarea></td>
        </tr>
        <tr><td>&nbsp;</td></tr>
        
        <tr>
		  <td class="lables"><b>Services Descriptions1</b></td>
          <td class="feildstxt"><textarea style="width:300px;" name="country_descriptions" id="country_descriptions"  ><?=stripslashes($country_descriptions)?></textarea></td>
        </tr>
        <tr><td>&nbsp;</td></tr>
        
         <tr>
		  <td class="lables"><b>Services Descriptions2</b></td>
          <td class="feildstxt"><textarea style="width:300px;" name="country_descriptions1" id="country_descriptions1"  ><?=stripslashes($country_descriptions1)?></textarea></td>
        </tr>
        <tr><td>&nbsp;</td></tr>
        
        <tr>
		  <td class="lables"><b>Services Descriptions3</b></td>
          <td class="feildstxt"><textarea style="width:300px;" name="country_descriptions2" id="country_descriptions2"  ><?=stripslashes($country_descriptions2)?></textarea></td>
        </tr>
        <tr>
		  <td class="lables"><b>Conclusion</b></td>
          <td class="feildstxt"><textarea style="width:300px;" name="conclusion" id="conclusion"  ><?=stripslashes($conclusion)?></textarea></td>
        </tr>
        <tr><td>&nbsp;</td></tr>
        
                 <tr>
		  <td class="lables"><b>Why Choose Us Image</b></td>
          <td class="feildstxt"><input type="file" name="sv_image1" id="sv_image1"  /></td>
        </tr>
        <tr><td>&nbsp;</td></tr>
        <tr>
		  <td class="lables"><b>Current Banner Image</b></td>
          <td class="feildstxt"><?php 
if (!empty($sv_image1) && file_exists(UP_FILES_FS_PATH."/banner/original/".$sv_image1)) {
    $imgPath = UP_FILES_FS_PATH."/banner/original/".$sv_image1;
    $imgsrcBig = UP_FILES_WS_PATH."/banner/original/".$sv_image1;
    $size = getimagesize($imgPath);
    
    if ($size !== false) {
        $mime = $size['mime'];

        switch ($mime) {
            case 'image/jpeg':
                $img = imagecreatefromjpeg($imgPath);
                break;
            case 'image/png':
                $img = imagecreatefrompng($imgPath);
                break;
            case 'image/gif':
                $img = imagecreatefromgif($imgPath);
                break;
            default:
                $img = false;
                echo 'Unsupported image type.';
                break;
        }

        if ($img !== false) {
            $width = imagesx($img);
            $height = imagesy($img);
            // Show image preview if you want
            echo '<img src="'.$imgsrcBig.'" width="'.$width.'" height="'.$height.'" alt="Preview">';
        } else {
            echo 'Could not load image.';
        }
    } else {
        echo 'Invalid image file.';
    }
}
?>
</td>
        </tr>
        <tr><td>&nbsp;</td></tr>
     
     <!-- start FAQ  -->
     
   <!--  <tr>
		  <td class="lables"><b>Question1 </b></td>
          <td class="feildstxt"><textarea style="width:300px;" name="question1" id="question1"  ><?=stripslashes($question1 ?? '')?></textarea></td>
        </tr>
        <tr><td>&nbsp;</td></tr>

        <tr>
		  <td class="lables"><b>Answer1 </b></td>
          <td class="feildstxt"><textarea style="width:300px;" name="answer1" id="answer1"  ><?=stripslashes($answer2 ?? '')?></textarea></td>
        </tr>
        <tr><td>&nbsp;</td></tr>
        
        <tr>
		  <td class="lables"><b>Question2 </b></td>
          <td class="feildstxt"><textarea style="width:300px;" name="question2" id="question2"  ><?=stripslashes($question2 ?? '')?></textarea></td>
        </tr>
        <tr><td>&nbsp;</td></tr>
        
        <tr>
		  <td class="lables"><b>Answer2 </b></td>
          <td class="feildstxt"><textarea style="width:300px;" name="answer2" id="answer2"  ><?=stripslashes($answer2 ?? '')?></textarea></td>
        </tr>
        <tr><td>&nbsp;</td></tr>
        <tr>
		  <td class="lables"><b>Question3 </b></td>
          <td class="feildstxt"><textarea style="width:300px;" name="question3" id="question3"  ><?=stripslashes($question3 ?? '')?></textarea></td>
        </tr>
        <tr><td>&nbsp;</td></tr>
        
        <tr>
		  <td class="lables"><b>Answer3 </b></td>
          <td class="feildstxt"><textarea style="width:300px;" name="answer3" id="answer3"  ><?=stripslashes($answer3 ?? '')?></textarea></td>
        </tr>
        <tr><td>&nbsp;</td></tr>
        
        <tr>
		  <td class="lables"><b>Question4 </b></td>
          <td class="feildstxt"><textarea style="width:300px;" name="question4" id="question4"  ><?=stripslashes($question4 ?? '')?></textarea></td>
        </tr>
        <tr><td>&nbsp;</td></tr>
        
        
        <tr>
		  <td class="lables"><b>Answer4 </b></td>
          <td class="feildstxt"><textarea style="width:300px;" name="answer4" id="answer4"  ><?=stripslashes($answer4 ?? '')?></textarea></td>
        </tr>
        <tr><td>&nbsp;</td></tr>
        <tr>
		  <td class="lables"><b>Question5 </b></td>
          <td class="feildstxt"><textarea style="width:300px;" name="question5" id="question5"  ><?=stripslashes($question5 ?? '')?></textarea></td>
        </tr>
        <tr><td>&nbsp;</td></tr>
        
        
        <tr>
		  <td class="lables"><b>Answer5 </b></td>
          <td class="feildstxt"><textarea style="width:300px;" name="answer5" id="answer5"  ><?=stripslashes($answer5 ?? '')?></textarea></td>
        </tr>
        <tr><td>&nbsp;</td></tr>
        
     -->
     <!-- end FAQ  -->
        <tr>
        <td align="left" class="lables">&nbsp;</td>
        <td align="left" class="feildstxt"><input class="button" type="submit" name="submit" value="Save"></td>
        </tr>
        <tr><td height="25">&nbsp;</td></tr>
   </table>
    </form>
    </td></tr></table> 
    <script type="text/javascript">
		 var oFCKeditor=new FCKeditor('country_descriptions','650','600')	;
		 oFCKeditor.BasePath="fckeditor/";	
		 oFCKeditor.ReplaceTextarea();
    </script>   
      <script type="text/javascript">
		 var oFCKeditor=new FCKeditor('country_descriptions1','650','600')	;
		 oFCKeditor.BasePath="fckeditor/";	
		 oFCKeditor.ReplaceTextarea();
    </script>   
     <script type="text/javascript">
		 var oFCKeditor=new FCKeditor('country_descriptions2','650','300')	;
		 oFCKeditor.BasePath="fckeditor/";	
		 oFCKeditor.ReplaceTextarea();
    </script>   
    <script type="text/javascript">
		 var oFCKeditor=new FCKeditor('conclusion','650','300')	;
		 oFCKeditor.BasePath="fckeditor/";	
		 oFCKeditor.ReplaceTextarea();
    </script>   
    <!-- <script type="text/javascript">
		 var oFCKeditor1=new FCKeditor('answer1','550','300')	;
		 oFCKeditor1.BasePath="fckeditor/";	
		 oFCKeditor1.ReplaceTextarea();
    </script>
    <script type="text/javascript">
		 var oFCKeditor2=new FCKeditor('answer2','550','300')	;
		 oFCKeditor2.BasePath="fckeditor/";	
		 oFCKeditor2.ReplaceTextarea();
    </script>
    <script type="text/javascript">
		 var oFCKeditor3=new FCKeditor('answer3','550','300')	;
		 oFCKeditor3.BasePath="fckeditor/";	
		 oFCKeditor3.ReplaceTextarea();
    </script>
    <script type="text/javascript">
		 var oFCKeditor4=new FCKeditor('answer4','550','300')	;
		 oFCKeditor4.BasePath="fckeditor/";	
		 oFCKeditor4.ReplaceTextarea();
		 
    </script>
    <script type="text/javascript">
		 var oFCKeditor5=new FCKeditor('answer5','550','300')	;
		 oFCKeditor5.BasePath="fckeditor/";	
		 oFCKeditor5.ReplaceTextarea();
	</script>	 -->
   <!-- <script type="text/javascript">
		 var oFCKeditor=new FCKeditor('country_ad1','650','200')	;
		 oFCKeditor.BasePath="fckeditor/";	
		 oFCKeditor.ReplaceTextarea();
    </script>   
    <script type="text/javascript">
		 var oFCKeditor=new FCKeditor('country_ad2','650','200')	;
		 oFCKeditor.BasePath="fckeditor/";	
		 oFCKeditor.ReplaceTextarea();
    </script>   
    <script type="text/javascript">
		 var oFCKeditor=new FCKeditor('country_ad3','650','200')	;
		 oFCKeditor.BasePath="fckeditor/";	
		 oFCKeditor.ReplaceTextarea();
    </script>   -->
  <? include("bottom.inc.php");?>