Total Max User Restriction

Syntax correction.
This commit is contained in:
woogerboy21 2015-07-12 22:32:55 -04:00
parent aa540f7968
commit a9acb3f1cc
9 changed files with 61 additions and 3 deletions

View file

@ -805,3 +805,23 @@ bool Servatrice_DatabaseInterface::changeUserPassword(const QString &user, const
}
return false;
}
int Servatrice_DatabaseInterface::getActiveUserCount()
{
int userCount = 0;
if (!checkSql())
return userCount;
QSqlQuery *query = prepareQuery("select count(*) from {prefix}_sessions where id_server = :serverid AND end_time is NULL");
query->bindValue(":serverid", server->getServerId());
if (!execSqlQuery(query)){
return userCount;
}
if (query->next()){
userCount = query->value(0).toInt();
}
return userCount;
}