<?

/*
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 Prefs
	// ========================================================================================
	
	$PageTitle = '<img src="'.$ImagesURL.'/admin/admincp_links.gif" width="20" height="21"> '.$MsgText[8][3];
	$BrowserTitle = $MsgText[8][3];
	$LocationBar = '<a href="'.$IndexURL.'">'.$MsgText[0][1].'</a> > <a href="' . $MainURL . '/options.html">'.$MsgText[0][4].'</a> > '.$MsgText[8][3];
	
	if ($LoggedIn == 'y') {
		
		ReadPermissions();
		Global $Permissions;
		
		if ($Permissions[801] == 'y') {
		
			ReadFormArguments();
			Global $FormArguments;
			
			if (count($FormArguments) > 0) {
																		
				$query = "update `".$Settings['DBPrefix']."lm-Settings` set Value='".$FormArguments['ShowClicks']."' where Name='ShowClicks' limit 1";
				$result = mysql_query($query) or die (mysql_error());
				
				//$query = "update `".$Settings['DBPrefix']."lm-Settings` set Value='".$FormArguments['MaskURL']."' where Name='MaskURL' limit 1";
				//$result = mysql_query($query) or die (mysql_error());
				
				
				$query = "update `".$Settings['DBPrefix']."lm-Settings` set Value='".$FormArguments['TopText']."' where Name='TopText' limit 1";
				$result = mysql_query($query) or die (mysql_error());
				
				$query = "update `".$Settings['DBPrefix']."lm-Settings` set Value='".$FormArguments['TopTextAlignment']."' where Name='TopTextAlignment' limit 1";
				$result = mysql_query($query) or die (mysql_error());
				
				$query = "update `".$Settings['DBPrefix']."lm-Settings` set Value='".$FormArguments['TitleAlignment']."' where Name='TitleAlignment' limit 1";
				$result = mysql_query($query) or die (mysql_error());
				
				
				
				$query = "select * from `".$Settings['DBPrefix']."lm-Settings` where Name='TitleImage' limit 1";
				$result = mysql_query($query) or die (mysql_error());
				if (mysql_num_rows($result) > 0) {
					$query = "update `".$Settings['DBPrefix']."lm-Settings` set Value='".$FormArguments['TitleImage']."' where Name='TitleImage' limit 1";
					$result = mysql_query($query) or die (mysql_error());
				}
				else {
					$query = "insert into `".$Settings['DBPrefix']."lm-Settings` (Name, Value) values ('TitleImage','".$FormArguments['TitleImage']."')";
					$result = mysql_query($query) or die (mysql_error());
				}
				
				
				$query = "select * from `".$Settings['DBPrefix']."lm-Settings` where Name='PageTitle' limit 1";
				$result = mysql_query($query) or die (mysql_error());
				if (mysql_num_rows($result) > 0) {
					$query = "update `".$Settings['DBPrefix']."lm-Settings` set Value='".$FormArguments['PageTitle']."' where Name='PageTitle' limit 1";
					$result = mysql_query($query) or die (mysql_error());
				}
				else {
					$query = "insert into `".$Settings['DBPrefix']."lm-Settings` (Name, Value) values ('PageTitle','".$FormArguments['PageTitle']."')";
					$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();
	
	}
	
	

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




?>
