]> andersk Git - sql-web.git/blobdiff - lib/security.lib.php
check quotas function
[sql-web.git] / lib / security.lib.php
index 03121c4424b7a0cecc7cc05f6ffcc6a076a6c5c3..fca7a0f2279bfd399bc976dc9d2607ff96a0c968 100644 (file)
@@ -87,7 +87,7 @@ class User {
        var $dblist;
     function User($userId) {
                $this->userId = $userId;
-        $sql = sprintf("SELECT User.UserId, Username, Password, Name, Email, UL, bEnabled, nBytesSoft, nBytesHard, nBytes, nDatabases, nDatabasesHard
+        $sql = sprintf("SELECT User.UserId, Username, Password, Name, Email, UL, bEnabled, nBytesSoft, nBytesHard, nBytes, nDatabases, nDatabasesHard, IF(nBytes>nBytesHard,1,0) AS bOverQuota
                         FROM User
                                                INNER JOIN UserQuota ON User.UserId = UserQuota.UserId
                                                INNER JOIN UserStat ON User.UserId = UserStat.UserId
@@ -121,6 +121,9 @@ class User {
     function getUsername() {
         return $this->exists()?$this->info['Username']:'';
     }
+    function isOverQuota() {
+        return $this->exists()?($this->info['bOverQuota']>0?true:false):'';
+    }
     function getBytes() {
         if($this->exists()) {
                        $arr['nBytes'] = $this->info['nBytes'];
@@ -195,6 +198,7 @@ class User {
                                                mysql_escape_string($this->getUserId()));
 //                     $r = fetchRows(DBSelect($sql),'DatabaseId');
                        $r = fetchRows(DBSelect($sql),'Name');
+                       ksort($r);
                        return $r;
                }
        }
This page took 0.032804 seconds and 4 git commands to generate.