web课程设计报告

时间:2024.4.8

 Web程序设计实验报告

题目:聊天室         

学生姓名:   吴美冬        

    号:   1021111222          

    级:   10211112            

指导教师:   吴建东              

 

                                 2013 3 7

一.   实验目的

 熟练掌握web课程的相关知识,知道如何运用web编程,    并编写简单的系统。

二、实验内容

1、题目:聊天室

2、功能要求:

注册、登录

创建聊天室

进入退出聊天室

基本的聊天功能

三、实验步骤

聊天室系统总共有8个网页,分别是log.html,check.asp,check1.asp,speak.asp,display.asp,mark.asp,register.html,logout.asp。其中,cheak.asp是用来验证log.html的,check.asp是用来验证register.html的。

1、代码

log.html的代码为:

<!doctype html>

<html>

 <head>

 <title>聊天系统</title>

 <!--meta charset="utf-8"-->

 <script language="javascript">

 function checkdata(){

 if form1.user.value=empty then

 alert("用户名不能为空!")

 form1.user.focus

 elseif form1.pwd.value=empty then

 alert("密码不能为空!")

 end if

 }

 </script>

 </head>

 <body>

 <h1 align="center"><font color="#000080" face="华文新魏" size="8">聊天系统</font></h1>

 <form method="post" action="check.asp" name="form1" >

 <table align="center" >

 <tr>

 <td>用户名:</td><td><input type="text" name="user"></td>

 </tr>

 <tr>

 <td>密码:</td><td><input type="password" name="pwd"></td>

 </tr>

 <tr>

 <td><input type="submit" value="登录" name="log" onclick="checkdata"></td>

 <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="register.html">注册</a></td>

 </tr>

</table>

 </form>

 </body>

 </html>

check.asp的代码为:

<%

dim user,pwd,log,regis

user=request("user")

pwd=request("pwd")

log=request("log")

%>

<%

dim rs,str,cn,sqlstr,p

set cn=server.createobject("ADODB.connection")

str="provider=microsoft.jet.oledb.4.0;data source="&server.mappath("./db/db1.mdb")

cn.open str

set rs=server.createobject("adodb.recordset")

sqlstr="select user,password from db1 where user='"&user&"'"

rs.open sqlstr,cn,1,3

if rs.eof then

response.write "<script language='javascript'>alert('用户名不存在');;location.href='log.html'</script>" 

elseif rs("password")<>pwd then

response.write "<script language='javascript'>alert('密码不正确');;location.href='log.html'</script>" 

end if

rs.close

set cn=nothing

%>

<%

dim userinf

session("name")=request("user")

userinf=session("name")&"在"&time&"进入聊天室"

application.lock

application("mark")=userinf&"<br>"&application("mark")

application.unlock

%>

<html>

<head>

<title>聊天室主界面</title>

</head>

<frameset rows="30%,*" frameborder="yes">

<frame src="speak.asp" target="_self">

<frameset cols="60%,*" frameborder="yes">

<frame src="display.asp">

<frame src="mark.asp">

</frameset>

</frameset>

</html>

register.html的代码为:

<!doctype html>

<html>

 <head>

 <title>用户注册</title>

 <!--meta charset="utf-8"-->

 </head>

 <body>

 <h1 align="center"><font color="#000080" face="华文新魏" size="8">用户注册</font></h1>

 <form name="form2" action="check1.asp" method="post">

 <table align="center">

 <tr>

 <td>请输入用户名:</td><td><input type="text" name="user1"></td>

 </tr>

 <tr>

 <td>请输入密码:</td><td><input type="password" name="pwd1"></td>

 </tr>

 <tr>

 <td><input type="submit" value="注册" name="B"></td><td colspan="2"><input type="reset" value="重置" name="B1"></td>

 </tr>

 </table>

 </form>

 </body>

check1.asp的代码为:

<%

dim user,pwd,log,regis,rs1,driver,cn1,sqlstr1,dbpath

user=request("user1")

pwd=request("pwd1")

log=request("B")

set cn1=server.createobject("ADODB.connection")

driver="Driver={Microsoft Access Driver (*.mdb)};"

dbpath="DBQ="&server.mappath("./db/db1.mdb")

cn1.open driver&dbpath

set rs1=server.createobject("adodb.recordset")

sqlstr1="select user,password from db1 where user='"&user&"'"

rs1.open sqlstr1,cn1,1,3

if  not rs1.eof then

response.write "<script language='javascript'>alert('用户名存在,请重新输入!');;location.href='register.html'</script>"

else

sqlstr1="insert into db1(user,password) values('"&user&"','"&pwd&"')"

response.write "注册成功!,请到登陆界面登录!"

cn1.execute  sqlstr1

end if

rs1.close

set cn1=nothing

%>

speak.asp的代码为:

<!doctype html>

<html>

<head>

<title>speak page</title>

<script language="javascript">

