Created
July 17, 2014 10:45
-
-
Save erayarslan/7af404dde12b39b7f706 to your computer and use it in GitHub Desktop.
MD5 Login
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
#include "md5.h" | |
#include "include/mysql.h" | |
#include <iostream> | |
#include <string> | |
#include <sstream> | |
using namespace std; | |
int main() | |
{ | |
MD5 sifrele; | |
string kadi; | |
string sifrelenmis; | |
char sifre[100]; | |
cout<<"Kullanici Adi : "; | |
cin>>kadi; | |
cout<<"Sifre : "; | |
cin>>sifre; | |
sifrelenmis=sifrele.digestString(sifre); | |
ostringstream query; | |
query << "select count(*) from kullanicilar where kullaniciadi = '"<<kadi<<"' and sifre = '"<<sifrelenmis<<"'"; | |
MYSQL *_MySQLConnection = mysql_init(NULL); | |
mysql_real_connect(_MySQLConnection,"mysqlhostip", "mysqlkullaniciadi", "mysqlsifre", "mysqlveritabani", 0, NULL, 0); | |
mysql_query(_MySQLConnection, query.str().c_str()); | |
MYSQL_RES *result = mysql_store_result(_MySQLConnection); | |
MYSQL_ROW row; | |
while ((row = mysql_fetch_row(result))) | |
{ | |
int i = atoi (row[0]); | |
if(i>=1) | |
{ | |
cout<<endl<<">Giris Yapildi"; | |
} | |
else | |
{ | |
cout<<endl<<">Uzgunuz , ..."; | |
} | |
} | |
mysql_free_result(result); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment