MOON
Server: Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4
System: Linux vps.panamaemb.org.sg 3.10.0-1160.80.1.vz7.191.4 #1 SMP Thu Dec 15 20:31:06 MSK 2022 x86_64
User: panama (500)
PHP: 5.2.17
Disabled: NONE
Upload Files
File: /home/panama/public_html_old/managesite/services_edit.php
<?php
	include("../include/config.php"); 
	include("../include/opner_admin.php");
	if(strlen(trim($_POST["btnBack"])) > 0)
	{
		header("location: services_list.php");
		exit();
	 } 
	 
	$edit = (($_GET['edit'])?$_GET['edit']:$_POST['edit']); 
	$rmvimg = ((empty($_GET['rmvimg']))?0:$_GET['rmvimg']);	
	
	if($rmvimg == 1)
	{
		$queryi="SELECT * FROM embassy_services WHERE sid=".base64_decode($edit);
		$resulti=@mysql_query($queryi);
		if(@mysql_result($resulti, 0, "simg")<>'d_photo.jpg')
		{
			$path1="../newsimg/".@mysql_result($resulti, 0, "simg");
			@unlink($path1);
		}
		$db_del = new database();
		$db_del->where("sid=".base64_decode($edit));
		$db_del->data("simg",'');
		$db_del->update("embassy_services");
	}
	
	if(strlen(trim($_POST["btnSave"])) > 0)
	{
		$newsdate = $_POST['date'];
		
		if($_FILES['simg']['name']<>'') {$flag = $functions->isValidImage($_FILES['simg']['type']);}
		if($flag =='0') {$err_image="Please provside Correct Image Format";	$error=1;	}
			
		if($error <> 1)
		{
			if($flag > 0)
			{
				// UPLOAD Sign HERE
				$simg = $_POST['photo_image'];
				$tokan = array(" ", "'","`","’");
				$image_name 	= time()."_".strtolower(str_replace($tokan, "" , $_FILES['simg']['name']));
				$folder_path 	= "newsimg/";
				copy($_FILES['simg']['tmp_name'] , "../".$folder_path."".$image_name);	
				
				//delete previous image
				//if($simg <>"" && $simg <>'d_photo.jpg')
				if($simg <>"")
				{
					$path="../newsimg/".$simg;
					@unlink($path);					
				}					
			} 
			else 
			{ 
				$image_name = $_POST['photo_image'];
			}
		
			$content=$_POST['sdesc'];
			$db = new database();
			$db->where("sid=".base64_decode($edit));
			$db->data("title",$_POST['title']);	
			$db->data("dat",$newsdate);	
			$db->data("simg",$image_name);		
			$db->data("sdesc",addslashes($_POST['sdesc']));						
			$db->update("embassy_services");
			$err_succ = "Record has been updated successfully.";
			header("location:services_list.php");
		}
	}	
	
	$db_list = new database();
	$db_list->where("sid=".base64_decode($edit));
	$db_list->selectstmt("embassy_services");
	$title = $db_list->f_title;
	$date = $db_list->f_dat;
	
	$message=$db_list->f_sdesc;
	$simg = $db_list->f_simg;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title><?=SITE_ADMIN_TITLE?></title>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
	<meta name="sdesc" content="<?=META_sdesc?>" />
	<meta name="keywords" content="<?=META_KEYWORD?>" />
	<link type="text/css" rel="stylesheet" href="css.css" />
	<link rel="stylesheet" type="text/css" href="js/style.css" />
	<script type="text/javascript" src="js/lib/prototype.js"></script>
	<script type="text/javascript" src="js/src/effects.js"></script>
	<script type="text/javascript" src="js/valsidation.js"></script>
	<script src="js/MyFunctions.js"></script>
	<link href="calender/rfnet.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="calender/datetimepicker_css.js"></script>
	<!-- TinyMCE -->
	<script type="text/javascript" src="tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
	<script type="text/javascript">
		tinyMCE.init({
			// General options
			mode : "textareas",
			theme : "advanced",
			plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
	
			// Theme options
			theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
			theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
			theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
			theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
			theme_advanced_toolbar_location : "top",
			theme_advanced_toolbar_align : "left",
			theme_advanced_statusbar_location : "bottom",
			theme_advanced_resizing : true,
	
			// Example content CSS (should be your site CSS)
			content_css : "css/content.css",
	
			// Drop lists for link/image/media/template dialogs
			template_external_list_url : "lists/template_list.js",
			external_link_list_url : "lists/link_list.js",
			external_image_list_url : "lists/image_list.js",
			media_external_list_url : "lists/media_list.js",
	
			// Replace values for the template plugin
			template_replace_values : {
				username : "Some User",
				staffid : "991234"
			}
		});
	</script>
	<!-- /TinyMCE -->
