mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Total Max User Restriction
Syntax correction.
This commit is contained in:
parent
aa540f7968
commit
a9acb3f1cc
9 changed files with 61 additions and 3 deletions
|
|
@ -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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue