From: Paul J R Date: Wed, 19 Sep 2012 21:10:34 +0000 (+1000) Subject: check whether user is enabled X-Git-Url: http://git.pjr.cc/?a=commitdiff_plain;h=ed6b04122ec87a22105ed1f67144b7342fd9c523;p=gwvp-mini.git check whether user is enabled --- diff --git a/gwvpmini/gwvpmini_auth.php b/gwvpmini/gwvpmini_auth.php index f54bd13..c4f1850 100644 --- a/gwvpmini/gwvpmini_auth.php +++ b/gwvpmini/gwvpmini_auth.php @@ -88,6 +88,7 @@ function gwvpmini_isLoggedIn() if(isset($_SESSION)) { if(isset($_SESSION["username"])) { + if(!gwvpmini_isUserEnabled($_SESSION["id"])) return false; return true; } } @@ -164,4 +165,22 @@ function gwvpmini_authUserPass($user, $pass) return $details["username"]; } +function gwvpmini_isUserEnabled($id=-1) +{ + if($id == -1) { + if(isset($_SESSION)) if(isset($_SESSION["id"])) $id = $_SESSION["id"]; + } + + if($id == -1) return false; + + $lev_t = gwvpmini_getUser(null, null, $id); + + $lev = $lev_t["status"]; + + if($lev == 0) return true; + + return false; + +} + ?> \ No newline at end of file