MySQL based on Linux by C (轉)
int LoginJudge(USER_ACCOUNT req)
{
int i=0;
char *name;
char *reqname;
char *pass;
char *reqpass;
reqname=req.Name;
reqpass=req.Password;
if(!(my_connect(&,NULL,"","1111")))
return FALSE;
if(mysql__(&mysql,"serverdb"))
return FALSE;
if (mysql_query(&mysql,"select name,password from main" ))
return FALSE;
if(!(res=mysql_store_result(&mysql)))
return FALSE;
while((row=mysql_fetch_row(res)))
{
name=row[0];
password=row[1];
if (!strcmp(name,reqname))
{
if(!strcmp(password,reqpass))
return TRUE;
else
return FALSE;
}
}
if(! mysql_eof(res))
return FALSE;
mysql_free_result(res);
mysql_close(&mysql);
return FALSE;
}
int authority(char *name)
{
long iBackValue;
char *cDBname;
char *cuthority;
char *cQuename;
char *cValueOne;
char *cValueTwo;
cQuename=name;
cValueOne="1";
cValueTwo="2";
if(!(mysql_connect(&mysql,NULL,"root","1111")))
return FALSE;
if(mysql_select_db(&mysql,"serverdb"))
return FALSE;
if (mysql_query(&mysql,"select name,authority from main" ))
return FALSE;
if(!(res=mysql_store_result(&mysql)))
return FALSE;
while((row=mysql_fetch_row(res)))
{
cDBname=row[0];
cDBauthority=row[1];
if (!strcmp(cDBname,cQuename))
{
if(!strcmp(cValueOne,cDBauthority))
{
iBackValue=1;
if(!strcmp(cValueTwo,cDBauthority))
iBackValue=2;
}
else
iBackValue=3;
}
}
if(! mysql_eof(res))
return FALSE;
mysql_free_result(res);
mysql_close(&mysql);
return iBackValue;
}
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10752043/viewspace-995511/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- SAP C4C OBN(Object Based Navigation)不能工作的原因分析ObjectNavigation
- MySQL Binlogging Fails With Writing One Row To The Row-based Binary Log FailedMySqlAI
- 【轉載】Linux下徹底解除安裝mysql詳解LinuxMySql
- [轉]關於Linux安裝mysql預設配置檔案位置LinuxMySql
- Physically Based Rendering
- MySQL 轉dorisMySql
- Oracle 轉MySqlOracleMySql
- A timer based on timerfd and epoll
- Linux C/C++呼叫mongDBLinuxC++
- Codeforces Round #681 (Div. 2, based on VK Cup 2019-2020 - Final) (A B C D)
- Mysql - 行轉列、列轉行MySql
- C連線MySQLMySql
- mysql安裝 for LinuxMySqlLinux
- Mysql 5.7.21 install for LinuxMySqlLinux
- Linux安裝MySQLLinuxMySql
- Based UE_Project NotesProject
- 轉換日期(C)
- 轉MySQL--mysql常用函式打全MySql函式
- Linux轉包命令Linux
- Linux NAT轉發Linux
- Linux C++ IDELinuxC++IDE
- linux--sh -cLinux
- 【mysql】linux下安裝mysql-5.7.31MySqlLinux
- c# svg轉Bitmap Bitmap轉ImageSourceC#SVG
- 1161:轉進位制(C C++)C++
- mysql 轉義問題MySql
- mysql每日備份for LinuxMySqlLinux
- Linux安裝mysql 8.0LinuxMySql
- Linux下的Mysql操作LinuxMySql
- 最新!linux mysql安裝LinuxMySql
- linux上安裝mysqlLinuxMySql
- Linux啟動mysql命令LinuxMySql
- Linux基礎命令---mysqlLinuxMySql
- mysql linux下安裝MySqlLinux
- Linux中登入mysqlLinuxMySql
- mysql在linux安裝MySqlLinux
- Linux 提權-MySQL UDFLinuxMySql
- linux mysql 找回密碼LinuxMySql密碼
- Network config of Openwrt based ESXI Env