一个订单管理页面
最近做项目,中间设计到用户在线提交订单;本来客户的要求很简单,可能被我做复杂了,结果确实我只用一个页面就完成了所有的功能,贴出来献丑了;为了赶时间,还没有集成分页功能,所以无论在公用页面读取现有的项目的时候,或者还是在个人页面读取现有的数据,都没有分页,而是采用了select top 10 * title From table的方法……等有时间了,再集成分页吧
主要代码如下:
<!--#include file="Inc/Const.asp"-->
<table width="485" height="400" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="12"> </td>
<td width="459" valign="top"><br>
<%
Dim Action,Action1
Action=Request("Action")
Select Case Action
Case "Reg"
Call Reg()
Case "SaveReg"
Call SaveReg()
Case "Login"
Call Login()
Case "ChkLogin"
Call ChkLogin()
Case "AddOrder"
Call AddOrder()
Case "SaveOrder"
Call SaveOrder()
Case "Success"
Call Success()
Case "ModyOrder"
Call ModyOrder()
Case "SaveMody"
Call SaveMody()
Case "DelOrder"
Call DelOrder()
Case "LoginOut"
Call LoginOut()
Case "ShowOrder"
Call ShowOrder()
Case Else
Call Main()
End Select
'++++++++++++++++++++++++++++主函数开始
Sub Main()
%>
<% '++++++++++++++++++++++主函数开始%>
<table width="400" border="1" align="center" cellpadding="5" cellspacing="0" bordercolor="f5f5f5" style="border-collapse:collapse">
<tr class="table_row_1">
<td height="30"><font color="FF6633">所有订单如下:</font></td>
</tr>
<%sql="select top 8 OrderComName,OrderClass,OrderId From [Order] order by Orderid desc"
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "<p align='center'><font color=red> 对不起,没有找到任何订单</font></p>"
else
do while not rs.eof%>
<tr class="table_row_1">
<td height="30"><a href="Order.asp?OrderId=<%=Rs("OrderId")%>&Action=ShowOrder"><%=rs("OrderComName")&"-----"&rs("OrderClass")%></a></td>
</tr>
<%Rs.movenext
loop
rs.close
set rs=nothing
end If
%>
</table>
<p> </p>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="20%">
<form name="Main1" method="post" action="?">
<div align="center">
<input type="submit" name="Main1" value="管理我的订单" class="button">
<input type="hidden" name="Action" value="Login">
</div>
</form></td>
<td><form name="Main2" method="post" action="?">
<div align="center">
<input type="submit" name="Main2" value="新用户注册" class="button">
<input type="hidden" name="Action" value="Reg">
</div>
</form></td>
</tr>
</table>
<br><%
End Sub
'++++++++++++++++++++++++++++主函数结束
'++++++++++++++++++++++++++++用户注册函数开始
Sub Reg()
%>
<form name="reg" method="post" action="?">
<table width="400" border="0" align="center" cellpadding="5" cellspacing="0">
<tr class="table_row_1">
<td colspan="2"><div align="center"><strong><font color="#FF6633">用
户 注 册</font></strong></div></td>
</tr>
<tr class="table_row_1">
<td width="200"><div align="right">用户名: </div></td>
<td><input name="UserName" type="text" class="editbox" id="UserName" size="16"></td>
</tr>
<tr class="table_row_1">
<td><div align="right">密 码: </div></td>
<td><input name="Password" type="password" class="editbox" id="Password" size="16"></td>
</tr>
<tr class="table_row_1">
<td colspan="2"><div align="center">
<input type="hidden" name="Action" value="SaveReg">
<input type="submit" name="SubmitReg" value="提交" class="button">
<input type="Reset" name="ResetReg" value="取消" class="button">
</div></td>
</tr>
</table>
</form>
<%
End Sub
'++++++++++++++++++++++++++++用户注册函数结束
'++++++++++++++++++++++++++保存注册信息开始
Sub SaveReg()
UserName=Trim(Request.Form("UserName"))
Password=Trim(Request.Form("Password"))
If UserName="" Or Len(UserName)=0 or Len(UserName)>16 or UserName="Admin" or UserName="admin" Then
ErrorMsg1=true
Else
ErrorMsg1=False
End If
If Password="" Or Len(Password)=0 or Len(Password)<6 Or Len(Password)>16 then
ErrorMsg2=true
Else
ErrorMsg2=False
End If
If ErrorMsg1=True or ErrorMsg2=True then
Response.Write("<li>用户名长度必须大于0,小于20</li>")
Response.Write("<li>密码不能为空,长度必须大于6,小于16</li>")
Response.Write("<p align='center'><a href='#' OnClick='vbscript:history.back()'>【返回】</a></p>")
End If
If (ErrorMag1=false and ErrorMsg2=false) Then
Set RsReg=Server.CreateObject("Adodb.Recordset")
SqlReg="Select * From [User] Where Username='"&UserName&"' "
RsReg.Open sqlReg,Conn,1,3
If Not (RsReg.Eof or RsReg.Bof) Then
Response.Write("对不起,你的用户名已经被他人使用!")
Response.Write("<p align='center'><a href='#' OnClick='vbscript:history.back()'>【返回】</a></p>")
Response.End()
Else
RsReg.AddNew
RsReg("UserName")=UserName
RsReg("Password")=Password
RsReg.Update
End If
RsReg.Close
Set RsReg=Nothing
Session("UserName")=UserName
Call Success()
End If
End Sub
'++++++++++++++++++++++++++保存注册信息完毕
'++++++++++++++++++++++++++登陆开始
Sub Login()
%>
<form name="Login" method="post" action="?">
<table width="400" border="0" align="center" cellpadding="5" cellspacing="0">
<tr class="table_row_1">
<td colspan="2"><div align="center"><strong><font color="#FF6633">用
户 等 陆</font></strong></div></td>
</tr>
<tr class="table_row_1">
<td width="200"><div align="right">用户名: </div></td>
<td><input name="UserName" type="text" class="editbox" id="UserName" size="16"></td>
</tr>
<tr class="table_row_1">
<td><div align="right">密码: </div></td>
<td><input name="Password" type="password" class="editbox" id="Password" size="16"></td>
</tr>
<tr class="table_row_1">
<td colspan="2"> <div align="center">
<input name="Action" type="hidden" id="Action" value="ChkLogin">
<input name="SubmitLogin" type="submit" class="button" id="SubmitLogin" value="提交">
<input name="Resetlogin" type="Reset" class="button" id="Resetlogin" value="取消">
</div></td>
</tr>
</table>
</form>
<%
End Sub
'++++++++++++++++++++++++++登陆结束
'++++++++++++++++++++++++++检查登陆开始
Sub ChkLogin()
UserName=Request.Form("UserName")
PassWord=Request.Form("PassWord")
Set RsChk=Server.CreateObject("Adodb.RecordSet")
SqlChk="Select UserName,PassWord From [User] Where UserName='"&UserName&"' And Password='"&PassWord&"'"
RsChk.Open SqlChk,Conn,1,1
If RsChk.Eof Or Bof Then
Response.Write("<li>用户名不存在</li>")
Response.Write("<li>用户名与密码不一致,拥护密码错误</li>")
Response.Write("<p align='center'><a href='#' OnClick='vbscript:history.back()'>【返回】</a></p>")
Response.End()
Else
Session("UserName")=UserName
Call Success()
End If
End Sub
'++++++++++++++++++++++++++检查登陆结束
'++++++++++++++++++++++++++++用户注册成功或登陆成功函数开始
Sub Success()
If Session("UserName")="" Then
Call Login
Else
%>
<table width="480" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top"> <table width="400" border="2" align="center" cellpadding="5" cellspacing="0" bordercolor="#F5F5F5" style="border-collapse:collapse">
<tr class="table_row_1">
<td height="30"> <div align="center"><strong><font color="#FF6633">用户面板:欢迎您<%=Session("UserName")%></font></strong></div></td>
<td><div align="center"><a href="Order.asp?Action=AddOrder">增加订单</a></div></td>
<td><div align="center"><a href="Order.asp?Action=LoginOut">注销登陆</a></div></td>
</tr>
</table></td>
</tr>
<tr>
<td valign="top"> <%Call UserMain()%> </td>
</tr>
</table>
<%
End If
End Sub
'++++++++++++++++++++++++++++用户注册或登陆成功函数结束
'++++++++++++++++++++++用户主函数开始
Sub UserMain()
If Session("UserName")="" Then
Call Login
Else
%>
<br>
<table width="400" border="1" align="center" cellpadding="5" cellspacing="0" bordercolor="#F5F5F5" style="Border-Collapse:Collapse">
<tr class="table_row_1">
<td height="30" colspan="3"><font color="FF6633">您的订单如下</font></td>
</tr>
<%sql="select top 8 OrderId,OrderComName,OrderClass,IsCheck From [Order] Where OrderUserName='"&Session("UserName")&"' order by Orderid desc"
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "<div align='center'><font color=red> 对不起 <strong>"&Session("UserName")&"</strong>,没有找到您的任何订单</font></div>"
else
do while not rs.eof%>
<tr class="table_row_1">
<td height="30"> <a Href="Order.asp?OrderId=<%=rs("OrderId")%>&Action=ShowOrder"><%=rs("OrderComName")&"-----"&rs("OrderClass")%></a></td>
<td width="40"><%tmpIsChk=Cint(rs("IsCheck"))
If tmpIsChk=1 then
Response.Write("<font color='#FF6633'><strong>已审核</strong></font>")
ElseIf tmpIsChk=0 Then
Response.Write("<font color='#FF6633'><strong>未审核</strong></font>")
End If%></td>
<td width="60"><a href="Order.asp?Action=ModyOrder&OrderId=<%=rs("OrderId")%>">修改</a>
<a href="Order.asp?Action=DelOrder&OrderId=<%=rs("OrderId")%>">删除</a></td>
</tr>
<%Rs.movenext
loop
rs.close
set rs=nothing
end If
%>
</table>
<%
End If
End Sub
'++++++++++++++++++++++用户主函数结束
'++++++++++++++++++++++++++++增加订单函数开始
Sub AddOrder()
If Session("UserName")="" Then
Call Login
Else
%>
<table width="400" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#f7f7f7">
<form name="AddOrder" action="?" method="post">
<tr bgcolor="#FFFFFF">
<td colspan="2">网站类型:
<select name="OrderClass">
<option value="自己定制" selected>自己定制</option>
<option value="企业入门型" onMouseOver="">企业入门型</option>
<option value="企业宣传型">企业宣传型</option>
<option value="企业产品展示型">企业产品展示型</option>
<option value="企业电子商务型">企业电子商务型</option>
<option value="企业门户">企业门户</option>
</select> <br> <br>
公司名称:
<input name="OrderComName" type="text" class="editbox" size="30">
<br> <br>
网站建设目的:<br> <textarea name="OrderAim" cols="60" rows="4" ></textarea>
<br> <br>
设计要求:<br> <textarea name="OrderRequest" cols="60" rows="4" ></textarea>
<br> <br>
网站内容简要介绍:<br> <textarea name="OrderIntro" cols="60" rows="6" ></textarea>
<br> <br>
网站需要的功能模块:<br>
(需要特殊功能的也请在这里写下功能的描述)
<textarea name="OrderModule" cols="60" rows="5" ></textarea></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="40"> </td>
<td><input type="hidden" name="Action" value="SaveOrder">
<input type="submit" name="Submit" value="提交" class="button">
<input type="Reset" name="Submit2" value="取消" class="button">
</td>
</tr>
</form>
</table>
<%
End IF
End Sub
'++++++++++++++++++++++++++++增加订单函数结束
'++++++++++++++++++++++++++++保存订单函数开始
Sub SaveOrder()
If Session("UserName")="" Then
Call Login
Else
Dim OrderClass,OrderBillNo,OrderUserName,OrderComName,OrderAim,OrderRequest,OrderIntro,OrderModule
OrderBillNo="DW-"&Year(Date)&Right("00"&Month(Date),2)&Right("00"&Day(Date),2)&Right("00"&Hour(Time),2)&Right("00"&Minute(Time),2)&Right("00"&Second(Time),2)
OrderClass=Trim(Request.form("OrderClass"))
OrderComName=Trim(Request.form("OrderComName"))
OrderAim=Trim(Request.form("OrderAim"))
OrderRequest=Trim(Request.form("OrderRequest"))
OrderIntro=Trim(Request.form("OrderIntro"))
OrderModule=Trim(Request.form("OrderModule"))
Set RsSvOrder=Server.CreateObject("Adodb.RecordSet")
SqlSvOrder="Select * From [Order]"
RsSvOrder.Open SqlSvOrder,Conn,1,3
RsSvOrder.AddNew
RsSvOrder("OrderClass")=OrderClass
RsSvOrder("OrderComName")=OrderComName
RsSvOrder("OrderBillNo")=OrderBillNo
RsSvOrder("OrderUserName")=Session("UserName")
RsSvOrder("OrderAim")=OrderAim
RsSvOrder("OrderRequest")=OrderRequest
RsSvOrder("OrderIntro")=OrderIntro
RsSvOrder("OrderModule")=OrderModule
RsSvOrder.Update
RsSvOrder.Close
Set RsSvOrder=Nothing
Call Success()
End If
End Sub
'++++++++++++++++++++++++++++保存订单函数结束
'++++++++++++++++++++++++++++修改订单函数开始
Sub ModyOrder()
If Session("UserName")="" Then
Call Login
Else
Set RsM=Server.CreateObject("Adodb.Recordset")
SqlM="Select * From [Order] Where OrderId="&Request("OrderId")
RsM.Open SqlM,Conn,1,1
%>
<table width="400" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#f7f7f7">
<form name="AddOrder" action="?" method="post">
<tr bgcolor="#FFFFFF">
<td colspan="2">网站类型:
<select name="OrderClass">
<option value="自己定制" selected>自己定制</option>
<option value="企业入门型" onMouseOver="">企业入门型</option>
<option value="企业宣传型">企业宣传型</option>
<option value="企业产品展示型">企业产品展示型</option>
<option value="企业电子商务型">企业电子商务型</option>
<option value="企业门户">企业门户</option>
</select> <br> <br>
公司名称:
<input name="OrderComName" type="text" class="editbox" size="30" value="<%=RsM("OrderComName")%>">
<br> <br>
网站建设目的:<br>
<textarea name="OrderAim" cols="60" rows="4"><%=RsM("OrderAim")%></textarea>
<br> <br>
设计要求:<br> <textarea name="OrderRequest" cols="60" rows="4"><%=RsM("OrderRequest")%></textarea>
<br> <br>
网站内容简要介绍:<br> <textarea name="OrderIntro" cols="60" rows="6"><%=RsM("OrderIntro")%></textarea>
<br> <br>
网站需要的功能模块:<br>
(需要特殊功能的也请在这里写下功能的描述)
<textarea name="OrderModule" cols="60" rows="5"><%=RsM("OrderModule")%></textarea></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="40"> </td>
<td><input type="hidden" name="Action" value="SaveMody">
<input type="hidden" name="OrderId" value="<%=RsM("OrderId")%>">
<input type="submit" name="Submit" value="提交" class="button">
<input type="Reset" name="Submit2" value="取消" class="button">
</td>
</tr>
</form>
</table>
<%
RsM.Close
Set RsM=Nothing
End If
End Sub
'++++++++++++++++++++++++++++修改订单函数结束
'++++++++++++++++++++++++++++保存订单修改函数开始
Sub SaveMody()
If Session("UserName")="" Then
Call Login
Else
Dim OrderClass,OrderBillNo,OrderUserName,OrderComName,OrderAim,OrderRequest,OrderIntro,OrderModule
OrderClass=Trim(Request.form("OrderClass"))
OrderComName=Trim(Request.form("OrderComName"))
OrderAim=Trim(Request.form("OrderAim"))
OrderRequest=Trim(Request.form("OrderRequest"))
OrderIntro=Trim(Request.form("OrderIntro"))
OrderModule=Trim(Request.form("OrderModule"))
Set RsSvOrder=Server.CreateObject("Adodb.RecordSet")
SqlSvOrder="Select * From [Order] Where OrderId="&Request.Form("OrderId")
RsSvOrder.Open SqlSvOrder,Conn,1,3
RsSvOrder("OrderClass")=OrderClass
RsSvOrder("OrderComName")=OrderComName
RsSvOrder("OrderAim")=OrderAim
RsSvOrder("OrderRequest")=OrderRequest
RsSvOrder("OrderIntro")=OrderIntro
RsSvOrder("OrderModule")=OrderModule
RsSvOrder.Update
RsSvOrder.Close
Set RsSvOrder=Nothing
Call Success()
End If
End Sub
'++++++++++++++++++++++++++++保存订单修改函数结束
'++++++++++++++++++++++++++++删除订单函数开始
Sub DelOrder
If Session("UserName")="" Then
Call Login
Else
Set RsDel=Conn.Execute("Delete * From [Order] Where OrderId="&Request("OrderId"))
Call Success
End If
End Sub
'++++++++++++++++++++++++++++删除订单函数结束
'++++++++++++++++++++++++++++显示订单函数开始
Sub ShowOrder()
Set Rs=Server.CreateObject("Adodb.Recordset")
Sql="Select * From [Order] Where OrderId="&Request("OrderId")
Rs.Open Sql,Conn,1,1
%>
<table width="90%" border="1" align="center" cellpadding="5" cellspacing="0" bordercolor="F5F5F5" style="Border-Collapse:Collapse">
<tr class="table_row_1">
<td height="30" colspan="2" bgcolor="#cccccc"> <div align="center"><strong><font color="#ff6633">显
示 项 目</font></strong></div></td>
</tr>
<tr class="table_row_1">
<td width="20%" height="24" align="center">公司名称</td>
<td><%=rs("OrderComname")%></td>
</tr>
<tr class="table_row_1">
<td height="24" align="center">添加人</td>
<td><%=rs("OrderUserName")%></td>
</tr>
<tr class="table_row_1">
<td height="24" align="center">项目类型</td>
<td><%=rs("OrderClass")%></td>
</tr>
<tr class="table_row_1">
<td height="24" align="center">建站目的</td>
<td ><%=rs("OrderAim")%></td>
</tr>
<tr class="table_row_1">
<td height="24" align="center">建站要求</td>
<td ><%=rs("OrderRequest")%></td>
</tr>
<tr class="table_row_1">
<td height="24" align="center">项目简介</td>
<td><%=rs("OrderIntro")%></td>
</tr>
<tr class="table_row_1">
<td height="24" align="center">项目模块</td>
<td><%=rs("OrderModule")%></td>
</tr>
<%If Session("UserName")<>"" Then%>
<tr class="table_row_1">
<td height="24" align="center">备注</td>
<td>如果你想确认订单,请记住你订单的唯一<br>
账单号码为:<font color="#ff0000"><%=Rs("OrderBillNo")%></font><br>
<br>
帐单号码的作用:1 确认客户的利益不受到侵犯;<br>
2 确认订单的重要依据:我们将根据你提供的订单<br>
项目内容与帐单号码进行确认,只有在两者一致<br>
的情况下我们才能最后确认。</td>
</tr>
<%End IF%>
<%
Set Rs=Server.Createobject("Adodb.Recordset")
sql="select OrderID,OrderComName from [Order] where isCheck=0 order by OrderId desc"
Rs.CursorLocation=3
Rs.Open Sql,Conn,1
ArticleCount=Rs.RecordCount
PageSize=20
Dim Css
Page=Request.QueryString("Page")
If Page="" Or Page<1 Then
Page=1
Else
Page=Cint(Page)
End If
I=1
If ArticleCount Mod Cint(PageSize)=0 Then
PageCount= ArticleCount Cint(PageSize)
Else
PageCount= ArticleCount Cint(PageSize)+1
End If
If Not (Rs.Bof And Rs.Eof) Then
Rs.Movefirst
If Page > PageCount Then Page = PageCount
If Page<1 Then Page=1
Rs.Move (Page-1) * Cint(PageSize)
do while not rs.eof And I<=PageSize
I=I+1
If I Mod 2=0 Then
Css="Table_row_1"
Else
Css="Table_row_2"
End If
%>
<%
rs.movenext
loop
End If
rs.close
set rs=nothing
%>
</table>
<p align="center">
<input name="goback" type="button" id="goback" onClick="Vbscript:history.back()" value="后 退" class="button">
</p>
<%
End Sub
'++++++++++++++++++++++++++++显示订单函数结束
'++++++++++++++++++++++++++++注销函数开始
Sub LoginOut()
Session("UserName")=""
Call Main()
End Sub
'++++++++++++++++++++++++++++注销函数结束
%>
</td>
<td width="14"> </td>
</tr>
</table>
<table width="485" height="400" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="12"> </td>
<td width="459" valign="top"><br>
<%
Dim Action,Action1
Action=Request("Action")
Select Case Action
Case "Reg"
Call Reg()
Case "SaveReg"
Call SaveReg()
Case "Login"
Call Login()
Case "ChkLogin"
Call ChkLogin()
Case "AddOrder"
Call AddOrder()
Case "SaveOrder"
Call SaveOrder()
Case "Success"
Call Success()
Case "ModyOrder"
Call ModyOrder()
Case "SaveMody"
Call SaveMody()
Case "DelOrder"
Call DelOrder()
Case "LoginOut"
Call LoginOut()
Case "ShowOrder"
Call ShowOrder()
Case Else
Call Main()
End Select
'++++++++++++++++++++++++++++主函数开始
Sub Main()
%>
<% '++++++++++++++++++++++主函数开始%>
<table width="400" border="1" align="center" cellpadding="5" cellspacing="0" bordercolor="f5f5f5" style="border-collapse:collapse">
<tr class="table_row_1">
<td height="30"><font color="FF6633">所有订单如下:</font></td>
</tr>
<%sql="select top 8 OrderComName,OrderClass,OrderId From [Order] order by Orderid desc"
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "<p align='center'><font color=red> 对不起,没有找到任何订单</font></p>"
else
do while not rs.eof%>
<tr class="table_row_1">
<td height="30"><a href="Order.asp?OrderId=<%=Rs("OrderId")%>&Action=ShowOrder"><%=rs("OrderComName")&"-----"&rs("OrderClass")%></a></td>
</tr>
<%Rs.movenext
loop
rs.close
set rs=nothing
end If
%>
</table>
<p> </p>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="20%">
<form name="Main1" method="post" action="?">
<div align="center">
<input type="submit" name="Main1" value="管理我的订单" class="button">
<input type="hidden" name="Action" value="Login">
</div>
</form></td>
<td><form name="Main2" method="post" action="?">
<div align="center">
<input type="submit" name="Main2" value="新用户注册" class="button">
<input type="hidden" name="Action" value="Reg">
</div>
</form></td>
</tr>
</table>
<br><%
End Sub
'++++++++++++++++++++++++++++主函数结束
'++++++++++++++++++++++++++++用户注册函数开始
Sub Reg()
%>
<form name="reg" method="post" action="?">
<table width="400" border="0" align="center" cellpadding="5" cellspacing="0">
<tr class="table_row_1">
<td colspan="2"><div align="center"><strong><font color="#FF6633">用
户 注 册</font></strong></div></td>
</tr>
<tr class="table_row_1">
<td width="200"><div align="right">用户名: </div></td>
<td><input name="UserName" type="text" class="editbox" id="UserName" size="16"></td>
</tr>
<tr class="table_row_1">
<td><div align="right">密 码: </div></td>
<td><input name="Password" type="password" class="editbox" id="Password" size="16"></td>
</tr>
<tr class="table_row_1">
<td colspan="2"><div align="center">
<input type="hidden" name="Action" value="SaveReg">
<input type="submit" name="SubmitReg" value="提交" class="button">
<input type="Reset" name="ResetReg" value="取消" class="button">
</div></td>
</tr>
</table>
</form>
<%
End Sub
'++++++++++++++++++++++++++++用户注册函数结束
'++++++++++++++++++++++++++保存注册信息开始
Sub SaveReg()
UserName=Trim(Request.Form("UserName"))
Password=Trim(Request.Form("Password"))
If UserName="" Or Len(UserName)=0 or Len(UserName)>16 or UserName="Admin" or UserName="admin" Then
ErrorMsg1=true
Else
ErrorMsg1=False
End If
If Password="" Or Len(Password)=0 or Len(Password)<6 Or Len(Password)>16 then
ErrorMsg2=true
Else
ErrorMsg2=False
End If
If ErrorMsg1=True or ErrorMsg2=True then
Response.Write("<li>用户名长度必须大于0,小于20</li>")
Response.Write("<li>密码不能为空,长度必须大于6,小于16</li>")
Response.Write("<p align='center'><a href='#' OnClick='vbscript:history.back()'>【返回】</a></p>")
End If
If (ErrorMag1=false and ErrorMsg2=false) Then
Set RsReg=Server.CreateObject("Adodb.Recordset")
SqlReg="Select * From [User] Where Username='"&UserName&"' "
RsReg.Open sqlReg,Conn,1,3
If Not (RsReg.Eof or RsReg.Bof) Then
Response.Write("对不起,你的用户名已经被他人使用!")
Response.Write("<p align='center'><a href='#' OnClick='vbscript:history.back()'>【返回】</a></p>")
Response.End()
Else
RsReg.AddNew
RsReg("UserName")=UserName
RsReg("Password")=Password
RsReg.Update
End If
RsReg.Close
Set RsReg=Nothing
Session("UserName")=UserName
Call Success()
End If
End Sub
'++++++++++++++++++++++++++保存注册信息完毕
'++++++++++++++++++++++++++登陆开始
Sub Login()
%>
<form name="Login" method="post" action="?">
<table width="400" border="0" align="center" cellpadding="5" cellspacing="0">
<tr class="table_row_1">
<td colspan="2"><div align="center"><strong><font color="#FF6633">用
户 等 陆</font></strong></div></td>
</tr>
<tr class="table_row_1">
<td width="200"><div align="right">用户名: </div></td>
<td><input name="UserName" type="text" class="editbox" id="UserName" size="16"></td>
</tr>
<tr class="table_row_1">
<td><div align="right">密码: </div></td>
<td><input name="Password" type="password" class="editbox" id="Password" size="16"></td>
</tr>
<tr class="table_row_1">
<td colspan="2"> <div align="center">
<input name="Action" type="hidden" id="Action" value="ChkLogin">
<input name="SubmitLogin" type="submit" class="button" id="SubmitLogin" value="提交">
<input name="Resetlogin" type="Reset" class="button" id="Resetlogin" value="取消">
</div></td>
</tr>
</table>
</form>
<%
End Sub
'++++++++++++++++++++++++++登陆结束
'++++++++++++++++++++++++++检查登陆开始
Sub ChkLogin()
UserName=Request.Form("UserName")
PassWord=Request.Form("PassWord")
Set RsChk=Server.CreateObject("Adodb.RecordSet")
SqlChk="Select UserName,PassWord From [User] Where UserName='"&UserName&"' And Password='"&PassWord&"'"
RsChk.Open SqlChk,Conn,1,1
If RsChk.Eof Or Bof Then
Response.Write("<li>用户名不存在</li>")
Response.Write("<li>用户名与密码不一致,拥护密码错误</li>")
Response.Write("<p align='center'><a href='#' OnClick='vbscript:history.back()'>【返回】</a></p>")
Response.End()
Else
Session("UserName")=UserName
Call Success()
End If
End Sub
'++++++++++++++++++++++++++检查登陆结束
'++++++++++++++++++++++++++++用户注册成功或登陆成功函数开始
Sub Success()
If Session("UserName")="" Then
Call Login
Else
%>
<table width="480" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top"> <table width="400" border="2" align="center" cellpadding="5" cellspacing="0" bordercolor="#F5F5F5" style="border-collapse:collapse">
<tr class="table_row_1">
<td height="30"> <div align="center"><strong><font color="#FF6633">用户面板:欢迎您<%=Session("UserName")%></font></strong></div></td>
<td><div align="center"><a href="Order.asp?Action=AddOrder">增加订单</a></div></td>
<td><div align="center"><a href="Order.asp?Action=LoginOut">注销登陆</a></div></td>
</tr>
</table></td>
</tr>
<tr>
<td valign="top"> <%Call UserMain()%> </td>
</tr>
</table>
<%
End If
End Sub
'++++++++++++++++++++++++++++用户注册或登陆成功函数结束
'++++++++++++++++++++++用户主函数开始
Sub UserMain()
If Session("UserName")="" Then
Call Login
Else
%>
<br>
<table width="400" border="1" align="center" cellpadding="5" cellspacing="0" bordercolor="#F5F5F5" style="Border-Collapse:Collapse">
<tr class="table_row_1">
<td height="30" colspan="3"><font color="FF6633">您的订单如下</font></td>
</tr>
<%sql="select top 8 OrderId,OrderComName,OrderClass,IsCheck From [Order] Where OrderUserName='"&Session("UserName")&"' order by Orderid desc"
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "<div align='center'><font color=red> 对不起 <strong>"&Session("UserName")&"</strong>,没有找到您的任何订单</font></div>"
else
do while not rs.eof%>
<tr class="table_row_1">
<td height="30"> <a Href="Order.asp?OrderId=<%=rs("OrderId")%>&Action=ShowOrder"><%=rs("OrderComName")&"-----"&rs("OrderClass")%></a></td>
<td width="40"><%tmpIsChk=Cint(rs("IsCheck"))
If tmpIsChk=1 then
Response.Write("<font color='#FF6633'><strong>已审核</strong></font>")
ElseIf tmpIsChk=0 Then
Response.Write("<font color='#FF6633'><strong>未审核</strong></font>")
End If%></td>
<td width="60"><a href="Order.asp?Action=ModyOrder&OrderId=<%=rs("OrderId")%>">修改</a>
<a href="Order.asp?Action=DelOrder&OrderId=<%=rs("OrderId")%>">删除</a></td>
</tr>
<%Rs.movenext
loop
rs.close
set rs=nothing
end If
%>
</table>
<%
End If
End Sub
'++++++++++++++++++++++用户主函数结束
'++++++++++++++++++++++++++++增加订单函数开始
Sub AddOrder()
If Session("UserName")="" Then
Call Login
Else
%>
<table width="400" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#f7f7f7">
<form name="AddOrder" action="?" method="post">
<tr bgcolor="#FFFFFF">
<td colspan="2">网站类型:
<select name="OrderClass">
<option value="自己定制" selected>自己定制</option>
<option value="企业入门型" onMouseOver="">企业入门型</option>
<option value="企业宣传型">企业宣传型</option>
<option value="企业产品展示型">企业产品展示型</option>
<option value="企业电子商务型">企业电子商务型</option>
<option value="企业门户">企业门户</option>
</select> <br> <br>
公司名称:
<input name="OrderComName" type="text" class="editbox" size="30">
<br> <br>
网站建设目的:<br> <textarea name="OrderAim" cols="60" rows="4" ></textarea>
<br> <br>
设计要求:<br> <textarea name="OrderRequest" cols="60" rows="4" ></textarea>
<br> <br>
网站内容简要介绍:<br> <textarea name="OrderIntro" cols="60" rows="6" ></textarea>
<br> <br>
网站需要的功能模块:<br>
(需要特殊功能的也请在这里写下功能的描述)
<textarea name="OrderModule" cols="60" rows="5" ></textarea></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="40"> </td>
<td><input type="hidden" name="Action" value="SaveOrder">
<input type="submit" name="Submit" value="提交" class="button">
<input type="Reset" name="Submit2" value="取消" class="button">
</td>
</tr>
</form>
</table>
<%
End IF
End Sub
'++++++++++++++++++++++++++++增加订单函数结束
'++++++++++++++++++++++++++++保存订单函数开始
Sub SaveOrder()
If Session("UserName")="" Then
Call Login
Else
Dim OrderClass,OrderBillNo,OrderUserName,OrderComName,OrderAim,OrderRequest,OrderIntro,OrderModule
OrderBillNo="DW-"&Year(Date)&Right("00"&Month(Date),2)&Right("00"&Day(Date),2)&Right("00"&Hour(Time),2)&Right("00"&Minute(Time),2)&Right("00"&Second(Time),2)
OrderClass=Trim(Request.form("OrderClass"))
OrderComName=Trim(Request.form("OrderComName"))
OrderAim=Trim(Request.form("OrderAim"))
OrderRequest=Trim(Request.form("OrderRequest"))
OrderIntro=Trim(Request.form("OrderIntro"))
OrderModule=Trim(Request.form("OrderModule"))
Set RsSvOrder=Server.CreateObject("Adodb.RecordSet")
SqlSvOrder="Select * From [Order]"
RsSvOrder.Open SqlSvOrder,Conn,1,3
RsSvOrder.AddNew
RsSvOrder("OrderClass")=OrderClass
RsSvOrder("OrderComName")=OrderComName
RsSvOrder("OrderBillNo")=OrderBillNo
RsSvOrder("OrderUserName")=Session("UserName")
RsSvOrder("OrderAim")=OrderAim
RsSvOrder("OrderRequest")=OrderRequest
RsSvOrder("OrderIntro")=OrderIntro
RsSvOrder("OrderModule")=OrderModule
RsSvOrder.Update
RsSvOrder.Close
Set RsSvOrder=Nothing
Call Success()
End If
End Sub
'++++++++++++++++++++++++++++保存订单函数结束
'++++++++++++++++++++++++++++修改订单函数开始
Sub ModyOrder()
If Session("UserName")="" Then
Call Login
Else
Set RsM=Server.CreateObject("Adodb.Recordset")
SqlM="Select * From [Order] Where OrderId="&Request("OrderId")
RsM.Open SqlM,Conn,1,1
%>
<table width="400" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#f7f7f7">
<form name="AddOrder" action="?" method="post">
<tr bgcolor="#FFFFFF">
<td colspan="2">网站类型:
<select name="OrderClass">
<option value="自己定制" selected>自己定制</option>
<option value="企业入门型" onMouseOver="">企业入门型</option>
<option value="企业宣传型">企业宣传型</option>
<option value="企业产品展示型">企业产品展示型</option>
<option value="企业电子商务型">企业电子商务型</option>
<option value="企业门户">企业门户</option>
</select> <br> <br>
公司名称:
<input name="OrderComName" type="text" class="editbox" size="30" value="<%=RsM("OrderComName")%>">
<br> <br>
网站建设目的:<br>
<textarea name="OrderAim" cols="60" rows="4"><%=RsM("OrderAim")%></textarea>
<br> <br>
设计要求:<br> <textarea name="OrderRequest" cols="60" rows="4"><%=RsM("OrderRequest")%></textarea>
<br> <br>
网站内容简要介绍:<br> <textarea name="OrderIntro" cols="60" rows="6"><%=RsM("OrderIntro")%></textarea>
<br> <br>
网站需要的功能模块:<br>
(需要特殊功能的也请在这里写下功能的描述)
<textarea name="OrderModule" cols="60" rows="5"><%=RsM("OrderModule")%></textarea></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="40"> </td>
<td><input type="hidden" name="Action" value="SaveMody">
<input type="hidden" name="OrderId" value="<%=RsM("OrderId")%>">
<input type="submit" name="Submit" value="提交" class="button">
<input type="Reset" name="Submit2" value="取消" class="button">
</td>
</tr>
</form>
</table>
<%
RsM.Close
Set RsM=Nothing
End If
End Sub
'++++++++++++++++++++++++++++修改订单函数结束
'++++++++++++++++++++++++++++保存订单修改函数开始
Sub SaveMody()
If Session("UserName")="" Then
Call Login
Else
Dim OrderClass,OrderBillNo,OrderUserName,OrderComName,OrderAim,OrderRequest,OrderIntro,OrderModule
OrderClass=Trim(Request.form("OrderClass"))
OrderComName=Trim(Request.form("OrderComName"))
OrderAim=Trim(Request.form("OrderAim"))
OrderRequest=Trim(Request.form("OrderRequest"))
OrderIntro=Trim(Request.form("OrderIntro"))
OrderModule=Trim(Request.form("OrderModule"))
Set RsSvOrder=Server.CreateObject("Adodb.RecordSet")
SqlSvOrder="Select * From [Order] Where OrderId="&Request.Form("OrderId")
RsSvOrder.Open SqlSvOrder,Conn,1,3
RsSvOrder("OrderClass")=OrderClass
RsSvOrder("OrderComName")=OrderComName
RsSvOrder("OrderAim")=OrderAim
RsSvOrder("OrderRequest")=OrderRequest
RsSvOrder("OrderIntro")=OrderIntro
RsSvOrder("OrderModule")=OrderModule
RsSvOrder.Update
RsSvOrder.Close
Set RsSvOrder=Nothing
Call Success()
End If
End Sub
'++++++++++++++++++++++++++++保存订单修改函数结束
'++++++++++++++++++++++++++++删除订单函数开始
Sub DelOrder
If Session("UserName")="" Then
Call Login
Else
Set RsDel=Conn.Execute("Delete * From [Order] Where OrderId="&Request("OrderId"))
Call Success
End If
End Sub
'++++++++++++++++++++++++++++删除订单函数结束
'++++++++++++++++++++++++++++显示订单函数开始
Sub ShowOrder()
Set Rs=Server.CreateObject("Adodb.Recordset")
Sql="Select * From [Order] Where OrderId="&Request("OrderId")
Rs.Open Sql,Conn,1,1
%>
<table width="90%" border="1" align="center" cellpadding="5" cellspacing="0" bordercolor="F5F5F5" style="Border-Collapse:Collapse">
<tr class="table_row_1">
<td height="30" colspan="2" bgcolor="#cccccc"> <div align="center"><strong><font color="#ff6633">显
示 项 目</font></strong></div></td>
</tr>
<tr class="table_row_1">
<td width="20%" height="24" align="center">公司名称</td>
<td><%=rs("OrderComname")%></td>
</tr>
<tr class="table_row_1">
<td height="24" align="center">添加人</td>
<td><%=rs("OrderUserName")%></td>
</tr>
<tr class="table_row_1">
<td height="24" align="center">项目类型</td>
<td><%=rs("OrderClass")%></td>
</tr>
<tr class="table_row_1">
<td height="24" align="center">建站目的</td>
<td ><%=rs("OrderAim")%></td>
</tr>
<tr class="table_row_1">
<td height="24" align="center">建站要求</td>
<td ><%=rs("OrderRequest")%></td>
</tr>
<tr class="table_row_1">
<td height="24" align="center">项目简介</td>
<td><%=rs("OrderIntro")%></td>
</tr>
<tr class="table_row_1">
<td height="24" align="center">项目模块</td>
<td><%=rs("OrderModule")%></td>
</tr>
<%If Session("UserName")<>"" Then%>
<tr class="table_row_1">
<td height="24" align="center">备注</td>
<td>如果你想确认订单,请记住你订单的唯一<br>
账单号码为:<font color="#ff0000"><%=Rs("OrderBillNo")%></font><br>
<br>
帐单号码的作用:1 确认客户的利益不受到侵犯;<br>
2 确认订单的重要依据:我们将根据你提供的订单<br>
项目内容与帐单号码进行确认,只有在两者一致<br>
的情况下我们才能最后确认。</td>
</tr>
<%End IF%>
<%
Set Rs=Server.Createobject("Adodb.Recordset")
sql="select OrderID,OrderComName from [Order] where isCheck=0 order by OrderId desc"
Rs.CursorLocation=3
Rs.Open Sql,Conn,1
ArticleCount=Rs.RecordCount
PageSize=20
Dim Css
Page=Request.QueryString("Page")
If Page="" Or Page<1 Then
Page=1
Else
Page=Cint(Page)
End If
I=1
If ArticleCount Mod Cint(PageSize)=0 Then
PageCount= ArticleCount Cint(PageSize)
Else
PageCount= ArticleCount Cint(PageSize)+1
End If
If Not (Rs.Bof And Rs.Eof) Then
Rs.Movefirst
If Page > PageCount Then Page = PageCount
If Page<1 Then Page=1
Rs.Move (Page-1) * Cint(PageSize)
do while not rs.eof And I<=PageSize
I=I+1
If I Mod 2=0 Then
Css="Table_row_1"
Else
Css="Table_row_2"
End If
%>
<%
rs.movenext
loop
End If
rs.close
set rs=nothing
%>
</table>
<p align="center">
<input name="goback" type="button" id="goback" onClick="Vbscript:history.back()" value="后 退" class="button">
</p>
<%
End Sub
'++++++++++++++++++++++++++++显示订单函数结束
'++++++++++++++++++++++++++++注销函数开始
Sub LoginOut()
Session("UserName")=""
Call Main()
End Sub
'++++++++++++++++++++++++++++注销函数结束
%>
</td>
<td width="14"> </td>
</tr>
</table>
所有的函数结束,等有了时间,把他们全部转换成纯asp的文件,另外就是觉得多次操作数据库也不方便,准备把读取数据库编译成com+,不过还不知道怎么做,得努力找找资料