diff --git a/admin/committees.php b/admin/committees.php
index f0f0e35..dedd40f 100644
--- a/admin/committees.php
+++ b/admin/committees.php
@@ -23,6 +23,8 @@
?>
require("../common.inc.php");
+ auth_required('admin');
+
send_header("Administration - Committee Management");
?>
diff --git a/admin/index.php b/admin/index.php
index 2320fb5..414b32b 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -23,6 +23,7 @@
?>
require("../common.inc.php");
+ auth_required('admin');
send_header("Administration");
echo error(i18n("Note: this section will normally be password protected. It is left open for now for debugging and testing purposes"));
diff --git a/admin/registration.php b/admin/registration.php
index 5ed5bb5..0cfc7b0 100644
--- a/admin/registration.php
+++ b/admin/registration.php
@@ -23,6 +23,7 @@
?>
require("../common.inc.php");
+ auth_required('admin');
send_header("Administration - Participant Registration");
echo "<< ".i18n("Back to Administration")."
";
echo "
";
diff --git a/admin/registration_list.php b/admin/registration_list.php
index f0f200a..b1617d0 100644
--- a/admin/registration_list.php
+++ b/admin/registration_list.php
@@ -23,6 +23,7 @@
?>
require("../common.inc.php");
+ auth_required('admin');
require("../register_participants.inc.php");
send_header("Participant Registration - List and Statistics");
diff --git a/admin/registration_receivedforms.php b/admin/registration_receivedforms.php
index df98005..89c4d1c 100644
--- a/admin/registration_receivedforms.php
+++ b/admin/registration_receivedforms.php
@@ -23,6 +23,7 @@
?>
require("../common.inc.php");
+ auth_required('admin');
require("../register_participants.inc.php");
send_header("Participant Registration - Received Forms");
diff --git a/admin/reports.php b/admin/reports.php
index 3988c47..05a9a24 100644
--- a/admin/reports.php
+++ b/admin/reports.php
@@ -23,6 +23,7 @@
?>
require("../common.inc.php");
+ auth_required('admin');
send_header("Administration - Reports");
echo "<< ".i18n("Back to Administration")."
";
echo "
";
diff --git a/admin/reports_checkin.php b/admin/reports_checkin.php
index 6d8f36a..282c605 100644
--- a/admin/reports_checkin.php
+++ b/admin/reports_checkin.php
@@ -23,6 +23,7 @@
?>
require("../common.inc.php");
+ auth_required('admin');
require("../lpdf.php");
$catq=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' AND id='".$_GET['cat']."'");
diff --git a/committee_auth.php b/committee_auth.php
new file mode 100644
index 0000000..d07ea55
--- /dev/null
+++ b/committee_auth.php
@@ -0,0 +1,45 @@
+
+
+$accesscache=array();
+
+function auth_has_access($access="")
+{
+ global $accesscache;
+
+ if(in_array($access,$accesscache))
+ {
+ if($accesscache[$access]=='Y') return true;
+ else return false;
+ }
+ else
+ {
+ $q=mysql_query("SELECT access_admin, access_config, access_super FROM committees_members WHERE email='".$_SESSION['email']."' AND id='".$_SESSION['committee_member_id']."' AND deleted='N'");
+
+ $r=mysql_fetch_object($q);
+ $accesscache['admin']=$r->access_admin;
+ $accesscache['config']=$r->access_config;
+ $accesscache['super']=$r->access_super;
+
+ switch($access)
+ {
+ case "config": if($r->access_config=='Y') return true; break;
+ case "admin": if($r->access_admin=='Y') return true; break;
+ case "super": if($r->access_super=='Y') return true; break;
+ default:
+ return false;
+ break;
+ }
+ }
+ return false;
+
+}
+
+function auth_required($access="")
+{
+ global $config;
+
+ if(!auth_has_access($access))
+ header("Location: ".$config['SFIABDIRECTORY']."/committee_login.php");
+}
+
+?>
diff --git a/committee_login.php b/committee_login.php
new file mode 100644
index 0000000..c2d76de
--- /dev/null
+++ b/committee_login.php
@@ -0,0 +1,61 @@
+
+ require("common.inc.php");
+
+ if($_POST['action']=="login" )
+ {
+ if($_POST['pass'] && $_POST['email'])
+ {
+ $q=mysql_query("SELECT * FROM committees_members WHERE email='".$_POST['email']."' AND password='".$_POST['pass']."' AND deleted='N'");
+ if(mysql_num_rows($q)==1)
+ {
+ $r=mysql_fetch_object($q);
+ $_SESSION['email']=$r->email;
+ $_SESSION['committee_member_id']=$r->id;
+ send_header("Committee Login");
+ echo happy(i18n("Successfully logged in"));
+ echo i18n("Use the menu on the left to access the committee pages");
+ }
+ else
+ {
+ send_header("Committee Login");
+ echo error(i18n("Invalid Email/Password"));
+ }
+
+ }
+ else
+ {
+ send_header("Committee Login");
+ echo error(i18n("Email/Password missing"));
+ }
+ }
+ else if($_GET['action']=="logout")
+ {
+ unset($_SESSION['email']);
+ unset($_SESSION['committee_member_id']);
+ send_header("Committee Login");
+ echo notice(i18n("You have been successfully logged out"));
+ }
+ else
+ {
+
+ send_header("Committee Login");
+
+ ?>
+