function go(){

 history.go(0)

}

</script>

</head>

<%

dim username,speak,information

if not request("message")="" then

username=session("name")

speak=request("message")

information=""&username&"说:"&speak&""

application.lock

application("talk")=information&"<br>"&application("talk")

applicatin.unlock

end if

%>

<body bgcolor="lightgreen">

<form method="post" action="speak.asp" name="form3">

<%=session("name")&","%>请输入要说的话,或<a href="logout.asp"  target="_parent">退出聊天室</a><br>

<input type="text" name="message" size="60">

<input type="submit" value="发送" onclick="return go();">

</form>

</body>

</html>

display.asp的代码为

<!doctype html>

<html>

  <head>

  <title>display the information</title>

  <meta http-equiv="refresh" content="10">

  </head>

  <body>

  <%

  response.write application("talk")

  %>

  </body>

</html>

mark.asp的代码为:

<!doctype html>

<html>

<head>

<meta http-equiv="refresh" content="10">

</head>

<body bgcolor="grey">

<%

response.write application("mark")

%>

</body>

</html>

logout.asp的代码为:

<%

dim name,str

name=session("name")

str=name&"在"&time&"退出"

application("mark")=str&"</br>"&application("mark")

response.redirect "log.html"

%>

 2、界面

登录界面如下:

注册界面如下:

功能主界面如下:

数据库文件截图如下:

四、实验总结

通过此次实验,我比较熟练的掌握了web的一些基本知识,

知道了如何设计一个web系统,以及在设计过程中会遇到哪些问题,以及如何解决这些问题的方法。

更多相关推荐:
web简单网页课程设计报告

设计内容及要求lt1gt使用各种HTML标记CSS各种常用样式及简单的JavaScript技术完成的网页没有错误lt2gt首页设置导航栏命名为indexhtmllt3gt利用CSS技术对网站进行布局网站风格统一...

《Web程序设计课程设计》报告

洛阳理工学院课程设计报告课程名称Web程序设计课程设计设计题目学生成绩管理系统专业计算机科学与技术班级学号姓名完成日期20xx627课程设计任务书设计题目学生成绩管理系统设计内容与要求设计一个学生成绩管理系统基...

Web课程设计报告模板

课程设计报告学院系专业名称课程设计科目题目学号姓名指导教师完成时间计算机科学与技术系20xx计算机软件工程网络工程Web程序设计企业网站与开发系统小组所有成员的学号姓名杨智泽20xx年2月4月目录1开发背景32...

web程序设计课程报告

MyPetShop商城系统分析报告1课程作业概述11课程实习的目的WEB开发技术是一门实用性综合性较强的课程学生在学完本门课程后不仅要了解WEB设计的方法和技术更重要的是能综合应用所学的数据库高级编程语言及网页...

web课程设计报告

重庆邮电大学移通学院Web程序设计课程设计报告学生学号班级专业重庆邮电大学移通学院20xx年5月重庆邮电大学移通学院目录的设计与实现3课程设计总结14参考文献15重庆邮电大学移通学院学生成绩管理信息系统的设计与...

web课程设计报告范例

课程设计论文任务书学院专业班一课程设计论文题目二课程设计论文工作自20xx年6月22日起至20xx年7月8日止三课程设计论文地点创新大楼四课程设计论文内容要求1本课程设计的目的1加深web技术基本概念的了解2灵...

《Web应用技术课程设计》报告

淮海工学院计算机工程学院课程设计报告设计名称Web开发课程设计姓名学号专业班级系院设计时间设计地点图书馆计算机楼计算中心

web课程设计报告-视频网站

Web应用开发基础设计题目电影网站设计与实现系部信息技术工程学院专业xxxxxxxx班级xxxxxxxx学号xxxxxxxxxxxx姓名xxxxxxx目录一实验目的3二实验需求3三实验功能3四实验内容31设计主...

java 课程设计 实验报告

JavaScript课程

20xx-20xx Java Web课程设计(1)

JavaWeb课程设计课程设计报告正文书写要求1课程设计报告书的正文内容格式如下目录二字三号宋体加粗目录内容四号宋体一级标题三号宋体加粗二级标题四号宋体加粗正文内容小四宋体单倍行距段落缩进两个字符图表号5号宋体...

学号web数据库编程——Java课程设计报告

web数据库编程java课程设计报告班级09计高本姓名陈丽真学号090803131日期20xx年1月3日漳州师范学院计算机科学与工程系目录1设计内容12概要设计13自定义类及接口说明34程序源码35程序运行与调...

Labview课程设计报告-张凯强

课程设计报告摘要要在LABVIEW环境中进行对声卡编程就是运用常用周期信号及测试领域特殊信号的双通道模拟输出由于专用数据采集卡成本比较昂贵而且和计算机兼容性比较差等缺点这个论文就是应用性能良好价格低廉的计算机声...

web课程设计报告(19篇)