Your IP : 216.73.217.79


Current Path : /var/www/cesa.co.za/Mailer/
Upload File :
Current File : /var/www/cesa.co.za/Mailer/doUpdateArticle.php

<?php
	require_once ('includes/globals.php');

	if (isset($_SESSION['database'])) {	
		if (isset($_SESSION['userid'])) {
			$userid = $_SESSION['userid'];
		} else {
			echo "<script>document.location.href='index.php';</script>\n";
		}
		

		$h_sectionid = $_POST['parentid'];
		$h_title = htmlspecialchars($_POST['title']);
		$h_copy = $_POST['theBody'];
		$h_copy = str_replace("'", '&acute;', $h_copy);
		$h_copy = str_replace('\"', '"', $h_copy);
		$h_image = 'n/a';
		$h_url = $_POST['link'];
		$h_linktitle = str_replace('"', '&quot;', str_replace("'", '&acute;', $_POST['linkText']));

		
		if(is_uploaded_file($_FILES['image']['tmp_name'])) {
			$h_image = $_FILES['image']['name'];
			//echo $_FILES['image']['tmp_name'];			
			move_uploaded_file($_FILES['image']['tmp_name'], $local_image_folder . $_FILES['image']['name']);
		}
				
		//echo $sql_addnewsletter;
		$db = $_SESSION['database'];

		$sql = "UPDATE Headlines\n" . 
			"SET sTitle = '" .$h_title . "', txtCopy = '".$h_copy . 
				"', sImage = '".$h_image . "', sUrl = '".$h_url . "', sLinkTitle = '".$h_linktitle . "'\n" .
				"where idHeadline = " . $_POST['updateid'];
		
		//echo $sql;
		
		if ($db->Execute($sql) === false) {
			die("Could not modify article");
		} else {
		?>
		<script language="JavaScript" type="text/javascript">
			//window.close();			
			window.location = "manageNewsletter.php?id=<?php echo intval($_POST['t']); ?>&pid=<?php echo intval($_POST['s']); ?>";
		</script>
		<?php
		}
	} 
?>