X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=testing%2FMCTXWeb%2Fpublic_html%2Fusers%2Flogin.php;h=95b22a40dc64c7821081840ad772ee9af6208f28;hb=828cdbf49f52572e93c5c5a48e05277525a4055f;hp=f0168da116f93e3129160bf0a86b2edd797d6592;hpb=bd5fabfeabdd16cf38642c8cfb2232aab495de31;p=matches%2FMCTX3420.git diff --git a/testing/MCTXWeb/public_html/users/login.php b/testing/MCTXWeb/public_html/users/login.php index f0168da..95b22a4 100644 --- a/testing/MCTXWeb/public_html/users/login.php +++ b/testing/MCTXWeb/public_html/users/login.php @@ -8,7 +8,7 @@ require_once("models/config.php"); if (!securePage($_SERVER['PHP_SELF'])){die();} //Prevent the user visiting the logged in page if he/she is already logged in -if(isUserLoggedIn()) { header("Location: account.php"); die(); } +if(isUserLoggedIn()) { header("Location: index.php"); die(); } //Forms posted if(!empty($_POST)) @@ -47,6 +47,8 @@ if(!empty($_POST)) { //Hash the password and use the salt from the database to compare the password. $entered_pass = generateHash($password,$userdetails["password"]); + + //echo "".$userdetails["password"]; //Wut is dis if($entered_pass != $userdetails["password"]) { @@ -67,13 +69,22 @@ if(!empty($_POST)) $loggedInUser->displayname = $userdetails["display_name"]; $loggedInUser->username = $userdetails["user_name"]; - //Update last sign in - $loggedInUser->updateLastSignIn(); - $_SESSION["userCakeUser"] = $loggedInUser; - - //Redirect to user account page - header("Location: account.php"); - die(); + //Only allow login to admins + if ($loggedInUser->checkPermission(array(2))) + { + //Update last sign in + $loggedInUser->updateLastSignIn(); + + $_SESSION["userCakeUser"] = $loggedInUser; + + //Redirect to user account page + header("Location: index.php"); + die(); + } + else + { + $errors[] = ("You are no admin :("); + } } } } @@ -81,45 +92,44 @@ if(!empty($_POST)) } require_once("models/header.php"); +startPage(); -echo " - -
-
-
-

UserCake

-

Login

-
"; - -include("left-nav.php"); - -echo " -
-
"; - +echo ' +
+
+
Notice
+ This is the login page for site administration.
If you wish to log in + to the main web-site, see here instead. +
+
+
+

+ +

+

+ +

+

+ Forgotten password?
+ Register +

+

+ +

+'; echo resultBlock($errors,$successes); +echo ' +
+
+
+ '; -echo " -
-
-

- - -

-

- - -

-

- - -

-
-
-
-
-
- -"; +finishPage(); ?>