Your IP : 216.73.217.79


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

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

	if (isset($_SESSION['database'])) {
		$db = $_SESSION['database'];		
	} 
	

	if (isset($_SESSION['userid'])) {
		$userid = $_SESSION['userid'];
	} else {
		if (isset($_POST['username']) && isset($_POST['password'])) {
			$username = $_POST['username'];
			$password = $_POST['password'];
			$s = "SELECT idUser FROM Users where sUsername = '" . $username . "' and sPassword = '" . $password . "'";
			$rsLogin = $db->Execute($s);
			if (!$rsLogin) {
				print $conn->ErrorMsg();
			}
			$rsLogin->MoveFirst();
			if(!$rsLogin->EOF) { 
				 $userid = $rsLogin->fields[0];
				 $_SESSION['userid']= $userid;
			}
			else {
				echo "<script>document.location.href='index.php';</script>\n";
			}
		}
	}
	// where idUser = " . intval($userid) . "
	$sql = "SELECT idNewsletter, idUser, sTitle, dtCreated, dtSent\n" .
		"FROM Newsletter\n" .
		"ORDER BY dtCreated desc";
	$rsNewsletters = $db->Execute($sql);
	//echo $rsNewsletters ;

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<title>Email template control panel</title>
	<link rel="stylesheet" type="text/css" href="stylesheet/default_styles.css">
	<script language="JavaScript">
	function n_window(theurl) {
		// set width and height
		var the_width=600;
		var the_height=400;
		// set window position
		var from_top=83;
		var from_left=100;
		// set other attributes
		var has_toolbar='no';
		var has_location='no';
		var has_directories='no';
		var has_status='no';
		var has_menubar='no';
		var has_scrollbars='no';
		var is_resizable='no';
		// atrributes put together
		var the_atts='width='+the_width+',height='+the_height+',top='+from_top+',screenY='+from_top+',left='+from_left+',screenX='+from_left;
		the_atts+=',toolbar='+has_toolbar+',location='+has_location+',directories='+has_directories+',status='+has_status;
		the_atts+=',menubar='+has_menubar+',scrollbars='+has_scrollbars+',resizable='+is_resizable;
		// open the window
		window.open(theurl,'',the_atts);
	}
	function wipe(x) {
		var do_wipe = confirm("Are you certain that you wish to delete this item?");
		if (do_wipe == true) {
			document.location = "destroyNewsletter.php?id=" + x;
		}
	}
</script>
</head>

<body bgcolor="#D0ECF8" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">
	<?php //echo $userid; ?>
	<?php //echo $rsNewsletters->recordcount();?>
	
	<table border="0" cellspacing="0" cellpadding="0" width="100%">
	<tr>
		<td height="10" bgcolor="#016694"><img src="images/spacer.gif" width="1" height="10"></td>
	</tr>
	<tr>
		<td height="2" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="2"></td>
	</tr>
	<tr>
		<td height="2" bgcolor="#016694"><img src="images/spacer.gif" width="1" height="2"></td>
	</tr>
	<tr>
		<td height="30"><img src="images/spacer.gif" width="1" height="30"></td>
	</tr>
	<tr>
		<td class="paddingLeft20">
			<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%">
				<tr>
					<td valign="top" align="middle">
						<table border="0" cellpadding="0" cellspacing="5">
							<tr>
								<td height="10"></td>
							</tr>
							<tr>
								<td><input type="button" value="Create new newsletter" class="button" onClick="javascript:document.location = 'addNewsletter.php';"></td>
							</tr>					
						</table>
					</td>
				</tr>
				<tr>
					<td><hr></td>
				</tr>
				<tr>
					<td height="10"></td>
				</tr>
				<tr>
					<td class="blackTypeBold"><strong>Current newsletters.</strong><br><br></td>
				</tr>
				<tr>
					<td valign="top">
						<table border="0" cellspacing="2" cellpadding="4">
<?php
	while (! $rsNewsletters->EOF) { 

?>
							<tr>
								<td width="20"></td>
								<td class="blackType"><input type="button" value="Edit" class="button" onClick="document.location = 'addNewsletter.php?id=<?php echo  $rsNewsletters->fields[0]; ?>';"> - <?php echo  $rsNewsletters->fields[2]; ?></td>
								<td class="blackType"><?php echo  $rsNewsletters->fields[3] ?></td>
								<td><input type="button" value="Delete" class="button" onClick="javascript:wipe('<?php echo  $rsNewsletters->fields[0] ?>');"></td>
								<td><input type="button" value="Manage sections" class="button" onClick="document.location = 'manageSections.php?id=<?php echo  $rsNewsletters->fields[0] ?>'"></td>
								<td><input type="button" value="Preview" class="button" onClick="window.open('mail_template.php?id=<?php echo  $rsNewsletters->fields[0] ?>')"></td>
								<td><input type="button" value="Send email" class="button" onClick="window.open('sendNewsLetter.php?id=<?php echo  $rsNewsletters->fields[0] ?>')"></td>
								<td><input type="button" value="Send Tests" class="button" onClick="window.open('sendNewsLetter.php?id=<?php echo  $rsNewsletters->fields[0] ?>&test=1')"></td>
							</tr>
<?php 
		$rsNewsletters->MoveNext();
	}
?>		
						</table>
					</td>
				</tr>
				<tr>
					<td height="10"></td>
				</tr>
				<tr>
					<td><hr></td>
				</tr>
				<tr>
					<td width="100%" align="center">
					<input type="button" value="Refresh list" class="button" onClick="javascript:document.location='doLogin.php';"></td>
				</tr>
				<tr>
					<td style="padding-left:30px;" class="blackType">
						<strong>Newsletter listing</strong><br>
						<br>
						The list above indicates the newsletters created to date.
						<ul>
							<li><strong>Edit</strong> - Change the newsletter name.</li>
							<li><strong>Delete</strong> - Remove the newsletter from the system.</li>
							<li><strong>Manage sections</strong> - View a listing of the sections that make up the newsletter in question.</li>
							<li><strong>Preview</strong> - View the newsletter in its current state as the final recipient will see it.</li>
							<li><strong>Send mail</strong> - Create an .HTML document and send it to the newsletter recipients.</li>
						</ul>
					</td>
				</tr>
				<tr>
					<td height="100%"></td>
				</tr>
			</table>
		</td>
	</tr>
</table>
</body>
</html>