当前位置:文档之家› PHP课程设计报告

PHP课程设计报告

PHP编程基础与实例教程课程设计报告学生信息管理系统姓名:班级:14-1专业:信息管理与信息系统完成日期:2017.6.14指导教师:目录1. 系统需求分析 (1)1.1系统分析过程 (1)1.1.1系统的总体目标是: (1)1.2系统可行性分析 (1)2. 数据库逻辑结构设计 (2)2.2.1数据库E-R图 (2)2.2.2数据库关系模式: (2)3. 软件结构设计 (6)3.1开发环境 (6)3.2系统功能结构 (6)3.3系统结构-模块划分 (7)3.3.1登陆模块 (7)3.3.2增删模块 (14)4.软件调试 (18)4.1进入主页 (18)4.2登录界面 (18)4.3根据用户身份登录到对应界面 (18)4.3.1学生登录 (18)4.3.2教师登录 (20)4.3.3管理员登录 (21)5.心得 (24)6.PHP参考文献 (24)1.系统需求分析1.1系统分析过程1.1.1系统的总体目标是:设计一个学生成绩管理系统,学生所具有的操作功能如下:浏览个人基本信息;学生登录系统后,修改个人信息,为了保证系统的安全性,学生只能修改个人密码,浏览课程信息,进行选课等;教师查询、录入、修改成绩,修改个人密码;管理员查询、录入、修改基本信息, 修改个人密码,同时修改老师教授的课程。

1.1.2系统所能实现的功能有:查询模块:负责学生查询自己的基本信息和成绩,教师查询成绩和个人基本信息,管理员查询基本信息情况。

录入模块:以教师的角色登录,允许录入成绩;以管理员身份登录允许录入人员和课程信息;修改模块:以教师的角色登录,允许修改成绩;以管理员身份登录允许修改人员和课程信息;系统配置模块:密码修改和重置等。

1.2系统可行性分析1.2.1经济可行性现在,计算机的价格已经十分低廉,性能却有了长足的进步。

而本系统的开发,为学校的工作效率带来了一个质的飞跃,为此主要表现有以下几个方面:第一,本系统的运行可以代替人工进行许多繁杂的劳动;第二,本系统的运行可以节省许多资源;第三,本系统的运行可以大大的提高学校的工作效率;所以,本系统在经济上是可行的。

1.2.2技术可行性本系统的开发利用MySQL作为本系统的数据库,它是一个支持多用户的新型数据库,适用于大中规模的数据量需求。

学校校园网的建设也为新系统服务器/客户端的结构提供了硬件的支持。

使用wamp与navicat作为系统开发的开发环境,它提供完善的指令控制语句、类与对象的支持及丰富的数据类型,给开发高性能系统提供的保障为开发满足客户要求的系统,保证了代码的模块化要求,而代码模块化的提高,非常有利于以后对新系统的扩展与修改。

1.2.3操作可行性本系统为一个小型的学生信息管理系统,所耗费的资源非常的小,学校的电脑无论是硬件还是软件都能够满足条件,界面设计时充分考虑管理人员的习惯,使得操作简单;数据录入迅速、规范、可靠;统计准确;制表灵活;适应力强;容易扩充,因此,本系统在操作上是可行的2.数据库逻辑结构设计2.2.1数据库E-R图2.2.2数据库关系模式:Administrator(AdminID, AdminName, AdminPassword);ClassInfo(Class,Major,department)CourseInfo(CourseNumber, CourseName, Grade);StudentCourse(StudentID , CourseNumber, Marks);StudentInfo(StudentID,StudentName ,Class,StudentPassword);TeacherInfo (TeacherID,TeacherName,TeacherPassword);TeachingInfo(CourseNumber,TeacherID);数据库名称:management拥有的表:administrator;Classinfo;Courseinfo;StudentCourse;Studentinfo;Teacherinfo;Teachinginfo;各个表的属性及数据:Administrator (AdminID char(20) primary key,,AdminName char(20),AdminPassword char(20));包含:管理员编号AdminID、管理员姓名AdminName、管理员密码AdminPassword Classinfo(Class char(20) primary key,Major char(20),department char(20));包含:班级号Class、专业Major、学院departmentCourseinfo(CourseNumber char(20) primary key,CourseName char(20),Grade int); 包含:课程编号CourseNumber、课程姓名CourseName、学分GradeStudentCourse (StudentID char(20),CourseNumber char(20),Marks int);包含:学号StudentID、课程编号CourseNumber、得分MarksStudentinfo(StudentID char(20) primary key,StudentName char(20),Class char(20),StudentPassword Char(20));包含:学号StudentID、学生姓名StudentName、班级号Class、学生密码StudentPasswordTeacherinfo(TeacherID char(20) primary key,TeacherName char(20), TeacherPassword char(20));包含:教师编号TeacherID、教师姓名TeacherName、教师密码TeacherPassword Teachinginfo(CourseNumber char(20) primary key,TeacherID char(20));包含:课程编号CourseNumber、教师编号TeacherID3. 软件结构设计3.1开发环境基于windows 7操作系统,数据库系统使用Mysql ,服务器搭建使用Apache ,Web 编写使用PHP 。

