<?

/*
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
*/



	// ========================================================================================
	// email page
	// ========================================================================================
	
	
		ReadFormArguments();
		Global $FormArguments;
				
				
		$FormArguments['SName'] = VerifyCleanString($FormArguments['SName'],2);
		$FormArguments['SEmail'] = VerifyCleanString($FormArguments['SEmail'],1);
		$FormArguments['REmail'] = VerifyCleanString($FormArguments['REmail'],1);
		
		
		
		$FormValidated1 = false;
		if ($FormArguments['A1'] == 1) {
			if (($FormArguments['A4'] == ($FormArguments['A2']*$FormArguments['A3'])) && ($FormArguments['A5'] == ($FormArguments['A2']+$FormArguments['A3']))) {
				$FormValidated1 = true;
			}
		}
		else if ($FormArguments['A1'] == 2) {
			if (($FormArguments['A4'] == ($FormArguments['A2']-$FormArguments['A3'])) && ($FormArguments['A5'] == ($FormArguments['A2']+($FormArguments['A3']*$FormArguments['A2'])))) {
				$FormValidated1 = true;
			}
		}
		else if ($FormArguments['A1'] == 3) {
			if (($FormArguments['A4'] == ($FormArguments['A2']*$FormArguments['A2']*$FormArguments['A3'])) && ($FormArguments['A5'] == ($FormArguments['A3']*$FormArguments['A3']))) {
				$FormValidated1 = true;
			}
		}
		else if ($FormArguments['A1'] == 4) {
			if (($FormArguments['A4'] == ($FormArguments['A2']*$FormArguments['A2'])) && ($FormArguments['A5'] == floor(M_PI*$FormArguments['A2']))) {
				$FormValidated1 = true;
			}
		}
		else if ($FormArguments['A1'] == 5) {
			if (($FormArguments['A4'] == ($FormArguments['A2']*$FormArguments['A3'])-$FormArguments['A2']) && ($FormArguments['A5'] == ($FormArguments['A2']*47)+$FormArguments['A3'])) {
				$FormValidated1 = true;
			}
		}
		
		$FormValidated2 = false;
		if (hexdec($FormArguments['A6']) <= (intval(GetTimestamp()/60/60/24)+2) && $FormArguments['A7'] == substr($Settings['lks'],10,5)) {
			$FormValidated2 = true;
		}
		
		
		
		if ($FormArguments['SName'] != '' && $FormArguments['SEmail'] != '' && $FormArguments['REmail'] != '' && $FormValidated1 == true && $FormValidated2 == true) {
		
			$FormArguments['SName'] = stripslashes($FormArguments['SName']);
			$FormArguments['Comments'] = stripslashes($FormArguments['Comments']);
			
			if ($FormArguments['Comments'] != '') {
				$CommentsAdded = $FormArguments['SName']." included the following comments: \n\n".$FormArguments['Comments'];
			}
		
			$MessageHeaders = 'From: '.$FormArguments['SName'].' <'.$FormArguments['SEmail'].'>';
			
			$Message = "\nGreetings from ".$Settings['SiteName']."!\n\n".$FormArguments['SName'].' thought you would like to see this page: '.$MainURL.$FormArguments['PageLink']."\n\n".$CommentsAdded."\n\n\n\n".$Settings['SiteName']."\n".$BaseURL;
			$MessageHeaders .= $Message;		
			
			
			//if (strpos($FormArguments['REmail'],',') === false) {
				mail($FormArguments['REmail'], 'Page On '.$Settings['SiteName'], "", $MessageHeaders, '-f'.$Settings['ContactEmail']);
			//}
			//else {
			//	$RAddresses = explode(',',$FormArguments['REmail']);
			//	
			//	for ($i = 0; $i < count($RAddresses); $i++) {
			//		if ($RAddresses[$i] != '') {
			//			$RAddresses[$i] = str_replace(' ','',$RAddresses[$i]);
			//			mail($RAddresses[$i], $Settings['SiteName'].' Article: '.$row['Title'], "", $MessageHeaders, '-f'.$Settings['ContactEmail']);
			//		}
			//	}
			//	
			//}
			
			
			//if ($FormArguments['CopyMe'] == 'y') {
			//	mail($FormArguments['SEmail'], $Settings['SiteName'].' Article: '.$row['Title'], "", $MessageHeaders, '-f'.$Settings['ContactEmail']);			
			//}
		
		
			$PageContents = '<br><br><br><br><div align="center">'.$MsgText[7][74].'<br><br><br><br><b><a href="javascript:window.close();">'.$MsgText[7][75].'</a></b></div>';

		}
		else {
				
			$PageContents = '<br><br><div align="center">'.$MsgText[7][76].'<br><br><br><a href="javascript:history.go(-1)"><b>'.$MsgText[7][77].'</b></a></div>';
			
		}


		print '<html><head>
<title>'.$MsgText[7][64].'</title>
<meta name="Description" content="">
<meta name="Keywords" content="">
<meta name="Author" content="">
<meta name="Generator" content="FlexCMS">
<meta name="MSSmartTagsPreventParsing" content="TRUE">
</head>
<body bgcolor="'.$Colors['CLContentBG'].'" text="'.$Colors['Text'].'" link="'.$Colors['Link'].'" vlink="'.$Colors['VLink'].'" alink="'.$Colors['ALink'].'"><font face="'.$FontFace.'" size="'.$FontSize.'">
'.$PageContents.'
</body>
</html>';

		


		exit();
	
	

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




?>
