Location: PHPKode > projects > Butterfly Organizer > cpanel.php
<?php
/*
Butterfly Organizer
Copyright (C) 2007-2008 Butterfly Media Romania

This file is part of Butterfly Organizer.

Butterfly Organizer is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 3 of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

include('includes/top.php');

echo '<h2>Control Panel</h2>';
if (isset($_POST['update'])) {
	$owner = $_POST['owner'];
	$color_empty_account = $_POST['color_empty_account'];
	$color_used_account = $_POST['color_used_account'];
	$sql = "UPDATE settings SET owner='$owner', color_empty_account='$color_empty_account', color_used_account='$color_used_account'";
	if (mysql_query($sql)) {
		echo('<p>Settings updated.</p>');
	}
	else {
		echo('<p>An error ocurred: ' . mysql_error() . '</p>');
	}
}
$result = mysql_query('SELECT owner FROM settings');
$row = mysql_fetch_array($result);
$value_owner = $row['owner'];

$result = mysql_query('SELECT color_used_account FROM settings');
$row = mysql_fetch_array($result);
$value_color_used_account = $row['color_used_account'];

$result = mysql_query('SELECT color_empty_account FROM settings');
$row = mysql_fetch_array($result);
$value_color_empty_account = $row['color_empty_account'];
?>

<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
<h5>General Settings</h5>
<table>
	<tr>
		<td><label for="owner">Your name:</label></td>
		<td><input type="text" name="owner" id="owner" style="width:200px" value="<?php echo $value_owner;?>" /></td>
	</tr>
	<tr>
		<td><label for="color_empty_account">Empty account color:</label></td>
		<td><input type="text" name="color_empty_account" id="color_empty_account" value="<?php echo $value_color_empty_account;?>" /></td>
	</tr>
	<tr>
		<td><label for="color_used_account">Used account color:</label></td>
		<td><input type="text" name="color_used_account" id="color_used_account" value="<?php echo $value_color_used_account;?>" /></td>
	</tr>
</table>
<input type="submit" name="update" value="Update" />
</form>
<?php include('includes/bottom.php');?>
Return current item: Butterfly Organizer