3.2系统功能结构身份判断身份,密码确认显示学生信息显示教师信息,其他功能选项显示管理员信息,其他功能选项ID ,密码,身份信息ID ,密码,确认信息ID ,密码,确认信息ID ,密码,确认信息登录系统ID ,密码修改学生成绩修改密码新成绩,学生ID删除人员,课程基本信息判断操作类型,操作对象身份操作请求,新的信息添加人员,课程基本信息修改人员,课程基本信息3.3系统结构-模块划分3.3.1登陆模块系统使用人员登陆系统,输入ID号密码,选择身份。

之后根据身份,查询系统数据库,判断该ID是否存在,密码是否正确,确认无误之后继续进行之后的功能。

实现程序段(login.php与login_check.php):login.php<?phpsession_start();$_SESSION['firstlogin']=1;><head><meta http-equiv="Content-Type" content="text/html; charset=gbk" /> <title>学生管理信息系统</title><style>*{padding:0px;margin:0px;}a{color:White}body{font-family:Arial, Helvetica, sans-serif;background:url('images/grass.jpg') no-repeat center;font-size:13px;}img{border:0;}.lg{width:468px; height:468px; margin:100px auto;background:url('images/login_bg.png') no-repeat;align: center;}.lg_top{ height:200px; width:468px;align: center;}.lg_main{width:400px; height:180px; margin:0 25px;align="center";}.lg_m_1{width:290px;height:100px;padding:60px 55px 20px 55px;margin:0px auto;}.ur{height:37px;border:0;color:#666;width:236px;margin:4px 28px;background:url('images/user.png') no-repeat;padding-left:10px;font-size:16pt;font-family:Arial, Helvetica, sans-serif;}.pw{height:37px;border:0;color:#666;width:236px;margin:4px 28px;background:url('images/password.png') no-repeat;padding-left:10px;font-size:16pt;font-family:Arial, Helvetica, sans-serif;}.lg_foot{height:80px;width:330px;padding: 6px 68px 0 68px;align="center"}</style></head><body class="b"><div class="lg"><div class="lg_top"></div><div class="lg_main"><div class="lg_m_1"><form method="post" action="login_check.php"><input type="text" name='user_name' class="ur"/><input type="password" name='user_pass' class="pw"/> <p style="text-align: center"><font size='3' face='楷体'><strong>请选择身份</strong></font>:<br/></p><body style="text-align:center;"><select name="shenfen" size="1" style="text-align: center"><option value="1">学生</option><option value="2">教师</option><option value="3">管理员</option></select><p style="text-align: center"><input name="submit1"type="submit" value="登录" /></p></form><form method="post" action="login.php"><p style="text-align: center"><input name="submitO"type="submit" value="重置" /></p></form></div></div></form></body></html>Login_check.php<?phpsession_start();if($_SESSION['firstlogin']){$_SESSION['username']=$_POST['user_name'];$_SESSION['password']=$_POST['user_pass'];$_SESSION['shenfen']=$_POST['shenfen'];$_SESSION['firstlogin']=false;}$shenfen=$_SESSION['shenfen'];$user_name=$_SESSION['username'];$user_pass=$_SESSION['password'];><html><head><title>登陆成功!</title><meta http-equiv="Content-Type" content="text/html; charset=gbk"><style type="text/css">body {background-image: url(images/banner.jpg);background-repeat: repeat;}</style></head><body><?php$db= mysql_connect('127.0.0.1:3306','root','') or die ("连接失败");mysql_select_db('management',$db) or die(mysql_error($db));if($shenfen['shenfen']==1){$query="SELECTStudentID,StudentName,studentinfo.Class,Major,departmentfromstudentinfo,ClassInfowhereStudentID='$user_name' AND StudentPassword='$user_pass' AND studentinfo.Class=ClassInfo.Class;";mysql_query("set names 'gbk'");mysql_query("SET CHARACTER SET gbk");$result=mysql_query($query,$db) or die ("ERROR");if(mysql_numrows($result)==0){echo "用户名或密码错误!".'<br/>';echo "<a href='login.php'>";echo "重新登录";echo "</a>";}else{echo "<a href='login.php' >";echo "<p align ='right'>注销</p>";echo "</a>";echo "<a href='password_change.php'>";echo "<p align ='right'>修改密码</p>"."<br/>";echo "</a>";echo "<a href='course_select.php'>";echo "<p align=right>修改选课信息</p>";echo "</a>";//show the resultsecho '<table border="0" align=center >';echo "<td>用户信息:</td>";echo '<table border="1" align=center >';$row=array('学号','姓名','班级','专业','学院');echo '<tr>';foreach($row as $value){echo '<td>'.$value.'</td>';}while($row=mysql_fetch_assoc($result)){echo '<tr>';foreach($row as $value){echo '<td>'.$value.'</td>';}echo '</tr>';}echo '</table>';// extract($row);// echo $StudentID . '-' . $StudentName . '-' . $class .'-' .$StudentPassword.'<br/>';echo '</br>';echo '</br>';$query="SELECTstudentcourse.CourseNumber,CourseName,Grade,Marksfromstudentcourse,CourseInfowhereStudentID='$user_name' and studentcourse.CourseNumber=CourseInfo.CourseNumber";$result=mysql_query($query,$db) or die ("未知错误!");echo '<table border="0" align=center >';echo "<td>选课信息:</td>";echo '<table border="1" align=center >';$row=array('课程编号','课程名','学分','分数');echo '<tr>';foreach($row as $value){echo '<td>'.$value.'</td>';}while($row=mysql_fetch_assoc($result)){echo '<tr>';foreach($row as $value){echo '<td>'.$value.'</td>';}echo '</tr>';}echo '</table>';}}if($shenfen['shenfen']==2){//检查username是否存在//检差password是否存在//显示老师个人信息,获得任课科目$query="SELECT TeacherID,TeacherName from Teacherinfo where TeacherID='$user_name' AND TeacherPassword='$user_pass'";mysql_query("set names 'gbk'");mysql_query("SET CHARACTER SET gbk");$result=mysql_query($query,$db) or die ("The user doesn't exist or password ");if(mysql_numrows($result)==0){echo "用户名或密码错误!".'<br/>';echo "<a href='login.php'>";echo "重新登录";echo "</a>";}else{echo "<a href='login.php'>";echo "<p align='right'>注销</p>";echo "</a>";echo "<a href='password_change.php'>";echo "<p align='right'> 修改密码</p>"."<br/>";echo "</a>";echo '<table border="0" align="center">';echo "<td>教师信息:</td>";echo '<table border="1" align="center">';$row=array('教师编号','姓名');echo '<tr>';foreach($row as $value){echo '<td>'.$value.'</td>';}while($row=mysql_fetch_assoc($result)){echo '<tr>';foreach($row as $value){echo '<td>'.$value.'</td>';}echo '</tr>';}echo '</table>';$query="SELECTTeachinginfo.CourseNumber,CourseNamefromTeachinginfo,CourseInfowhereTeacherID='$user_name' and Teachinginfo.CourseNumber=CourseInfo.CourseNumber";$result=mysql_query($query,$db) or die ("Unexpected error(mark)!");echo "<p align=center>课程:</p>";while(mysql_num_rows($result)!=0&&$row=mysql_fetch_assoc($result )){extract($row);echo "<a href='scole.php?course=$CourseNumber'>";echo"<p align=center> $CourseName</p>";echo "</a>";}}}if($shenfen['shenfen']==3){//检查username是否存在//检查password是否正确$query="SELECT AdminID,AdminName from administrator where AdminID='$user_name' AND AdminPassword='$user_pass'";mysql_query("set names 'gbk'");mysql_query("SET CHARACTER SET gbk");$result=mysql_query($query,$db) or die ("The user doesn't exist or password ");if(mysql_numrows($result)==0){echo "用户名或密码错误!".'<br/>';echo "<a href='login.php'>";echo "重新登录";echo "</a>";}else{echo "<a href='login.php'>";echo "<p align=right>注销</p>";echo "</a>";echo "<a href='password_change.php'>";echo "<p align=right>修改密码</p>"."<br/>";echo "</a>";echo '<table border="0" align=center>';echo "<td>管理员信息:</td>";echo '<table border="1" align=center>';$row=array('管理员编号','姓名');echo '<tr>';foreach($row as $value){echo '<td>'.$value.'</td>';}while($row=mysql_fetch_assoc($result)){echo '<tr>';foreach($row as $value){echo '<td>'.$value.'</td>';}echo '</tr>';}echo '</table>';echo "<p align=center>请选择要修改的内容:</p>","<br/>";echo "<a href='admin_select.php?select=1'>";echo "<p align=center>管理员信息</p>"."<br/>";echo "</a>";echo "<a href='teacher_select.php?select=2'>";echo "<p align=center>教师信息</p>"."<br/>";echo "</a>";echo "<a href='student_select.php?select=3'>";echo "<p align=center>学生信息</p>"."<br/>";echo "</a>";echo "<a href='c_select.php?select=4'>";echo "<p align=center>课程信息</p>"."<br/>";echo "</a>";echo "<a href='t_select.php?select=5'>";echo "<p align=center>教师授课信息</p>"."<br/>";echo "</a>";}}></div></body></html>3.3.2增删模块教师部分,输入新学生ID,新成绩,再根据教师是的任课课程修改数据可中的学生成绩。

相关主题