毕业设计说明书
图书管理系统
(附录)
专业
计算机科学与技术
学生姓名
王锋
班级
B012
学号
0110710218
指导教师
张成彬
完成日期
2005年6月10日
*********************************************************************
用户登陆模块
*********************************************************************
void CPassword::OnOK()
{
BOOL bLogin=FALSE;
CString strPassword;
UpdateData();
if (!("MIS")) return;
CUserRS rs_user(&db);
();
while (!())
{
if (==m_strUser)
{
CLosscardRS rs_loss(&db);
();
while(!())
{
if(==)
{
AfxMessageBox("该用户已被挂失,请找管理员解锁!");
();
return;
}
();
}
();
User=m_strUser;
Authority=;
}
();
}
();
CRecordset rs(&db);
(CRecordset::forwardOnly,
"select 密码 from 用户信息表 where 用户名='"+m_strUser+"'");
if (!())
{
("密码",strPassword);
if (strPassword==CCrypt::Encrypt(m_strPassword,123))
{
bLogin=TRUE;
}
else
{
MessageBox("请确认您的密码是否正确\n 注意大小写!","密码错误");
}
}
else
{
MessageBox("请确认您的用户名是否正确!","无此用户");
}
();
if (bLogin) EndDialog(IDOK);
else ();
}
加密类:
rypt::Encrypt(CString S, WORD Key) // 加密函数
{
CString Result,str;
int i,j;
Result=S; // 初始化结果字符串
for(i=0; i<(); i++) // 依次对字符串中各字符进行操作
{
(i, (i)^(Key>>8)); // 将密钥移位后与字符异或
Key = ((BYTE)(i)+Key)*C1+C2; // 产生下一个密钥
}
S=Result; // 保存结果
(); // 清除结果
for(i=0; i<(); i++) // 对加密结果进行转换
{
j=(BYTE)(i); // 提取字符
// 将字符转换为两个字母保存
str="12"; // 设置str长度为2
(0, 65+j/26);
(1, 65+j%26);
Result += str;
}
return Result;
}
rypt::Decrypt(CString S, WORD Key) // 解密函数
{
CString Result,str;
int i,j;
(); // 清除结果
for(i=0; i < ()/2; i++) // 将字符串两个字母一组进行处理
{
j = ((BYTE)(2*i)-65)*26;
j += (BYTE
图书管理系统-源程序清单 来自淘豆网m.daumloan.com转载请标明出处.