<?php
require_once("referrals_fns.php");
session_start();
do_html_header("Adding a category");
// Make sure the user is logged in
if (check_admin_user())
{
if (empty($catname)) {
echo "No category specified, please try again.";
} else {
// Try to insert the category, retrieve return value
// insert_cateogry() is from db_fns.php
$insert = insert_category($catname);
// value of 0 means error connecting to the database
if ($insert == 0)
{
echo_db_error();
}
// value of 1 means insert was succesful
if ($insert == 1)
{
echo "Category '$catname' was added to the database.<br>";
}
// Value of 2 means category already exists
if ($insert == 2)
{
echo "Category '$catname' already exists.";
}
}
}
else
// User is not logged in
{
echo "You are not authorized to view this page.";
}
do_html_footer();
?>