</head>
<body onLoad="javascript:showhside('refrence');">
<table width="100%" border="0" cellpadding="0" cellspacing="0" wsidth="100%" >
  <tr>
    <td><? include("header.php")?></td>
  </tr>
  <tr>
	<td valign="top" wsidth="100%">
	<form name="frmabout" sid="frmabout" action="services_edit.php?edit=<?=$edit;?>" method="post" enctype="multipart/form-data">
	  <table width="100%" border="0" cellpadding="0" cellspacing="0" class="inertable" wsidth="100%">
		<tr bgcolor="#E6F3F9">
		  <td wsidth="72%" class="inertr" style="padding-left:7px"  colspan="2"><img src="images/bullet_new.png" align="absmsiddle" />&nbsp;&nbsp;Update News </td>
		  <td wsidth="28%" class="inertr" align="right" style="padding-right:10px">&nbsp;</td>
		</tr>
		<tr>
		  <td colspan="2" align="center"><table wsidth="50%" border="0" cellspacing="0" cellpadding="0" class="text">
			  <tr>
				<td><table wsidth="100%" border="0" align="left" cellpadding="0" cellspacing="0" class="text">
                  <tr>
                    <td height="20" colspan="6" align="center"><span class="success"> <? echo $err_succ ?></span>
                        <input type="hidden" name="edit" value="<?=$edit;?>" /></td>
                  </tr>
                  <tr>
                    <td colspan="2" align="right" valign="top" class="textbold">Title &nbsp;</td>
                    <td colspan="4" align="left">
                        <input type="text" name="title" sid="title" class="required" value="<?=$title;?>" size="35" /></td>
                  </tr>
                  <tr><td colspan="6">&nbsp;</td></tr>
				  <tr>
				  
				  <tr>
					  <td colspan="2" align="right" valign="top" class="textbold">Date &nbsp;</td>
					  <td colspan="4" align="left">
					    <input type="text" id="date" maxlength="25" size="25" name="date" value="<?=$date?>" readonly="" class="required"/>
						<a href="javascript:NewCssCal('date','yyyymmdd')"><img src="images/cal.gif" width="16" height="16" alt="Pick a date"></a>
					  </td>
					</tr>
					<tr>
					  <td colspan="6" align="center">&nbsp;</td>
					</tr>					
                    <td colspan="2" align="right" valign="top" class="textbold">Image &nbsp;</td>
                    <td colspan="4" align="left" valign="top">
                        <input type="file" name="simg" size="35" class="filebgcolor"/>
                        <br /><span class="error">&nbsp;<?=$err_image;?></span>
					</td>
					<td align="left">&nbsp;</td>
                  </tr>
				  <tr>
				  	<td colspan="2">&nbsp;</td>
					<td colspan="4" align="center"><? if($simg<>"") { ?><img src="../display_image.php?path=newsimg/<?php echo $simg;?>&width=91&height=68&watermark=-1" border="0" style="padding-bottom:5px; padding-top:5px;">&nbsp;&nbsp;<a href="services_edit.php?edit=<?=$edit;?>&rmvimg=1" onClick="return delete_yesno('<?=ucfirst('This Image')?>');" title="Delete Image"><img src="images/delete.png" alt="Delete Image" wsidth="12" height="12" border="0" /></a>
					<? } ?>
					</td>
				  </tr>
                  <tr>
                    <td colspan="2" align="right" valign="top" class="textbold">&nbsp;</td>
                    <td colspan="4" align="center">&nbsp;</td>
                  </tr>
                  <tr>
                    <td colspan="2" align="right" valign="top" class="textbold">Description &nbsp;&nbsp;</td>
                    <td colspan="4" align="left"><textarea sid="sdesc" name="sdesc" rows="15" cols="50" class="required"><?=$message;?></textarea></td>
                  </tr>
                  <tr>
                    <td colspan="2" align="center">&nbsp;</td>
                    <td colspan="2" align="left">&nbsp;</td>
                    <td colspan="2" align="left">&nbsp;</td>
                  </tr>
				  <tr><td colspan="6"><input type="hidden" name="photo_image" value="<?=$simg?>"></td></tr>
                  <tr>
                    <td colspan="2" align="center">&nbsp;&nbsp;</td>
                    <td align="left" colspan="2">
                        <input name="btnSave" type="submit" class="btn" value="Save" style="border:none;" />&nbsp;&nbsp;<input name="btnBack" type="submit" class="btn" value="Back to List" onClick="javascript:location.href='services_list.php'" style="border:none;" /></td>
                    <td colspan="2" align="left">&nbsp;</td>
                  </tr>
                  <tr>
                    <td colspan="2" align="center">&nbsp;</td>
                    <td colspan="2" align="left">&nbsp;</td>
                    <td colspan="2" align="left">&nbsp;</td>
                  </tr>
                </table></td>
			  </tr>
			</table></td>
		</tr>
		<tr>
		  <td align="left" colspan="3" >&nbsp;</td>
		</tr>
	  </table>
	</form>
	<script type="text/javascript">
		function formCallback(result, form) {
			window.status = "valiation callback for form '" + form.sid + "': result = " + result;
		}
		
		var valsid = new Valsidation('frmabout', {immediate : true, onFormValsidate : formCallback});
	</script>
	<script type="text/javascript" src="js/change_backcolor.js"></script>
</td>
  </tr>
  <tr><td height="50"></td></tr>  
</table>
</body>
</html>