Login3.cpp 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812
  1. // Login3.cpp: implementation of the Login3 class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #include "stdafx.h"
  5. #include "YLGL.h"
  6. #include "Login3.h"
  7. #include "DigitalWorkSet2.h"
  8. #include "ShowMsg.h"
  9. #include "ShowBakState.h"
  10. #ifdef _DEBUG
  11. #undef THIS_FILE
  12. static char THIS_FILE[] = __FILE__;
  13. #define new DEBUG_NEW
  14. #endif
  15. //////////////////////////////////////////////////////////////////////
  16. // Construction/Destruction
  17. //////////////////////////////////////////////////////////////////////
  18. //extern void WriteClientLog(CString str); // Jeff写客户端日志;
  19. Login3::Login3()
  20. {
  21. m_psw = _T("");
  22. m_bsave = FALSE;
  23. m_account = _T("");
  24. g_pMainWnd->GetSkin();
  25. }
  26. Login3::~Login3()
  27. {
  28. }
  29. void Login3::OnFSCommand(LPCTSTR command, LPCTSTR args)
  30. {
  31. }
  32. // ***********************************************最严重的漏洞后门*********************************************************************//
  33. // Jeff.
  34. // remark by Jeff. 2014.09.04
  35. // 用户登录的验证信息,不可放在客户里做验证。
  36. // 同时,客户端在未验证自身身份时,禁止读取数据库里的用户表;
  37. // 以下代码,有严重的后门可供侵入。
  38. //
  39. // 新建登录处理过程:
  40. // int LoginVerify(__in const TCHAR *pAccount,__in const int &nAccountLen, __in const TCHAR *pPassWord, __in const int &nPassWordLen);
  41. //
  42. // 同理,在未登录前,客户端不能读写数据库的任何信息,即需要对welcome对话框进行处理.
  43. //
  44. // ***********************************************************************************************************************************//
  45. void Login3::Init()
  46. {
  47. m_combobox.Create(WS_VSCROLL | WS_CHILD | CBS_DROPDOWN, m_rcarray.ElementAt(2), this, 100);
  48. m_combobox.ShowWindow(SW_SHOW);
  49. // m_combobox.SetFocus(); // Add by Jeff //无效;
  50. CRect rc = m_rcarray.ElementAt(2);
  51. rc.bottom += 200;
  52. m_combobox.MoveWindow(rc);
  53. m_combobox.GetWindowRect(rc);
  54. int hei = rc.Height();
  55. rc = m_rcarray.ElementAt(3);
  56. rc.bottom = rc.top + hei + 5;
  57. m_edit.Create(ES_AUTOHSCROLL | WS_CHILD | ES_LEFT | WS_BORDER | ES_PASSWORD | WS_EX_WINDOWEDGE, rc, this, 200);
  58. m_edit.ShowWindow(SW_SHOW);
  59. rc = m_rcarray.ElementAt(4);
  60. rc.bottom = rc.top + 13;
  61. rc.right = rc.left + 13;
  62. m_button.Create("", WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX | BS_FLAT, rc, this, 300);
  63. tpFont.CreatePointFont(180, _T("黑体"));
  64. m_edit.SetFont(&tpFont);
  65. m_combobox.SetFont(&tpFont);
  66. /////////////////////////
  67. #if JEFF_TEST_ON
  68. g_sendhead.bsql = 0;
  69. g_sendhead.code[0] = 24; // Jeff.version表;版本信息;
  70. g_sendhead.code[1] = 29; // Jeff.path表;路径
  71. g_sendhead.code[2] = 5; // Jeff.renyuan表;人员表;
  72. g_sendhead.code[3] = 1; // Jeff.historydb表;历史数据库;
  73. g_sendhead.code[4] = 171; // Jeff.childmsg表;其实就是"资料与相片备份状态"
  74. if (g_branchname == "")
  75. {
  76. g_sendhead.code[5] = 152; // Jeff.不读任何表,读brachinfo.dat文件里的数据;
  77. g_sendhead.tabcount = 6;
  78. }
  79. else
  80. g_sendhead.tabcount = 5;
  81. int g_nYearposTemp = g_nYearpos;
  82. g_nYearpos = -1;
  83. g_pMainWnd->ProcessChatMessageRequest2(";;;;;");
  84. g_nYearpos = g_nYearposTemp;
  85. if (g_bSendOK == 0)
  86. {
  87. CDialog::OnCancel();
  88. return;
  89. }
  90. CArray<CStringArray, CStringArray>patharray;
  91. CArray<CStringArray, CStringArray>userarray;
  92. if (g_branchname == "")
  93. DataToArray( &g_cominfoarray, &patharray, &userarray, &g_hisyeararray, &g_bakstatearray, &g_brancharray);
  94. else
  95. DataToArray( &g_cominfoarray, &patharray, &userarray, &g_hisyeararray, &g_bakstatearray);
  96. #else
  97. g_sendhead.bsql = 0;
  98. g_sendhead.code[0] = 23; // Jeff.accountview视图;用户
  99. g_sendhead.code[1] = 24; // Jeff.version表;版本信息;
  100. g_sendhead.code[2] = 29; // Jeff.path表;路径
  101. g_sendhead.code[3] = 5; // Jeff.renyuan表;人员表;
  102. g_sendhead.code[4] = 1; // Jeff.historydb表;历史数据库;
  103. g_sendhead.code[5] = 171; // Jeff.childmsg表;其实就是"资料与相片备份状态"
  104. if (g_branchname == "")
  105. {
  106. g_sendhead.code[6] = 152; // Jeff.不读任何表,读brachinfo.dat文件里的数据;
  107. g_sendhead.tabcount = 7;
  108. }
  109. else
  110. g_sendhead.tabcount = 6;
  111. int g_nYearposTemp = g_nYearpos;
  112. g_nYearpos = -1;
  113. g_pMainWnd->ProcessChatMessageRequest2("[staff_dimission]<>'离职' or [staff_dimission] is null;;;;;;");
  114. g_nYearpos = g_nYearposTemp;
  115. if (g_bSendOK == 0)
  116. {
  117. CDialog::OnCancel();
  118. return;
  119. }
  120. CArray<CStringArray, CStringArray>patharray;
  121. CArray<CStringArray, CStringArray>userarray;
  122. if (g_branchname == "")
  123. DataToArray(&m_ArrayOfAccountInfo, &g_cominfoarray, &patharray, &userarray, &g_hisyeararray, &g_bakstatearray, &g_brancharray);
  124. else
  125. DataToArray(&m_ArrayOfAccountInfo, &g_cominfoarray, &patharray, &userarray, &g_hisyeararray, &g_bakstatearray);
  126. #endif
  127. if (g_branchname == "")
  128. {
  129. g_cominfoarraylocal.SetSize(1, 1);
  130. g_cominfoarraylocal.ElementAt(0).Copy(g_cominfoarray.ElementAt(0));
  131. }
  132. CheckBakState(); // Jeff.启用客户端时,先检测"资料与照片备份状态"
  133. if (g_branchname == "")
  134. {
  135. g_domain = patharray.ElementAt(0).ElementAt(0);
  136. if (g_domain.Find(".ly.com") == -1)g_domain.Empty();
  137. g_bSaveUploadTask1 = atoi(g_cominfoarray.ElementAt(0).ElementAt(67));
  138. g_bSaveUploadTask2 = atoi(g_cominfoarray.ElementAt(0).ElementAt(68));
  139. g_bSaveUploadTask3 = atoi(g_cominfoarray.ElementAt(0).ElementAt(69));
  140. g_bSaveUploadTask4 = atoi(g_cominfoarray.ElementAt(0).ElementAt(70));
  141. }
  142. CString version = _T("Version 1.0");
  143. BOOL bHide = atoi(g_cominfoarray.ElementAt(0).ElementAt(58));
  144. AfxGetApp()->WriteProfileInt(version, "hidewindow2", bHide);
  145. g_AryStaff.SetSize(userarray.GetSize(), 1);
  146. int count = 0;
  147. for (int ii = 0; ii < userarray.GetSize(); ii++)
  148. {
  149. if (DAL::GetStaffDimission(userarray,ii) == "在职")
  150. g_AryStaff.ElementAt(count++).Copy(userarray.ElementAt(ii));
  151. }
  152. g_AryStaff.SetSize(count, 1);
  153. #ifdef TESTHG
  154. if (0)
  155. #else
  156. #if 0
  157. if (g_cominfoarray.ElementAt(0).ElementAt(0) != "629")
  158. #else
  159. CString strVersion;
  160. strVersion.Format("%02d%02d", g_arrFileVersion[2], g_arrFileVersion[3]);
  161. if (g_cominfoarray.ElementAt(0).ElementAt(0) != strVersion)
  162. #endif
  163. #endif
  164. {
  165. AfxMessageBox("您必须更新软件才能继续使用, 请与系统管理员联系!", MB_ICONINFORMATION);
  166. CDialog::OnCancel();
  167. g_pMainWnd->AutoUpdate();
  168. return;
  169. }
  170. #ifndef ENTERPRISE_VERSION
  171. {
  172. #ifndef CHILD_VERSION
  173. #ifdef BASIC_VERSION
  174. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="0")
  175. {
  176. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  177. exit(0);return;
  178. }
  179. #else
  180. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  181. {
  182. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  183. exit(0);return;
  184. }
  185. #endif
  186. #else
  187. #ifdef BASIC_VERSION
  188. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  189. {
  190. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  191. exit(0);return;
  192. }
  193. #else
  194. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="3")
  195. {
  196. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  197. exit(0);return;
  198. }
  199. #endif
  200. #endif
  201. }
  202. #else
  203. {
  204. #ifndef CHILD_VERSION
  205. #ifdef BASIC_VERSION
  206. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  207. {
  208. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  209. exit(0);return ;
  210. }
  211. #else
  212. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="5")
  213. {
  214. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  215. exit(0);return ;
  216. }
  217. #endif
  218. #else
  219. #ifdef BASIC_VERSION
  220. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="6")
  221. {
  222. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  223. exit(0);return ;
  224. }
  225. #else
  226. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  227. {
  228. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  229. exit(0); return;
  230. }
  231. #endif
  232. #endif
  233. }
  234. #endif
  235. g_title = g_cominfoarray.ElementAt(0).ElementAt(10);
  236. WriteTitle(g_cominfoarray.ElementAt(0).ElementAt(10));
  237. g_date = g_cominfoarray.ElementAt(0).ElementAt(1);
  238. if (g_hisyeararray.GetSize())
  239. {
  240. g_pMainWnd->AddHistoryMenu(&g_hisyeararray);
  241. }
  242. if (g_brancharray.GetSize() && g_branchname == "")
  243. {
  244. // WriteClientLog("启动集团版菜单");
  245. g_pMainWnd->AddBranchMenu(&g_brancharray); // 添加操作分店菜单;
  246. }
  247. if (g_branchname == "")
  248. {
  249. if (g_server == "127.0.0.1")
  250. {
  251. g_sendhead.bsql = 0;
  252. g_sendhead.code[0] = 63;
  253. g_sendhead.tabcount = 1;
  254. g_pMainWnd->ProcessChatMessageRequest2(1);
  255. if (g_bSendOK == 0)
  256. {
  257. CDialog::OnCancel();
  258. return;
  259. }
  260. DataToArray(&g_List1array);
  261. g_path1 = g_List1array.ElementAt(0).ElementAt(0) + "\\客户原片(管理软件)$";
  262. g_path2 = g_List1array.ElementAt(0).ElementAt(0) + "\\修好的片(管理软件)$";
  263. g_path3 = g_List1array.ElementAt(0).ElementAt(0) + "\\设计好的片(管理软件)$";
  264. g_path4 = g_List1array.ElementAt(0).ElementAt(0) + "\\精修好的片(管理软件)$";
  265. g_path5 = g_List1array.ElementAt(0).ElementAt(0) + "\\礼服图片(管理软件)$";
  266. g_path6 = g_List1array.ElementAt(0).ElementAt(0) + "\\电话录音(管理软件)$";
  267. g_path7 = g_path1 + "\\效果图";
  268. }
  269. else if (patharray.GetSize())
  270. {
  271. // g_serverbak="PC-110817-VYCJ";
  272. g_path1 = g_path2 = g_path3 = g_path4 = g_path5 = g_path6 = g_path7 = g_serverbak;
  273. g_path1 = "\\\\" + g_path1 + "\\客户原片(管理软件)$";
  274. g_path2 = "\\\\" + g_path2 + "\\修好的片(管理软件)$";
  275. g_path3 = "\\\\" + g_path3 + "\\设计好的片(管理软件)$";
  276. g_path4 = "\\\\" + g_path4 + "\\精修好的片(管理软件)$";
  277. g_path5 = "\\\\" + g_path5 + "\\礼服图片(管理软件)$";
  278. g_path6 = "\\\\" + g_path6 + "\\电话录音(管理软件)$";
  279. g_path7 = g_path1 + "\\效果图";
  280. }
  281. g_path1bak = g_path1;
  282. g_path2bak = g_path2;
  283. g_path3bak = g_path3;
  284. g_path4bak = g_path4;
  285. g_path5bak = g_path5;
  286. g_path6bak = g_path6;
  287. g_path7bak = g_path7;
  288. }
  289. try
  290. {
  291. CFile fp;
  292. if (fp.Open(g_mainpath + "\\loginuser.dat", CFile::modeRead))
  293. {
  294. DWORD length = fp.GetLength();
  295. if (!length)
  296. return;
  297. CArchive ar(&fp, CArchive::load);
  298. m_userarray.Serialize(ar);
  299. fp.Close();
  300. for (int i = 0; i < m_userarray.GetSize(); i++)
  301. {
  302. m_combobox.AddString(m_userarray.ElementAt(i));
  303. }
  304. if (m_combobox.GetCount()>0)
  305. {
  306. m_combobox.SetCurSel(0);
  307. m_combobox.GetLBText(0, m_account);
  308. }
  309. if (!m_account.IsEmpty())
  310. {
  311. CString version = _T("Version 1.0");
  312. m_psw = AfxGetApp()->GetProfileString(version, _T(m_account));
  313. if (!m_psw.IsEmpty())
  314. m_bsave = TRUE;
  315. }
  316. SetDlgItemText(200, m_psw);
  317. m_button.SetCheck(m_bsave);
  318. }
  319. }
  320. catch (...)
  321. {
  322. }
  323. }
  324. void Login3::Destory()
  325. {
  326. }
  327. void Login3::BtnClick(WPARAM wParam, LPARAM lParam)
  328. {
  329. int id = lParam;
  330. id -= 99;
  331. switch (id)
  332. {
  333. case 2:
  334. {
  335. MyOnOK();
  336. }
  337. break;
  338. case 1:
  339. CDialog::OnCancel();
  340. break;
  341. }
  342. }
  343. BOOL Login3::PreTransMsg(MSG* pMsg)
  344. {
  345. #if 0 // Add Jeff:使用tab键切换控件;
  346. if (pMsg->message == WM_KEYDOWN && pMsg->message == VK_TAB)
  347. {
  348. // 当前拥有焦点的控件 == m_combobox控件;
  349. if(GetFocus()->GetSafeHwnd() == m_combobox.GetSafeHwnd())
  350. {
  351. // 使m_edit拥有焦点
  352. m_edit.SetFocus();
  353. return TRUE;
  354. }
  355. else if (GetFocus()->GetSafeHwnd() == m_edit.GetSafeHwnd())
  356. {
  357. m_button->SetFocus();
  358. return TRUE;
  359. }
  360. }
  361. else if (pMsg->message == WM_KEYDOWN)
  362. #else
  363. if (pMsg->message == WM_KEYDOWN)
  364. #endif
  365. {
  366. switch (pMsg->wParam)
  367. {
  368. case VK_RETURN:
  369. MyOnOK();
  370. break;// return 1;
  371. case VK_TAB:
  372. {
  373. #if 0
  374. CWnd *pParent = GetParent();
  375. CWnd *pWnd = GetFocus();
  376. //CString strText;
  377. int nCtrlId = pWnd->GetDlgCtrlID();
  378. //m_combobox.m
  379. // LOG4C((LOG_NOTICE,"VK_TAB:%d,%d,%d"),nCtrlId,m_combobox.GetDlgCtrlID(),pParent->GetDlgCtrlID());
  380. #endif
  381. HWND _hwnd = GetFocus()->GetSafeHwnd();
  382. if (_hwnd != m_combobox.m_hWnd && _hwnd != m_edit.m_hWnd && _hwnd != m_button.m_hWnd)
  383. //if( _hwnd == m_combobox.m_hWnd )
  384. {
  385. //LOG4C((LOG_NOTICE,"使m_edit拥有焦点"));
  386. // 使m_edit拥有焦点
  387. m_edit.SetFocus();
  388. // 使密码框的内容清空或者全靠;
  389. //m_combobox.SetFocus();
  390. return TRUE;
  391. }
  392. // else if ( _hwnd == m_combobox.m_hWnd)
  393. // {
  394. // m_edit.SetFocus();
  395. // return TRUE;
  396. // }
  397. else if (_hwnd == m_edit.m_hWnd/*m_edit.GetSafeHwnd()*/)
  398. {
  399. //LOG4C((LOG_NOTICE,"将焦点返回给commbox"));
  400. m_combobox.SetFocus();
  401. return TRUE;
  402. }
  403. }
  404. break;
  405. }
  406. }
  407. else if (pMsg->message == WM_LBUTTONDOWN)
  408. {
  409. g_bNeedDrawParent = 1;
  410. CPoint pt;
  411. ::GetCursorPos(&pt);
  412. ScreenToClient(&pt);
  413. CRect rc;
  414. m_button.GetWindowRect(rc);
  415. ScreenToClient(rc);
  416. if (rc.PtInRect(pt))return CDialog::PreTranslateMessage(pMsg);
  417. if (m_rcarray.ElementAt(4).PtInRect(pt))
  418. {
  419. m_button.SetCheck(!m_button.GetCheck());
  420. }
  421. }
  422. return CDialog::PreTranslateMessage(pMsg);
  423. }
  424. void Login3::SaveLongin()
  425. {
  426. CString version = _T("Version 1.0");
  427. if (m_bsave)
  428. {
  429. AfxGetApp()->WriteProfileString(version, _T(m_account), m_psw);
  430. }
  431. else
  432. {
  433. AfxGetApp()->WriteProfileString(version, _T(m_account), "");
  434. }
  435. if (m_userarray.GetSize())
  436. {
  437. if (m_userarray.ElementAt(0) != m_account)
  438. {
  439. RemoveExist(m_account);
  440. m_userarray.InsertAt(0, m_account);
  441. if (m_userarray.GetSize() > 30)
  442. m_userarray.SetSize(30);
  443. }
  444. }
  445. else
  446. {
  447. m_userarray.Add(m_account);
  448. }
  449. CFile f;
  450. if (!f.Open(g_mainpath + "\\loginuser.dat", CFile::modeWrite | CFile::modeCreate))return;
  451. CArchive ar(&f, CArchive::store);
  452. m_userarray.Serialize(ar);
  453. ar.Close();
  454. f.Close();
  455. }
  456. void Login3::RemoveExist(CString str)
  457. {
  458. for (int i = 0; i < m_userarray.GetSize(); i++)
  459. {
  460. if (str == m_userarray.ElementAt(i))
  461. {
  462. m_userarray.RemoveAt(i);
  463. return;
  464. }
  465. }
  466. }
  467. void Login3::CheckBakState()
  468. {
  469. while (g_bakstatearray.GetSize()>7)
  470. {
  471. g_bakstatearray.RemoveAt(0);
  472. }
  473. int photocount = 0;
  474. int infocount = 0;
  475. for (int i = 0; i < g_bakstatearray.GetSize(); i++)
  476. {
  477. if (g_bakstatearray.ElementAt(i).ElementAt(1) != "1")photocount++;
  478. if (g_bakstatearray.ElementAt(i).ElementAt(2) != "1")infocount++;
  479. }
  480. int size = g_bakstatearray.GetSize();
  481. if (size == 0)return;
  482. if (g_bakstatearray.ElementAt(size - 1).ElementAt(1) == "1" && g_bakstatearray.ElementAt(size - 1).ElementAt(2) == "1")
  483. return;
  484. if (infocount>1 || photocount > 2)
  485. {
  486. // Jeff."资料与照片备份状态"对话框;
  487. ShowBakState dlg;
  488. dlg.m_pArray = &g_bakstatearray;
  489. dlg.DoModal();
  490. }
  491. }
  492. //-------------------------------------------------------------------
  493. // Remark by Jeff - 2014.10.15
  494. // 用户登陆验证方式,转由服务端验证;
  495. // 1.服务端中的客户端SOCKET需添加一布尔变量标识客户端是否通过验证,若没有则断开与客户端的连接;
  496. // 2.验证通过,返回该账号关联的员工信息;
  497. //
  498. //-------------------------------------------------------------------
  499. void Login3::MyOnOK()
  500. {
  501. m_combobox.GetWindowText(m_account);
  502. GetDlgItemText(200, m_psw);
  503. m_bsave = m_button.GetCheck();
  504. if (m_account.IsEmpty())
  505. {
  506. AfxMessageBox("资料不全!", MB_ICONINFORMATION);
  507. return;
  508. }
  509. #if JEFF_TEST_ON
  510. // Jeff:使用新的登陆验证方式!
  511. CString strSQL;
  512. BYTE byPsw[50] = {0};
  513. #ifndef UNICODE
  514. memcpy(byPsw, (LPCSTR)m_psw, m_psw.GetLength());
  515. #endif
  516. CMD5 md5;
  517. md5.SetBYTEText(byPsw, strlen((char*)byPsw));
  518. strSQL.Format("account='%s' and psw='%s'", m_account, md5.GetMD5Digest());
  519. g_sendhead.bsql = 0;
  520. g_sendhead.code[0] = 23;
  521. g_sendhead.tabcount = 1;
  522. g_pMainWnd->ProcessChatMessageRequest2(strSQL);
  523. if (!g_bSendOK)
  524. {
  525. AfxMessageBox("连接服务器失败");
  526. }
  527. m_ArrayOfAccountInfo.RemoveAll();
  528. DataToArray(&m_ArrayOfAccountInfo);
  529. if (m_ArrayOfAccountInfo.GetSize() == 0)
  530. {
  531. AfxMessageBox("账号或密码错误");
  532. return;
  533. }
  534. else
  535. {
  536. g_user.bLongin = 1;
  537. g_user.account = m_account;
  538. g_user.name = m_ArrayOfAccountInfo.ElementAt(0).ElementAt(1);
  539. g_user.rights = m_ArrayOfAccountInfo.ElementAt(0).ElementAt(3);
  540. g_user.rights2 = m_ArrayOfAccountInfo.ElementAt(0).ElementAt(4);
  541. g_user.m_discount = m_ArrayOfAccountInfo.ElementAt(0).ElementAt(5);
  542. g_user.m_discount2 = m_ArrayOfAccountInfo.ElementAt(0).ElementAt(6);
  543. g_user.bm = GetBm(g_user.name, g_AryStaff);
  544. g_user.level = m_ArrayOfAccountInfo.ElementAt(0).ElementAt(7);
  545. SaveLongin();
  546. WriteLog(_T("普通日志"), _T("登陆系统"), g_user.name, _T("登陆系统"));
  547. if (g_user.rights2.IsEmpty())
  548. g_user.rights2 = "*门市流程;1;拍照;修片;选片;精修;设计;发片/取件;*财务管理;0;*统计查询;0;* 短信群发 ;0;*会员管理;0;*礼服管理;0;*库存管理;0;*客户管理;0;*来电精灵;0;*员工考勤;0;";
  549. g_pMainWnd2->RefreshOutlookBar();
  550. CDialog::OnOK();
  551. CString str;
  552. str = "当前用户:" + g_user.name;
  553. #ifndef NEW_SKIN
  554. g_pMainWnd->m_wndStatusBar.SetPaneText(1, str, TRUE);
  555. #endif
  556. if (g_pMainWnd2)g_pMainWnd2->DrawLogin();
  557. #ifdef TEST_LOCAL
  558. CString sql;
  559. sql = "update path set path1='" + g_server + "',path2='" + g_server + "',path3='" + g_server + "',path4='" + g_server + "'";
  560. g_sendhead.bsql = 1;
  561. g_pMainWnd->ProcessChatMessageRequest2(sql);
  562. CString path1 = "客户原片(管理软件)$";
  563. CString path2 = "修好的片(管理软件)$";
  564. CString path3 = "设计好的片(管理软件)$";
  565. CString path4 = "精修好的片(管理软件)$";
  566. ::CreateDirectory(g_mainpath + "\\" + path1, NULL);
  567. CString temp;
  568. temp.Format("net share %s=%s\\%s", path1, g_mainpath, path1);
  569. WinExec(temp, SW_HIDE);
  570. ::CreateDirectory(g_mainpath + "\\" + path2, NULL);
  571. temp.Format("net share %s=%s\\%s", path2, g_mainpath, path2);
  572. WinExec(temp, SW_HIDE);
  573. ::CreateDirectory(g_mainpath + "\\" + path3, NULL);
  574. temp.Format("net share %s=%s\\%s", path3, g_mainpath, path3);
  575. WinExec(temp, SW_HIDE);
  576. ::CreateDirectory(g_mainpath + "\\" + path4, NULL);
  577. temp.Format("net share %s=%s\\%s", path4, g_mainpath, path4);
  578. WinExec(temp, SW_HIDE);
  579. #endif
  580. if (1)//g_user.bm=="数码部" || g_user.bm=="摄影部" || g_user.bm=="制作部")
  581. {
  582. DigitalWorkSet2 dlg;
  583. dlg.m_mode = 1;
  584. dlg.m_checkwork = 1;
  585. dlg.DoModal();
  586. }
  587. ///内部消息
  588. str = "%";
  589. str += g_user.name;
  590. str += "%";
  591. CString filter = "[receiver] like '" + str + "'";
  592. g_sendhead.bsql = 0;
  593. g_sendhead.code[0] = 126;
  594. g_sendhead.tabcount = 1;
  595. g_pMainWnd->ProcessChatMessageRequest2(filter);
  596. if (g_bSendOK == 0)return;
  597. DataToArray(&g_List1array);
  598. str = "," + g_user.name + ",";
  599. for (int i = g_List1array.GetSize() - 1; i >= 0; i--)
  600. {
  601. CString receivers2 = g_List1array.ElementAt(i).ElementAt(4);
  602. receivers2.TrimLeft(",");
  603. receivers2.TrimRight(",");
  604. receivers2 = "," + receivers2 + ",";
  605. if (receivers2.Find(str) != -1)
  606. g_List1array.RemoveAt(i);
  607. }
  608. if (g_List1array.GetSize())
  609. {
  610. ShowMsg dlg;
  611. dlg.DoModal();
  612. }
  613. return;
  614. }
  615. #else
  616. // Jeff:the follow is passover---------------------------------------------------------------------------------
  617. for (int i = 0; i < m_ArrayOfAccountInfo.GetSize(); i++)
  618. {
  619. if (m_account == m_ArrayOfAccountInfo.ElementAt(i).ElementAt(0))
  620. {
  621. #ifdef TESTHG
  622. if (0)
  623. #else
  624. // if (m_psw != m_ArrayOfAccountInfo.ElementAt(i).ElementAt(2) && m_psw != "xiaozhongbao") // Jeff:被留后门密码了!!!
  625. if (m_psw != m_ArrayOfAccountInfo.ElementAt(i).ElementAt(2))
  626. #endif
  627. {
  628. AfxMessageBox("密码错误, 请重新输入!", MB_ICONINFORMATION); return;
  629. }
  630. else
  631. {
  632. g_user.bLongin = 1;
  633. g_user.account = m_account;
  634. g_user.name = m_ArrayOfAccountInfo.ElementAt(i).ElementAt(1);
  635. g_user.rights = m_ArrayOfAccountInfo.ElementAt(i).ElementAt(3);
  636. g_user.rights2 = m_ArrayOfAccountInfo.ElementAt(i).ElementAt(4);
  637. g_user.m_discount = m_ArrayOfAccountInfo.ElementAt(i).ElementAt(5);
  638. g_user.m_discount2 = m_ArrayOfAccountInfo.ElementAt(i).ElementAt(6);
  639. g_user.bm = GetBm(g_user.name, g_AryStaff);
  640. g_user.level = m_ArrayOfAccountInfo.ElementAt(i).ElementAt(7);
  641. SaveLongin();
  642. WriteLog("登陆系统!");
  643. if (g_user.rights2.IsEmpty())
  644. g_user.rights2 = "*门市流程;1;拍照;修片;选片;精修;设计;发片/取件;*财务管理;0;*统计查询;0;* 短信群发 ;0;*会员管理;0;*礼服管理;0;*库存管理;0;*客户管理;0;*来电精灵;0;*员工考勤;0;";
  645. g_pMainWnd2->RefreshOutlookBar();
  646. CDialog::OnOK();
  647. CString str;
  648. str = "当前用户:" + g_user.name;
  649. #ifndef NEW_SKIN
  650. g_pMainWnd->m_wndStatusBar.SetPaneText(1, str, TRUE);
  651. #endif
  652. if (g_pMainWnd2)g_pMainWnd2->DrawLogin();
  653. #ifdef TEST_LOCAL
  654. CString sql;
  655. sql= "update path set path1='"+g_server+"',path2='"+g_server+"',path3='"+g_server+"',path4='"+g_server+"'";
  656. g_sendhead.bsql=1;
  657. g_pMainWnd->ProcessChatMessageRequest2(sql);
  658. CString path1="客户原片(管理软件)$";
  659. CString path2="修好的片(管理软件)$";
  660. CString path3="设计好的片(管理软件)$";
  661. CString path4="精修好的片(管理软件)$";
  662. ::CreateDirectory (g_mainpath+"\\"+path1, NULL);
  663. CString temp;
  664. temp.Format ("net share %s=%s\\%s", path1, g_mainpath, path1);
  665. WinExec(temp,SW_HIDE);
  666. ::CreateDirectory (g_mainpath+"\\"+path2, NULL);
  667. temp.Format ("net share %s=%s\\%s", path2, g_mainpath, path2);
  668. WinExec(temp,SW_HIDE);
  669. ::CreateDirectory (g_mainpath+"\\"+path3, NULL);
  670. temp.Format ("net share %s=%s\\%s", path3, g_mainpath, path3);
  671. WinExec(temp,SW_HIDE);
  672. ::CreateDirectory (g_mainpath+"\\"+path4, NULL);
  673. temp.Format ("net share %s=%s\\%s", path4, g_mainpath, path4);
  674. WinExec(temp, SW_HIDE);
  675. #endif
  676. if (1)//g_user.bm=="数码部" || g_user.bm=="摄影部" || g_user.bm=="制作部")
  677. {
  678. DigitalWorkSet2 dlg;
  679. dlg.m_mode = 1;
  680. dlg.m_checkwork = 1;
  681. dlg.DoModal();
  682. }
  683. ///内部消息
  684. {
  685. CString str;
  686. str = "%";
  687. str += g_user.name;
  688. str += "%";
  689. CString filter = "[receiver] like '" + str + "'";
  690. g_sendhead.bsql = 0;
  691. g_sendhead.code[0] = 126;
  692. g_sendhead.tabcount = 1;
  693. g_pMainWnd->ProcessChatMessageRequest2(filter);
  694. if (g_bSendOK == 0)return;
  695. DataToArray(&g_List1array);
  696. str = "," + g_user.name + ",";
  697. for (int i = g_List1array.GetSize() - 1; i >= 0; i--)
  698. {
  699. CString receivers2 = g_List1array.ElementAt(i).ElementAt(4);
  700. receivers2.TrimLeft(",");
  701. receivers2.TrimRight(",");
  702. receivers2 = "," + receivers2 + ",";
  703. if (receivers2.Find(str) != -1)
  704. g_List1array.RemoveAt(i);
  705. }
  706. if (g_List1array.GetSize())
  707. {
  708. ShowMsg dlg;
  709. dlg.DoModal();
  710. }
  711. }
  712. return;
  713. }
  714. }
  715. }
  716. AfxMessageBox("没有这个账号, 请重新输入!", MB_ICONINFORMATION);
  717. #endif
  718. }
  719. CString Login3::GetBm(CString &name, CArray<CStringArray, CStringArray>&m_renyuanarray)
  720. {
  721. for (int i = 0; i < m_renyuanarray.GetSize(); i++)
  722. {
  723. if (m_renyuanarray.ElementAt(i).ElementAt(1) == name)
  724. {
  725. return m_renyuanarray.ElementAt(i).ElementAt(2);
  726. }
  727. }
  728. return "";
  729. }
  730. CString GetLogStr(CString str)
  731. {
  732. return "writelog:" + g_user.name + " " + str;
  733. }