GNU Computer Monitoring
Version 0.0.12, December 12, 2007
the_title = $title;
$this->database = false;
$this->path = $path;
session_start();
set_error_handler("error");
}
function Head()
{
?>
the_title ?>
";
}
function Tail()
{
if ($this->database)
{
pg_close($this->database);
}
echo "
";
echo "";
echo "";
}
function Showpage()
{
global $last_error;
$this->config = new gnucomo_config;
$this->config->read("gnucomo");
$this->Head();
if (empty($_SESSION['username']))
{
// Nobody logged in yet.
if (isset($_POST['username']) && isset($_POST['password']))
{
// Login form submitted. Try to start a new session.
$name = $_POST['username']; // PostgreSQL username
$passw = $_POST['password']; // PostgreSQL user password
// Connect to the database
$this->database = pg_connect($this->config->Database($name, $passw));
if ($this->database == false)
{
$last_error = "Login Incorrect";
login_form();
}
else
{
//DEPRECATED session_register('username');
$_SESSION['username'] = $name;
//DEPRECATED session_register('password');
$_SESSION['password'] = $passw;
$this->Body();
}
}
else
{
// Nobody tried to login yet. Present the login form.
login_form();
}
}
else
{
$name = $_SESSION['username']; // PostgreSQL username
$passw = $_SESSION['password']; // PostgreSQL user password
// Connect to the database
$this->database = pg_connect($this->config->Database($name, $passw));
$this->Body();
}
$this->Tail();
}
}