论文无忧网提供:计算机毕业论文范文|计算机毕业设计|计算机毕业论文
栏目导航 ASP Java Web .NET VB6.0 JAVA VC VF DELPHI PB 计算机网络 计算机科学与技术 PHP 安卓APP 其他 C# 代写论文
当前位置: > 计算机 > 计算机科学与技术 >

教育报表管理系统-权限管理模块的实现(论文+程序)

7.3页面的制作

页面的制作我使用的是Photoshop cs 9.0和Dreamweaver 8这两种软件。Photoshopcs 9.0是专门用来进行图像处理的软件。通过它可以对图像修饰、对图形进行编辑,以及对图像的色彩处理,另外,还有绘图和输出功能等。Dreamweaver主要用来制作网页文件。网页素材主要是平时积累所得。先选择比较理想的素材,或者是通过制图软件绘制的图片,通过Photoshop图片处理器做一些必要的修改,添加文字和效果,再使用Dreamweaver软件将制作好的网站图片镶嵌到网页中去。其具体过程我就不详细叙述了。 http://www.paper51.com

paper51.com

图15 报表制作图

内容来自论文无忧网 www.paper51.com

7.4用户登陆功能

内容来自www.paper51.com

在用户登陆后,系统自动识别用户权限,登陆界面设计如下:

内容来自www.paper51.com

paper51.com

图16系统登陆界面 内容来自论文无忧网 www.paper51.com

用户登陆后系统自动识别用户的权限,并把用户权限和用户名用Session方法在服务器保存,密码在数据库里采用MD5加密保存,用户登陆成功后,用户名将在客服端用Cookie方式保存,这样避免了用户在登陆系统时重复输入用户名和密码,在其他页面初始化时,将判断客服端的保存的Cookie值,如果值为空将返回登陆界面。

paper51.com

主要代码如下: 内容来自论文无忧网 www.paper51.com

       string pwd; paper51.com

        pwd= System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(Password.Text,"MD5");  //密码用MD5加密 copyright paper51.com

       drLogin = new scReader("select userid,countyid,townid,schoolid,userpowerfrom sysuser where username='" + UserName.Text + "' and userpwd='" + pwd + "'");//查询用户名和密码是否存在 内容来自www.paper51.com

        if (Password.Text != ""&& UserName.Text != ""&& drLogin.Read())//如果用户名,密码都正确

内容来自论文无忧网 www.paper51.com

        {

http://www.paper51.com

//写入Cookies

内容来自www.paper51.com

           HttpCookie MyCookie = new HttpCookie("UserName");        //新建Cookie 内容来自论文无忧网 www.paper51.com

           MyCookie.Value = UserName.Text;                //保存UserName为Cookie

内容来自www.paper51.com

           DateTime dt = DateTime.Now;                   //得到系统时间

内容来自www.paper51.com

           TimeSpan ts = newTimeSpan(30, 0, 0, 0);      //设置cookie的过期时间为当前时间后的10000分钟 http://www.paper51.com

           MyCookie.Expires = dt.Add(ts);                 //添加Cookie的过期时间 copyright paper51.com

           Response.Cookies.Add(MyCookie);                   //保存Cookie的设置 paper51.com

           Response.Redirect("Manage.aspx",true);         //转向管理页面

http://www.paper51.com

        }

内容来自论文无忧网 www.paper51.com

        Else  //用户名和名判断失败 paper51.com

        { 内容来自论文无忧网 www.paper51.com

           Response.Write("<script language='javascript'>alert('用户名或密码错误,请重新输入!');</script>");  //提示 内容来自www.paper51.com

           UserName.Text = "";

内容来自www.paper51.com

           Password.Text = ""; 内容来自论文无忧网 www.paper51.com

        }

copyright paper51.com

       drLogin.Close();  //数据库对象关闭 paper51.com

    }

内容来自www.paper51.com

7.5四级权限与用户添加

内容来自论文无忧网 www.paper51.com

内容来自论文无忧网 www.paper51.com

图17权限管理与用户模块界面 http://www.paper51.com

四级权限管理与用户的添加根据管理员完成,对应执行相应的代码 paper51.com

主要代码如下: paper51.com

            if (dlAddUser1.SelectedValue.ToString() == "市级权限")  //添加市级用户的代码

内容来自论文无忧网 www.paper51.com

           {

内容来自www.paper51.com

               drLogin = new scReader("select cityid from syscity where cityname='"+ dlAddUser2.SelectedValue.ToString() + "'");//查询市级ID copyright paper51.com

               if (drLogin.Read()) 内容来自论文无忧网 www.paper51.com

                { copyright paper51.com

                   cityid= (int)drLogin["cityid"];//保存CityID

内容来自www.paper51.com

                   drLogin = new scReader("insertsysuser(countyid,townid,schoolid,userpower,cityid,username,userpwd)values(0,0,0,0," + cityid + ",'"+ txtAddUserName.Text + "','" +System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(txtAddUserPwd.Text,"MD5") + "')");

copyright paper51.com

 //用户名,密码,用户权限写入数据库 http://www.paper51.com

                   Response.Write("<scriptlanguage='javascript'>alert('添加成功!');</script>");//添加成功 http://www.paper51.com

                   txtAddUserName.Text = ""; 内容来自www.paper51.com

                   txtAddUserPwd.Text = "";

copyright paper51.com

               } 内容来自www.paper51.com

           } http://www.paper51.com

           if (dlAddUser1.SelectedValue.ToString()== "县级权限")//添加县级权限的代码

copyright paper51.com

           { 内容来自论文无忧网 www.paper51.com

               drLogin = new scReader("select countyid,cityid from syscounty wherecountyname='" + dlAddUser2.SelectedValue.ToString() + "'");    //查询县级ID,市级ID

内容来自论文无忧网 www.paper51.com

               if (drLogin.Read())

内容来自论文无忧网 www.paper51.com

               {

内容来自论文无忧网 www.paper51.com

                   countyid = (int)drLogin["countyid"];            //保存县级ID

内容来自www.paper51.com

                   cityid = (int)drLogin["cityid"];            //保存市级ID http://www.paper51.com

                   drLogin = new scReader("insertsysuser(townid,schoolid,userpower,cityid,countyid,username,userpwd)values(0,0,1," + cityid + ","+ countyid + ",'" +txtAddUserName.Text + "','" +System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(txtAddUserPwd.Text,"MD5") + "')"); http://www.paper51.com

 //写入数据库用户名,密码,权限

内容来自www.paper51.com

                   Response.Write("<scriptlanguage='javascript'>alert('添加成功!');</script>");//添加成功 paper51.com

                   txtAddUserName.Text = "";

内容来自www.paper51.com

                   txtAddUserPwd.Text = ""; 内容来自论文无忧网 www.paper51.com

               }

内容来自www.paper51.com

           } 内容来自论文无忧网 www.paper51.com

           if (dlAddUser1.SelectedValue.ToString()== "乡镇级权限")//添加乡镇级权限ID copyright paper51.com

           {

paper51.com

               drLogin = new scReader("select countyid,townid,cityid from systown wheretownname='" + dlAddUser2.SelectedValue.ToString() + "'");

http://www.paper51.com

//查询乡镇级ID,县级ID,市级ID

copyright paper51.com

               if (drLogin.Read()) 内容来自论文无忧网 www.paper51.com

               {

copyright paper51.com

                   countyid = (int)drLogin["countyid"];               //保存县级IID 内容来自论文无忧网 www.paper51.com

                   townid = (int)drLogin["townid"];//保存乡镇级D

paper51.com

                   cityid = (int)drLogin["cityid"];                  //保存市级ID http://www.paper51.com

                   drLogin = new scReader("insertsysuser(schoolid,userpower,cityid,townid,countyid,username,userpwd)values(0,2," + cityid +","+ townid + "," + countyid + ",'" + txtAddUserName.Text + "','" + System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(txtAddUserPwd.Text,"MD5") + "')");

http://www.paper51.com

//写入数据库用户名,密码,权限 内容来自www.paper51.com

                   Response.Write("<scriptlanguage='javascript'>alert('添加成功!');</script>");              //添加成功 内容来自论文无忧网 www.paper51.com

                   txtAddUserName.Text = ""; paper51.com

                   txtAddUserPwd.Text = "";

paper51.com

               }

内容来自论文无忧网 www.paper51.com

           } paper51.com

           if (dlAddUser1.SelectedValue.ToString()== "学校权限") copyright paper51.com

//添加学校级权限的代码

