Location: PHPKode > projects > Convener > manage/settings.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

<html>
<head>
	<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
	<title>Settings for Convener</title>
	<style type="text/css" media="screen">@import "convener.css";</style>
</head>
<body>
<div id="wrapper">
	<div id="menu"><?php include('menu.php');?>
	</div>
	<div id="content"> 

<?php
require('../config.php');
require('../dbfunc.php');
$conveners_id = 1; // now for testing, set by authentication when it's ready

if ($_POST['ok']) { // change the settings according to post-data from the form
	// --- escape post-data
	$sm = escape_smart($_POST['sm']);
	$fs = escape_smart($_POST['fs']);
	// --- update table settings
	mysql_query("UPDATE settings SET sendmails = '$sm' WHERE settings_id = 1") or die(MYSQL_ERROR());	
	mysql_query("UPDATE settings SET freesuggestions = '$fs' WHERE settings_id = 1") or die(MYSQL_ERROR());	
	echo '<p><b>Settings saved.</b></p>';
} 

// --- display form to change settings
$result = mysql_query("SELECT sendmails FROM settings WHERE settings_id = 1") or die(MYSQL_ERROR());
$sm = mysql_fetch_row($result);
$result = mysql_query("SELECT freesuggestions FROM settings WHERE settings_id = 1") or die(MYSQL_ERROR());
$fs = mysql_fetch_row($result);

echo 	'<h2>Settings</h2><form action="settings.php" method="post">
		<p>Send e-mails</p><p> 
		<input type="radio" name="sm" value="1"' . ($sm[0]==1 ? ' checked' : '') .  ' /> Yes
		<input type="radio" name="sm" value="0"' . ($sm[0]==0 ? ' checked' : '') .  ' /> No (testing only)</p>
		
		<p>Format of suggestions</p><p>
		<input type="radio" name="fs" value="1"' . ($fs[0]==1 ? ' checked' : '') .  ' /> Free text
		<input type="radio" name="fs" value="0"' . ($fs[0]==0 ? ' checked' : '') .  ' /> Exact date and location</p>
		
		<p><input type="submit" name="ok" value="Change" /></p></form>';

?>
</div>
</div>
</body>
</html>

Return current item: Convener