网络聊天系统源代码 第5页


网络聊天系统源代码 第5页
3.5数据字典
3.5.1.user_info -----用户基本信息表

表名 user_info
列名 数据类型(精度范围) 空/非空 约束条件
用户名 文本 非空 
密码 文本 非空 
安全问题 文本  
安全问题答案 文本  
3.5.2 manager-----管理员信息


表名 manager
列名 数据类型(精度范围) 空/非空 约束条件
用户名 文本 非空 
密码 文本 非空 
补充说明 仅用来保存服务器端管理员信息,只能直接在数据库中添加 
4 系统详细设计
4.1服务器详细设计
4.1.1服务器结构设计

                 图 4-1-1   服务器结构
         (Graph 4-1-1 Server Architecture)

4.1.2服务器实现原理及功能描述
   可以同时和多个客户端相连,并能和每个客户端之间进行数据的传输;可以显示所有的用户所发送的消息并将其显示出来;能接收客户端发来的信息,而且还要根据客户机的状态及时发布一些信息;将接收的某一客户机的信息,发送给所有其他客户端程序,实现聊天室的信息同步
4.1.3 类设计
 CaboutDlg、CChatSysServerApp、CChatSysServerDlg、CManagePage、CP2PData、CRoomInfo、CUserDlg、CUserSocket

4.1.4 服务器界面设计及主要实现代码


登陆界面
  

登陆流程图
 
                 图  4-1-4服务器管理员登陆
            (Graph 4-1-4 Server Administrator Landing)


主要实现原理:
    通过核对存放于数据库的用户信息来确认是不是合法用户,从而达到安全性

实现代码:
BOOL CChatSysServerDlg::OnInitDialog()
{
 // Set the icon for this dialog.  The framework does this automatically
 //  when the application's main window is not a dialog
 SetIcon(m_hIcon, TRUE);   // Set big icon
 SetIcon(m_hIcon, FALSE);  // Set small icon
 
 // TODO: Add extra initialization here

 //打开数据库
 m_pConnection.CreateInstance(_uuidof(Connection));
 m_pConnection->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=chatsystem.mdb;","","", -1);
 //打开记录集
 m_pRecordset.CreateInstance(_uuidof(Recordset));
 m_pRecordset->Open("select * from manager",m_pConnection.GetInterfacePtr(),adOpenDynamic,adLockOptimistic,adCmdText);

// GetDlgItem(IDC_USNAME)->SetFocus();
    m_MgName = "cs001";
 m_MgPasswd = "123456";
 UpdateData(FALSE);
 return TRUE;  // return TRUE  unless you set the focus to a control
}

// The system calls this to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CChatSysServerDlg::OnQueryDragIcon()
{
751com.cn}//登陆判断函数
void CChatSysServerDlg::OnLogin()
{
 // TODO: Add your control notification handler code here
 UpdateData(TRUE);
 //判断用户名和密码是否为空
 if (m_MgName == "" ||m_MgPasswd =="")
 {
  MessageBox("用户名或者密码不能为空!", "提示", MB_ICONWARNING |MB_OK);
  GetDlgItem(IDC_USNAME)->SetFocus();
  return;
 }
 //移动第一条记录
 m_pRecordset->MoveFirst();

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ... 下一页  >> 

Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有