Advertisement
Guest User

Untitled

a guest
Jul 31st, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. bool DBManager::LoginCheck(const QString &usuario, const QString &senha)
  2. {
  3.     QSqlQuery query;
  4.     query.prepare("SELECT * FROM usuarios WHERE usuario = :usuario and senha = :senha");
  5.     query.bindValue(":usuario", usuario);
  6.     query.bindValue(":senha", QString(QCryptographicHash::hash((senha.toUtf8()),QCryptographicHash::Md5).toHex()));
  7.  
  8.     if (query.exec())
  9.     {
  10.        if (query.next())
  11.        {
  12.           // it exists
  13.           qDebug() << "Query existe!";
  14.           return true;
  15.        }
  16.        else {
  17.             qDebug() << "Query não existe!";
  18.             return  false;
  19.        }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement