一种新的编程思路(下):附 bbs之register.jsp
register.(sun企业级应用的首选)
---------------------------------------------------------------------------------
<%@page contenttype="text/html;charset=gbk" %>
<%@include file="head.jsp(sun企业级应用的首选)"%>
<%@include file="ntgbdp2002_define.jsp(sun企业级应用的首选)" %>
<%
file://全局变量定义
globaltablename = "bbs_users";
parentkey = "bbs用户资料";
parentvalue = "";
dbname = "mhoa";
%>
<%@include file="ntgbdp2002.jsp(sun企业级应用的首选)" %>
<%
string u = (string)requestht.get("用户名");
if( u==null ) u="";
u = u.trim();
string errorstring = "";
if( ispost && !nt.isdate((string)requestht.get("date出生时间")) ){
errorstring = "请填写正确的出生时间!";
}else if( ispost && !((string)requestht.get("密码")).equals((string)requestht.get("nouse确认密码")) ){
errorstring = "请填写正确的密码!";
}else if( ispost && ( u==null || u.equals("") ) ){
errorstring = "请填写用户名!";
}else if( ispost && isadd && nt.executequery(dbname,"select * from "+ globaltablename +" where k=用户名 and v="+u+" ")>0 ){
errorstring = "已经存在此用户名!";
}
if( ispost && !errorstring.equals("") )
{
out.println("<script>alert("+ errorstring +");history.back();</script>");
return;
}
if( isadd ){
requestht.put("注册日期",(new simpledateformat("yyyy-mm-dd hh:mm:ss.sss")).format(new java.util.date()) );
}
//
out.println( "<!-- 1658: " + nt.todb( requestht ) + " -->" );
//
if( isdelete )
response.sendredirect( request.getrequesturi() );
%>
<html>
<head>
<title>闵行办公自动化bbs</title>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../css/mhs.css" type="text/css">
</head>
<body bgcolor="#ffffff" text="#000000">
<table width="778" border="0" cellspacing="1" cellpadding="0" bgcolor="#345487" align="center">
<tr>
<td><img src="/edu/uploadpic/2008-2/2008229133939939.gif" width="776" height="59"></td>
</tr>
</table>
<table width="778" border="0" cellspacing="1" cellpadding="0" bgcolor="#345487" align="center">
<tr>
<td bgcolor="#eef2f7" height="20">
<p align="right"><img
title=search
src="/edu/uploadpic/2008-2/2008229133940706.gif"
align=absmiddle border=0 name=search width="15" height="15"> <a href="register.jsp(sun企业级应用的首选)">注册</a>