<?

/*
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 New Smilie
	// ========================================================================================
	
	$PageTitle = $MsgText[0][60];
	$BrowserTitle = $MsgText[0][60];
	$LocationBar = '<a href="'.$IndexURL.'">'.$MsgText[0][1].'</a> > <a href="' . $MainURL . '/options.html">'.$MsgText[0][4].'</a> > '.$MsgText[0][60];
	
	if ($LoggedIn == 'y') {
		
		ReadPermissions();
		Global $Permissions;
		
		// if permissions are correct and arguments haven't been forged
		if ($Permissions[15] == 'y') {
	
		
			$query = "select max(SmilieOrder) as MaxOrder from `".$Settings['DBPrefix']."core-Smilies` limit 1";
			$result = mysql_query($query) or die (mysql_error());
			$row = mysql_fetch_array($result);
				
			$NextOrder = ($row['MaxOrder'] + 1);
			
			
			ReadFormArguments();
			Global $FormArguments;
			
			$query = "insert into `".$Settings['DBPrefix']."core-Smilies` (Description, ImageLink, InsertCode, InsertCode2, InsertCode3, InsertCode4, InsertCode5, Hidden, Enabled, SmilieOrder) values('".$FormArguments['Name']."','".$FormArguments['Filename']."','".$FormArguments['InsertCode1']."','".$FormArguments['InsertCode2']."','".$FormArguments['InsertCode3']."','".$FormArguments['InsertCode4']."','".$FormArguments['InsertCode5']."','".$FormArguments['Hidden']."','".$FormArguments['Enabled']."','".$NextOrder."')";
			$result = mysql_query($query) or die (mysql_error());
		
			
	
			header('Location: '.$MainURL.'/admin/smilies.html');
	
	
		}
		else {
		
			$PageContents = $MsgText[0][97];
		
		}

	}
	else {
	
		RedirectToLogin();
	
	}
	

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




?>
