Your IP : 216.73.217.79


Current Path : /var/www/cesa.co.za/Mailer/
Upload File :
Current File : /var/www/cesa.co.za/Mailer/doAddSection.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";
		}
				
		//echo $sql_addnewsletter;
		$db = $_SESSION['database'];
		
		$next_nlid = 1;
		$sql = "SELECT max(nOrder) as MaxOrder FROM Sections where idNewsletter = " . $_POST['parentid'];
		//echo $sql;
		
		$rs = $db->Execute($sql);
		if (! $rs->EOF) {
			$next_nlid = $rs->fields[0] + 1;		
		}

		$sql = "INSERT INTO Sections(idNewsletter, sTitle, nOrder)\n" .
			"VALUES(" . $_POST['parentid'] . ", '" . str_replace('"', '&quot;', str_replace("'", '&acute;', $_POST['title'])) . "', " . $next_nlid . ")";
		
		echo $sql;
		
		if ($db->Execute($sql) === false) {
			die("Could not add newsletter");
		} else {
		?>
		<script language="JavaScript" type="text/javascript">
			//window.close();			
			window.location = "manageSections.php?id=<?php echo intval($_POST['sectionid']) ?>";
		</script>
		<?php
		}
		
	} 
?>