Location: PHPKode > projects > @1 File Store > settings.php
<?

$MustLogin=1|2|4;
require_once("libs/header.php");

// check user level (make sure its admin login)
if($CurUser->getlevel()!=-1){	
	$smarty->assign("errmessage", "Access Denied!");
	$smarty->display("settings.tpl");
	exit();
}

if(isset($_POST["submit"])){
	//****************** PROCESS SUBMITTED FORM ******************
	
	// grab posted data
	$suspension=$_POST["suspension"];
	$gmessage=$_POST["gmessage"];
	$gdisplay=1;
	if(isset($_POST["gdisplay"])){
		$gdisplay=$_POST["gdisplay"];
	}
	
	// update
	$table_suffix="settings";
	$SQL="UPDATE `".DB_PREFIX.$table_suffix."` SET `".DB_PREFIX.$table_suffix."`.greetings='".$gmessage."',`".DB_PREFIX.$table_suffix."`.greetings_display=$gdisplay,`".DB_PREFIX.$table_suffix."`.suspension=$suspension ";
	if(!$mysql->query($SQL)) {
		exit($mysql->error);
	}
}

//****************** DISPLAY FORM ******************	
// grab settings
$table_suffix="settings";
$SQL="SELECT `".DB_PREFIX.$table_suffix."`.greetings,`".DB_PREFIX.$table_suffix."`.greetings_display,`".DB_PREFIX.$table_suffix."`.suspension FROM `".DB_PREFIX.$table_suffix."`";
if(!$mysql->query($SQL)) {
	exit($mysql->error);
}
$settings_list=array();
$settings_list=$mysql->arr;			

$smarty->assign("self", $_SERVER['PHP_SELF']);
if($settings_list["suspension"]==1)
	$smarty->assign("suspension_e", 'checked="checked"');
else
	$smarty->assign("suspension_d", 'checked="checked"');
	
$smarty->assign("gmessage", $settings_list["greetings"]);
if($settings_list["greetings_display"]==0)
	$smarty->assign("gdisplay", 'checked="checked"');	
$smarty->display("settings.tpl");
?>
Return current item: @1 File Store