copyright paper51.com

           {

paper51.com

               drLogin = new scReader("select countyid,townid,schoolid,cityid fromsysschool where schoolname='" + dlAddUser2.SelectedValue.ToString()+ "'");

内容来自www.paper51.com

//查询学校级ID,乡镇级ID,县级ID,市级ID 内容来自www.paper51.com

               if (drLogin.Read()) copyright paper51.com

               { 内容来自论文无忧网 www.paper51.com

                   countyid= (int)drLogin["countyid"];            //保存县级ID

http://www.paper51.com

                   townid = (int)drLogin["townid"];                //保存乡镇级ID 内容来自论文无忧网 www.paper51.com

                   schoolid = (int)drLogin["schoolid"];            //保存学校级ID paper51.com

                   cityid = (int)drLogin["cityid"];                //保存市级ID

http://www.paper51.com

                   drLogin = new scReader("insertsysuser(userpower,cityid,schoolid,townid,countyid,username,userpwd)values(3," + cityid + ","+ schoolid + "," + townid + "," + countyid + ",'"+ txtAddUserName.Text + "','" +System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(txtAddUserPwd.Text,"MD5") + "')"); 内容来自论文无忧网 www.paper51.com

//写入数据库用户名,密码,权限 内容来自论文无忧网 www.paper51.com

                   Response.Write("<scriptlanguage='javascript'>alert('添加成功!');</script>"); paper51.com

//添加成功

http://www.paper51.com

                    txtAddUserName.Text= "";

copyright paper51.com

                   txtAddUserPwd.Text = ""; copyright paper51.com

               }

http://www.paper51.com

           }

copyright paper51.com

        }

内容来自论文无忧网 www.paper51.com

7.6报表权限控制

copyright paper51.com

在报表录入数据是,同时加入其权限控制。

内容来自论文无忧网 www.paper51.com

Userid,CityID,CountyID,TownID,SchoolID,用户在录入报表时,同时在报表数据中写入报表与用户相对应的Userid,CityID,CountyID,TownID,SchoolID这几个值,这样可以很快查出报表数据的所属地。主要代码如下:

copyright paper51.com

if (Request.QueryString["method"].ToString()== "input")

copyright paper51.com

//通过Query得到报表的操作状态 paper51.com

        { paper51.com

           sql1 = "insert ";

内容来自论文无忧网 www.paper51.com

           sql1 += Request.QueryString["table"]+ "(";

内容来自www.paper51.com

           sql2 = " values("; copyright paper51.com

           try 内容来自论文无忧网 www.paper51.com

            {

内容来自www.paper51.com

               while (true)

paper51.com

//构造sql语句 paper51.com

               { http://www.paper51.com

                   sql2 += "'" + Session["A" + num].ToString() + "',"; 内容来自www.paper51.com

                   sql1 += "A" + num + ",";

paper51.com

                   num++;

内容来自www.paper51.com

               }

http://www.paper51.com

           }

内容来自www.paper51.com

           catch 内容来自www.paper51.com

           { paper51.com

           }

http://www.paper51.com

           if (num == 1)

内容来自论文无忧网 www.paper51.com

               return; 内容来自论文无忧网 www.paper51.com

           sql1 += "datadate,cityid,countyid,townid,schoolid,userid)"; 内容来自论文无忧网 www.paper51.com

 //构造sql语句 内容来自论文无忧网 www.paper51.com

           sql2 += "'" +Request.QueryString["date"].ToString()+ "'," + cityid + "," + countyid + ","+ townid + "," + schoolid + "," + userid + ")"; copyright paper51.com

//构造sql语句,同时加入数据库表的权限与范围 copyright paper51.com

           sql1 = sql1 + sql2; 内容来自www.paper51.com

           sql3 = "insertsyslog(tablevalue,userid,logdate,property) values('" +Request.QueryString["table"].ToString()+ "'," + userid + ",'" + Request.QueryString["date"].ToString() + "','添加')"; paper51.com

 //构造数据库日志的SQL语句 内容来自www.paper51.com

           Label1.Text = sql3; 内容来自论文无忧网 www.paper51.com

       }

内容来自论文无忧网 www.paper51.com

//报表权限控制代码 http://www.paper51.com

8测试

copyright paper51.com

我的主要工作都放在整个网页的设计和开发方面,每完成一步我都进行了测试,比如数据的写入读出,操作的记录情况等。整个系统完成后又做了一个整体的测试,该系统完全能够正常的运行。 copyright paper51.com

------分隔线----------------------------
联系方式