dealrereg.jsp

来自「机械工业出版社的《jsp2.0动态网站开发实例指南》的源代码」· JSP 代码 · 共 77 行

JSP
77
字号
<!--dealrereg.jsp-->
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="chapter9.logBean"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.util.*"%>
<%!
	public String codeString(String s){
		String str=s;
                try{
			byte b[]=str.getBytes("ISO-8859-1");
			str=new String (b);
			return str;
		}catch(Exception e){return str;}
	}
%>
<html>
<head>
<title>DealRereg!</title>
</head>
<body bgcolor=#C0C0C0>
<jsp:useBean id="log" class="chapter9.logBean" scope="session"/>
<center>
<%
	if(!log.getIslog().equals("true")){
		out.print("您还没有登录!<br><a href='login1.jsp'>登录 </a>");
	}
	else{
		String name,pwd,pwdr,sex,mail,addr,call,intr,oldpwd;
		//get input
		name=request.getParameter("name");
		if(name==null)name="";
		name=codeString(name);
		oldpwd=request.getParameter("oldpwd");
		if(oldpwd==null)oldpwd="";
		oldpwd=codeString(oldpwd);
		pwd=request.getParameter("pwd");
		if(pwd==null)pwd="";
		pwd=codeString(pwd);
		pwdr=request.getParameter("pwdr");
		if(pwdr==null)pwdr="";
		pwdr=codeString(pwdr);
		sex=request.getParameter("sex");
		if(sex==null)sex="";
		sex=codeString(sex);
		mail=request.getParameter("mail");
		if(mail==null)mail="";
		mail=codeString(mail);
		addr=request.getParameter("addr");
		if(addr==null)addr="";
		addr=codeString(addr);
		call=request.getParameter("call");
		if(call==null)call="";
		call=codeString(call);
		intr=request.getParameter("intr");
		if(intr==null)intr="";
		intr=codeString(intr);
		//check input
		if(name.equals("")||oldpwd.equals("")||pwd.equals("")||pwdr.equals("")){
			out.print("<center><font color=#FF0000>输入不能为空!</font><a href='rereg.jsp'>返回 </a></center>");
		}
		else if(!pwd.equals(pwdr)){
			out.print("<center><font color=#FF0000>两次密码不同!</font><br><a href='rereg.jsp'>返回 </a></center>");
		}
		else if(mail.indexOf('@',0)==-1||mail.indexOf('.',0)==-1||mail.length()<6){
			out.println("<center><font color=#FF0000>电邮地址有错!</font><br><a href='rereg.jsp'>返回 </a></center>");
		} 
		else{
			if(log.rereg(name,pwd,sex,mail,addr,call,intr,oldpwd))
				out.print(log.getId()+",恭喜你成功修改注册信息!<br><a href='unlog.jsp'>注销登录 </a><a href='rereg.jsp'>修改信息 </a>");
			else
				out.print(log.getId()+"您输入的密码不正确,不能修改注册信息!</font><br><a href='rereg.jsp'>返回 </a></center>");	
		}
	}
%>
</center>
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?