<?

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



	// ========================================================================================
	// Delete Old Unconfirmed Subscribers
	// ========================================================================================
	
	$query = "select * from `".$Settings['DBPrefix']."nl-Settings`";
	$result = mysql_query($query) or die (mysql_error());
	while ($row = mysql_fetch_array($result)) {
		$nlSettings[$row['Name']] = $row['Value'];
	}
	
	
	$PageTitle = $MsgText[5][3];
	$BrowserTitle = $MsgText[5][3];
	$LocationBar = '<a href="'.$IndexURL.'">'.$MsgText[0][1].'</a> > <a href="' . $MainURL . '/options.html">'.$MsgText[0][4].'</a> > '.$MsgText[5][3];
	
	if ($LoggedIn == 'y') {
		
		ReadPermissions();
		Global $Permissions;
		
		if ($Permissions[502] == 'y') {
							
		
			if ($nlSettings['DoubleOptInMode'] == 'y') {
			// double opt in mode
				
				$query = "delete from `".$Settings['DBPrefix']."nl-Addresses` where DoubleConfirmed!='y' and DateAdded<'".(GetTimestamp()-(60*60*24*30))."'";
				$result = mysql_query($query) or die (mysql_error());
								
				$PageContents = '<br>'.$MsgText[5][46].'<br><br><b><a href="'.$MainURL.'/admin/newsletter_subscribers.html">'.$MsgText[5][3].'</a></b>';
				
			}
			else {
			// not double opt in mode
			
				$PageContents = '<br>'.$MsgText[5][47].'<br><br><b><a href="'.$MainURL.'/admin/newsletter_subscribers.html">'.$MsgText[5][3].'</a></b>';
			
			}
			
			
		}
		else {
		
			$PageContents = $MsgText[0][97];
		
		}

	}
	else {
	
		RedirectToLogin();
	
	}
		


?>
