SHARE
TWEET

Untitled

a guest Jul 31st, 2019 117 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.     try {
  9.         if (query.exec())
  10.         {
  11.            if (query.next())
  12.            {
  13.               // it exists
  14.               qDebug() << "Query existe!";
  15.               return true;
  16.            }
  17.            else {
  18.                 qDebug() << "Query não existe!";
  19.                 return  false;
  20.            }
  21.         }
  22.     } catch (QException ex) {
  23.         qDebug() << "Erro ao identificar login de usuário";
  24.     }
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top