check whether user is enabled
authorPaul J R <me@pjr.cc>
Wed, 19 Sep 2012 21:10:34 +0000 (07:10 +1000)
committerPaul J R <me@pjr.cc>
Wed, 19 Sep 2012 21:10:34 +0000 (07:10 +1000)
gwvpmini/gwvpmini_auth.php

index f54bd13..c4f1850 100644 (file)
@@ -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) {\r
+               if(isset($_SESSION)) if(isset($_SESSION["id"])) $id = $_SESSION["id"];\r
+       }\r
+       \r
+       if($id == -1) return false;\r
+       \r
+       $lev_t = gwvpmini_getUser(null, null, $id);
+       
+       $lev = $lev_t["status"];\r
+       \r
+       if($lev == 0) return true;\r
+       \r
+       return false;\r
+       
+}
+
 ?>
\ No newline at end of file