<?

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



	// ========================================================================================
	// create new link
	// ========================================================================================
	
	
	$query = "select * from `".$Settings['DBPrefix']."lm-Settings`";
	$result = mysql_query($query) or die (mysql_error());
	while ($row = mysql_fetch_array($result)) {
		$lmSettings[$row['Name']] = $row['Value'];
	}
	
	
	$PageTitle = '<img src="'.$ImagesURL.'/admin/admincp_links.gif" width="20" height="21"> '.$MsgText[8][18];
	$BrowserTitle = $MsgText[8][18];
	$LocationBar = '<a href="'.$IndexURL.'">'.$MsgText[0][1].'</a> > <a href="' . $MainURL . '/options.html">'.$MsgText[0][4].'</a> > <a href="'.$MainURL.'/admin/links.html">'.$MsgText[8][2].'</a> > '.$MsgText[8][18];
	
	if ($LoggedIn == 'y') {
		
		ReadPermissions();
		Global $Permissions;
		
		if ($Permissions[801] == 'y') {
		
			ReadFormArguments();
			Global $FormArguments;
			
			if (count($FormArguments) > 0) {
			
				if ($FormArguments['Title'] != '' && $FormArguments['Link'] != '') {
			
					$query = "insert into `".$Settings['DBPrefix']."lm-Links` (Title,Description,Link,ClicksCount,Category,Category2,Category3,Category4,Category5,Category6,Category7,Category8,Category9,Category10) values ('".$FormArguments['Title']."', '".$FormArguments['Description']."', '".$FormArguments['Link']."', '".intval($FormArguments['StartingCount'])."', '".intval($FormArguments['Category'])."', '".intval($FormArguments['Category2'])."', '".intval($FormArguments['Category3'])."', '".intval($FormArguments['Category4'])."', '".intval($FormArguments['Category5'])."', '".intval($FormArguments['Category6'])."', '".intval($FormArguments['Category7'])."', '".intval($FormArguments['Category8'])."', '".intval($FormArguments['Category9'])."', '".intval($FormArguments['Category10'])."')";
					$result = mysql_query($query) or die (mysql_error());
					
						
					Header('Location: '.$MainURL.'/admin/links.html');
					
				}
				else {
					
					$PageContents = $MsgText[8][27];
				
				}				

			}
			else {
				$PageContents = $MsgText[0][98];
			}
		
		} // end if permissions are sufficient
		else {
		
			$PageContents = $MsgText[0][97];
		
		}

	}
	else {
	
		RedirectToLogin();
	
	}
				
	
	// ========================================================================================




?>
