<?PHP
/*
This file is part of DNP Script, an open source domain portfolio manager.
Copyright (C) 2011 Robert Picard
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Make sure the user is logged in as the admin
session_start();
if(!$_SESSION['admin']){
header('Location: index.php');
die;
}
require('../config.php');
$con = mysql_connect($db_host, $db_user, $db_pass)
or die('Could not connect to the database: '.mysql_error());
mysql_select_db($db_name, $con);
$title = mysql_result(mysql_query("SELECT * FROM dnp_settings WHERE name='title'"), 0, 'value');
$description = mysql_result(mysql_query("SELECT * FROM dnp_settings WHERE name='description'"), 0, 'value');
$email = mysql_result(mysql_query("SELECT * FROM dnp_settings WHERE name='email'"), 0, 'value');
$analytics = mysql_result(mysql_query("SELECT * FROM dnp_settings WHERE name='analytics'"), 0, 'value');
?>
<h2>Site Settings</h2>
<section class="settings-section">
<h1>Site Title</h1>
<form action="action.php?action=settings" method="post">
<input type="text" value="<?php echo $title; ?>" name="title"/>
<input type="submit" />
</form>
</section>
<section class="settings-section">
<h1>Site Description</h1>
<form action="action.php?action=settings" method="post">
<input type="text" value="<?php echo $description; ?>" name="description" />
<input type="submit" />
</form>
</section>
<section class="settings-section">
<h1>Password</h1>
<span class="description">Enter the new password twice.<br /><br /></span>
<form action="action.php?action=settings" method="post">
<input type="password" name="pass1" />
<input type="password" name="pass2" />
<input type="submit" />
</form>
</section>
<section class="settings-section">
<h1>Email Address</h1>
<form action="action.php?action=settings" method="post">
<input type="email" value="<?php echo $email; ?>" name="email" />
<input type="submit" />
</form>
</section>
<section class="settings-section">
<h1>Google Analytics</h1>
<span class="description">Enter your Google Analytics ID. It should look like UA-XXXXXXXX-X.<br /><br /></span>
<form action="action.php?action=settings" method="post">
<input type="text" value="<?php echo $analytics; ?>" name="analytics" />
<input type="submit" name="analytics-submit" />
</form>
</section>