<?PHP
#############################################################################
# This file is part of Shiftlog. #
# #
# Shiftlog 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 3 of the License, or #
# (at your option) any later version. #
# #
# Shiftlog 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, see <http://www.gnu.org/licenses/>. #
#############################################################################
//check if your loged in if not get ya back to the login page.
if($logged_in)
{
//connect to the database and check current users group membership
$conn;
$user_query="SELECT group_id FROM users WHERE username='$username'";
$result=mysql_query($user_query);
$line=mysql_fetch_array($result);
//If a member of staff
if ($line['group_id'] == 1)
{
//Check if the log is online if not post down for maintenance
if ($log_status == 1)
{
include("../template/header.htm");
}
else
{
echo "<html><head><title>Down for maintenance</title></head><body>The Shift Log is currently offline for maintenance.</body></html>";
return;
}
}
//If a member of management
elseif ($line['group_id'] >=2)
{
//Check if the log is online if not say so at the top of the page
if ($log_status == 1)
{
include("../template/header.htm");
}
else
{
include("../template/header.htm");
}
//If you were not in a group go back to index (possible endless loop here)
}
else
{
header( 'Location: ../index.php' );
}
//If your not loged in, go to the login page
}
else
{
header( 'Location: ../index.php' );
}
?>