# Password Authentication- This sucks...
$PHP_AUTH_USER=$_SERVER["PHP_AUTH_USER"];
$PHP_AUTH_PW=$_SERVER["PHP_AUTH_PW"];
if (!isset($PHP_AUTH_USER) || (isset($Logout))) {
Header("WWW-Authenticate: Basic realm=\"Installfest2002 Admin Page\"");
Header("HTTP/1.0 401 Unauthorized");
echo "
You are unauthorised to enter this site.
\n";
exit;
} else {
if (($PHP_AUTH_USER != "installfest") || ($PHP_AUTH_PW != "december")) {
Header("HTTP/1.0 401 Unauthorized");
echo "\n";
echo "You are unauthorised to enter this site.
\n";
exit;
}
}
?>
# Installfest Webpage - a php/postgresql/apache instant Linux
# installfest web page and database.
# Copyright (C) 2001 Michael Davies (michaeld@senet.com.au) & Phil Hutton (phil@hutton.sh)
#
# This program 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; either version 2 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 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 "vars.inc";
include "colours.inc";
include "common.inc";
include "fest.inc";
include "festtemplate.inc";
include "../connmgr.inc";
function processAdminRequests() {
global $delete_installee;
global $delete_helper;
global $delete_todo;
global $delete_minutes;
global $addtodo;
global $addminutes;
global $completed_todo;
global $uncompleted_todo;
$delete_installee=$_POST["delete_installee"];
$delete_helper=$_POST["delete_helper"];
$delete_todo=$_POST["delete_todo"];
$delete_minutes=$_POST["delete_minutes"];
$addtodo=$_POST["addtodo"];
$addminutes=$_POST["addminutes"];
$completed_todo=$_POST["completed_todo"];
$uncompleted_todo=$_POST["uncompleted_todo"];
if (isset($delete_helper) and ereg("^[0-9]+$", $delete_helper)) {
$sql = "DELETE FROM helpers WHERE id = $delete_helper;";
# Now put this in the database
$connection = getdbconn();
if (!$connection) {
echo "Whoops! an error occured connecting to the ";
echo "LinuxSA database (for table helper). Sorry.\n";
closedbconn();
exit;
}
#$result = pg_exec ($connection, $sql);
$result = mysql_query ($sql);
if (!$result) {
echo "Error - Problem deleting data in";
echo " helper table
";
echo "Please click ";
echo "here";
echo " to reload this page, or your browser's Bacl key to try again.";
}
closedbconn();
} else {
if (isset($delete_installee) and ereg("^[0-9]+$", $delete_installee)) {
$sql = "DELETE FROM installees WHERE id = $delete_installee;";
# Now put this in the database
$connection = getdbconn();
if (!$connection) {
echo "Whoops! an error occured connecting to the ";
echo "LinuxSA database (for table installees). Sorry.\n";
closedbconn();
exit;
}
#@$result = pg_exec ($connection, $sql);
$result = mysql_query ( $sql);
if (!$result) {
echo "
Error - Cannot delete data in";
echo " installees table
";
echo "Please click ";
echo "here";
echo " to reload this page, or your browser's Back key to try again.";
}
closedbconn();
} else {
if (isset($delete_todo) and ereg("^[0-9]+$", $delete_todo)) {
$sql = "DELETE FROM todo WHERE id = $delete_todo;";
# Now put this in the database
@$connection = getdbconn();
if (!$connection) {
echo "Whoops! an error occured connecting to the ";
echo "LinuxSA database (for table todo). Sorry.\n";
closedbconn();
exit;
}
#@$result = pg_exec ($connection, $sql);
$result = mysql_query ( $sql );
if (!$result) {
echo "
Error - Cannot delete data in";
echo " todo table
";
echo "Please click ";
echo "here";
echo " to reload this page, or your browser's Back key to try again.";
}
closedbconn();
} else {
$completed_todo=$_POST["completed_todo"];
$uncompleted_todo=$_POST["uncompleted_todo"];
if ((isset($completed_todo) && ereg("^[0-9]+$", $completed_todo)) ||
(isset($uncompleted_todo) && ereg("^[0-9]+$", $uncompleted_todo))) {
if (isset($completed_todo)) {
$sql = "UPDATE todo SET completed = 'TRUE' where id = $completed_todo";
} else {
$sql = "UPDATE todo SET completed = 'FALSE' where id = $uncompleted_todo";
}
# Now put this in the database
@$connection = getdbconn();
if (!$connection) {
echo "Whoops! an error occured connecting to the ";
echo "LinuxSA database (for table todo). Sorry.\n";
closedbconn();
exit;
}
#@$result = pg_exec ($connection, $sql);
$result = mysql_query ($sql);
if (!$result) {
echo "
Error - Cannot delete data in";
echo " todo table
";
echo "Please click ";
echo "here";
echo " to reload this page, or your browser's Back key to try again.";
}
closedbconn();
} else {
if (isset($delete_minutes) and ereg("^[0-9]+$", $delete_minutes)) {
$sql = "DELETE FROM minutes WHERE id = $delete_minutes;";
@$connection = getdbconn();
if (!$connection) {
echo "Whoops! an error occured connecting to the ";
echo "LinuxSA database (for table minutes). Sorry.\n";
closedbconn();
exit;
}
@$result = pg_exec ($connection, $sql);
$result = mysql_query($sql);
if (!$result) {
echo "
Error - Cannot delete data in";
echo " minutes table
";
echo "Please click ";
echo "here";
echo " to reload this page, or your browser's Back key to try again.";
}
closedbconn();
}
else
{
if (isset($_POST["addtodo"]) || isset($_POST["addminutes"])) {
global $name;
global $email;
global $text;
global $info;
global $title;
echo "
Adding todo or minutes item
\n";
if (((!$_POST["name"]) || (!$_POST["email"]) || (!$_POST["text"])) &&
((!$_POST["title"]) || (!$_POST["info"]))) {
echo "Sorry Unacceptable -
\n";
echo "
\n";
if (!$_POST["name"])
echo "You need to supply your name
\n";
if (!$_POST["email"])
echo "You need to supply your email
\n";
if (!$_POST["text"])
echo "You need to supply your todo item
\n";
if (!$_POST["title"])
echo "You need to supply your title item
\n";
if (!$_POST["info"])
echo "You need to supply your info item
\n";
echo "
\n";
echo "
\n";
echo "Hit back on your browser window to re-enter data.\n";
} else {
# Now put this in the database
$connection = getdbconn();
if (!$connection) {
echo "Whoops! an error occured. Sorry.\n";
closedbconn();
}
if (isset($_POST["addtodo"])) {
$name = addslashes($_POST["name"]);
$email = addslashes($_POST["email"]);
$text = addslashes($_POST["text"]);
$sql = "INSERT INTO todo (name, email, text, completed) VALUES ('$name', '$email', '$text', 'FALSE')";
} else {
if (isset($_POST["addminutes"])) {
$title = addslashes($_POST["title"]);
$info = addslashes($_POST["info"]);
$sql = "INSERT INTO minutes (title, info) VALUES ('$title', '$info')";
}
}
#$result = pg_exec ($connection, $sql);
$result = mysql_query( $sql);
if (!$result) {
echo "Error - Could not add ToDo/Minutes item";
echo " - data lost.
";
echo "Please click ";
echo "here";
echo " to reload this page, or your browser's Back key to try again.";
}
closedbconn();
}
}
}
}
}
}
}
}
function dumpInstalleeDB() {
$connection = getdbconn();
if (!$connection) {
echo "Whoops! an error occured. Sorry.\n";
}
$sql = "select * from installees";
//@$result = pg_exec ($connection, $sql);
//@$rows = pg_NumRows($result);
$result = mysql_query ($sql);
$rows = mysql_num_rows($result);
echo "
Installees Database ($rows";
if ($rows == 1) {
echo " person registered).
\n";
} else {
echo " people registered).\n";
}
if (!$result) {
echo "Error - no installees registered!?!
\n";
echo "\n";
echo "\n";
echo "\n";
echo "\n";
echo "\n";
echo "
\n";
echo "
\n";
echo " footerStd(); ?>\n";
echo "