// Psw.cpp : implementation file // #include "stdafx.h" #include "ylgl.h" #include "Psw.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // Psw dialog Psw::Psw(CWnd* pParent /*=NULL*/): CDialog(Psw::IDD, pParent) { m_account = _T(""); m_psw = _T(""); m_psw2 = _T(""); m_psw3 = _T(""); } void Psw::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(Psw) DDX_Text(pDX, IDC_EDITaccount, m_account); DDX_Text(pDX, IDC_EDITpsw, m_psw); DDX_Text(pDX, IDC_EDITpsw2, m_psw2); DDX_Text(pDX, IDC_EDITpsw3, m_psw3); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(Psw, CDialog) //{{AFX_MSG_MAP(Psw) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// void Psw::OnOK() { UpdateData(); BYTE byPsw[50] = {0}; #ifndef UNICODE memcpy(byPsw, (LPCSTR)m_psw, m_psw.GetLength()); #endif CMD5 md5; md5.SetBYTEText(byPsw, strlen((char*)byPsw)); CString strMD5 = md5.GetMD5Digest(); if (strMD5 != m_List1array.ElementAt(0).ElementAt(2)) { AfxMessageBox("¾ÉÃÜÂë´íÎó!", MB_ICONINFORMATION); return; } if (m_psw3 != m_psw2) { AfxMessageBox("ÐÂÃÜÂë²»Ò»ÖÁ!", MB_ICONINFORMATION); return; } CString sql; #ifndef UNICODE memset(byPsw, 0 , 50); memcpy(byPsw, (LPCSTR)m_psw3, m_psw3.GetLength()); md5.SetBYTEText(byPsw, strlen((char*)byPsw)); #endif strMD5 = md5.GetMD5Digest(); sql = "update [user] set [psw]='" + strMD5 + "' where [account]='" + m_account + "'"; g_sendhead.bsql = 1; g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return; CDialog::OnOK(); } BOOL Psw::OnInitDialog() { CDialog::OnInitDialog(); g_sendhead.bsql = 0; g_sendhead.code[0] = 23; g_sendhead.tabcount = 1; CString sql; sql = "name='" + g_user.name + "'"; g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return 1; DataToArray(&m_List1array); if (m_List1array.GetSize() == 0) { CDialog::OnCancel(); return true; } m_account = m_List1array.ElementAt(0).ElementAt(0); UpdateData(false); this->CenterWindow(g_pMainWnd); return TRUE; }