Your IP : 216.73.217.79


Current Path : /var/www/cesa.co.za/Mailer/
Upload File :
Current File : /var/www/cesa.co.za/Mailer/doAddNewsletter.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_notes = str_replace("'", '&acute;', $_POST['notes']);
		$h_notes = str_replace('\"', '"', $h_notes);
		
		$sql_insert = "INSERT INTO Newsletter (idUser, sTitle, sHeading, dtCreated, txtNotes";
		$sql_values = "VALUES (" . $userid . ", '" . str_replace('"', '&quot;', str_replace("'", '&acute;', $_POST['title'])) . "', '" . str_replace("'", '&acute;', $_POST['heading']) . "', '".date("Y-m-d H:i:s")."', '" . $h_notes  . "'";
		
		if(intval($_POST['previousIssueID']) > 0) {	
			$sql_insert .= ", idPreviousIssue)\n";
			$sql_values .= ", " . $_POST['previousIssueID'] . ")";
		}
		else {
			$sql_insert .= ")\n";
			$sql_values .= ")";
		}
		
		$sql_addnewsletter = $sql_insert . $sql_values;
		//echo $sql_addnewsletter;
		$db = $_SESSION['database'];
		if ($db->Execute($sql_addnewsletter) === false) {
			die("Could not add newsletter");
		} else {
		?>
		<script language="JavaScript" type="text/javascript">
			//window.close();
			window.location = "doLogin.php";
		</script>
		<?php
		}
	} 
?>