<?

/*
FlexCMS (http://www.flexcms.com)
Flexible, Powerful, Affordable.

Contents of this file are protected by the copyright
notice found at http://www.flexcms.com/flex/pages/copyright.html,
and its usage is subject to the terms of the licensing agreement 
available at http://www.flexcms.com/flex/pages/license.html
*/



	// ========================================================================================
	// save newsletter prefs
	// ========================================================================================
	
	$PageTitle = $MsgText[5][5];
	$BrowserTitle = $MsgText[5][5];
	$LocationBar = '<a href="'.$IndexURL.'">'.$MsgText[0][1].'</a> > <a href="' . $MainURL . '/options.html">'.$MsgText[0][4].'</a> > '.$MsgText[5][5];
	
	if ($LoggedIn == 'y') {
		
		ReadPermissions();
		Global $Permissions;
		
		if ($Permissions[503] == 'y') {
	
	
			ReadFormArguments();
			Global $FormArguments;
			
			if (count($FormArguments) > 0) {
											
									
				$query = "select * from `".$Settings['DBPrefix']."nl-Settings` where Name='TitleAlignment' limit 1";
				$result = mysql_query($query) or die (mysql_error());
				if (mysql_num_rows($result) > 0) {
					$query = "update `".$Settings['DBPrefix']."nl-Settings` set Value='".$FormArguments['TitleAlignment']."' where Name='TitleAlignment' limit 1";
					$result = mysql_query($query) or die (mysql_error());
				}
				else {
					$query = "insert into `".$Settings['DBPrefix']."nl-Settings` (Name, Value) values ('TitleAlignment','".$FormArguments['TitleAlignment']."')";
					$result = mysql_query($query) or die (mysql_error());
				}
				
				
				$query = "select * from `".$Settings['DBPrefix']."nl-Settings` where Name='SendBatchSize' limit 1";
				$result = mysql_query($query) or die (mysql_error());
				if (mysql_num_rows($result) > 0) {
					$query = "update `".$Settings['DBPrefix']."nl-Settings` set Value='".$FormArguments['SendBatchSize']."' where Name='SendBatchSize' limit 1";
					$result = mysql_query($query) or die (mysql_error());
				}
				else {
					$query = "insert into `".$Settings['DBPrefix']."nl-Settings` (Name, Value) values ('SendBatchSize','".$FormArguments['SendBatchSize']."')";
					$result = mysql_query($query) or die (mysql_error());
				}
				
				
				$query = "select * from `".$Settings['DBPrefix']."nl-Settings` where Name='AttemptsLimit' limit 1";
				$result = mysql_query($query) or die (mysql_error());
				if (mysql_num_rows($result) > 0) {
					$query = "update `".$Settings['DBPrefix']."nl-Settings` set Value='".$FormArguments['AttemptsLimit']."' where Name='AttemptsLimit' limit 1";
					$result = mysql_query($query) or die (mysql_error());
				}
				else {
					$query = "insert into `".$Settings['DBPrefix']."nl-Settings` (Name, Value) values ('AttemptsLimit','".$FormArguments['AttemptsLimit']."')";
					$result = mysql_query($query) or die (mysql_error());
				}
				
				
				$query = "select * from `".$Settings['DBPrefix']."nl-Settings` where Name='PageTitle' limit 1";
				$result = mysql_query($query) or die (mysql_error());
				if (mysql_num_rows($result) > 0) {
					$query = "update `".$Settings['DBPrefix']."nl-Settings` set Value='".$FormArguments['PageTitle']."' where Name='PageTitle' limit 1";
					$result = mysql_query($query) or die (mysql_error());
				}
				else {
					$query = "insert into `".$Settings['DBPrefix']."nl-Settings` (Name, Value) values ('PageTitle','".$FormArguments['PageTitle']."')";
					$result = mysql_query($query) or die (mysql_error());
				}
				
				
				$query = "select * from `".$Settings['DBPrefix']."nl-Settings` where Name='TitleImage' limit 1";
				$result = mysql_query($query) or die (mysql_error());
				if (mysql_num_rows($result) > 0) {
					$query = "update `".$Settings['DBPrefix']."nl-Settings` set Value='".$FormArguments['TitleImage']."' where Name='TitleImage' limit 1";
					$result = mysql_query($query) or die (mysql_error());
				}
				else {
					$query = "insert into `".$Settings['DBPrefix']."nl-Settings` (Name, Value) values ('TitleImage','".$FormArguments['TitleImage']."')";
					$result = mysql_query($query) or die (mysql_error());
				}
				
				
				$query = "select * from `".$Settings['DBPrefix']."nl-Settings` where Name='TopText' limit 1";
				$result = mysql_query($query) or die (mysql_error());
				if (mysql_num_rows($result) > 0) {
					$query = "update `".$Settings['DBPrefix']."nl-Settings` set Value='".$FormArguments['TopText']."' where Name='TopText' limit 1";
					$result = mysql_query($query) or die (mysql_error());
				}
				else {
					$query = "insert into `".$Settings['DBPrefix']."nl-Settings` (Name, Value) values ('TopText','".$FormArguments['TopText']."')";
					$result = mysql_query($query) or die (mysql_error());
				}
				
				
				$query = "select * from `".$Settings['DBPrefix']."nl-Settings` where Name='TopTextAlignment' limit 1";
				$result = mysql_query($query) or die (mysql_error());
				if (mysql_num_rows($result) > 0) {
					$query = "update `".$Settings['DBPrefix']."nl-Settings` set Value='".$FormArguments['TopTextAlignment']."' where Name='TopTextAlignment' limit 1";
					$result = mysql_query($query) or die (mysql_error());
				}
				else {
					$query = "insert into `".$Settings['DBPrefix']."nl-Settings` (Name, Value) values ('TopTextAlignment','".$FormArguments['TopTextAlignment']."')";
					$result = mysql_query($query) or die (mysql_error());
				}
						
				
				
				header('Location: ' . $MainURL . '/options.html');
				
				
			}
			else {
				$PageContents = $MsgText[0][98];
			}
			
		}
		else {
		
			$PageContents = $MsgText[0][97];
		
		}

	}
	else {
	
		RedirectToLogin();
	
	}
	
	

	// ========================================================================================




?>
