主题:菜鸟的不明!
<%!String User_Name,User_Password1,User_Password2,User_Email,User_Sex,User_Address,User_Year,
User_Month,User_Day,User_Birthday,User_QQ,sql;%>
<%!Connection con;%>
<%!Statement st;%>
<%!ResultSet rs;%>
<%
User_Name=request.getParameter("username");//获取指定空间的值
User_Name=new String(User_Name.getBytes("ISO-8859-1"));//中文显示
User_Password1=request.getParameter("password1");
User_Password2=request.getParameter("password2");
User_Sex=request.getParameter("sex");
User_Sex=new String(User_Sex.getBytes("ISO-8859-1"));
User_Email=request.getParameter("email");
User_Address=request.getParameter("address");
User_Address=new String(User_Address.getBytes("ISO-8859-1"));
User_Year=request.getParameter("year");
User_Month=request.getParameter("month");
User_Day=request.getParameter("day");
User_QQ=request.getParameter("qq");
if((User_Name.indexOf("")>0)||(User_Name.indexOf("@")>0)||
(User_Name.indexOf("=")>0)||(User_Name.indexOf("%")>0)){//检查是否含有非法字符
response.sendRedirect("err.jsp");
return;
}
if((User_Password1.length()<6)||(User_Password1.length()>12)){//检验密码长度
response.sendRedirect("err.jsp");
return;
}
if(!User_Password1.equals(User_Password2)){//检验密码是否相等
response.sendRedirect("err.jsp");
return;
}
if(User_Email.equals("")){//检验邮箱是否为空
response.sendRedirect("err.jsp");
return;
}
if(!User_Year.equals("")){//获取生日
if((User_Month.equals(""))&&(User_Day.equals("")))
User_Birthday=User_Year+"年"+User_Month+"月"+User_Day+"日";
}
else
if((User_Month.equals(""))&&(User_Day.equals("")))
User_Birthday="秘密";
else{
User_Birthday=User_Month+"月"+User_Day+"日";
}
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:BBS","","");
st=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
sql="select * from user1 where name='"+User_Name+"'";
st.executeQuery(sql);
//rs.first();
if(rs.getRow()>0){
response.sendRedirect("err.jsp");}
else{
sql="insert into user1(name,password,sex,email,address,birthday,qq,rank,fwcs,ftcs) values('"+User_Name+"','"+User_Password1+"','"+User_Sex+"','"+User_Email+"','"+User_Address+"','"+User_Birthday+"','"+User_QQ+"','新手上路',1,0)";
st.executeUpdate(sql);
session.putValue("username",User_Name);
session.putValue("userrank","新手上路");
out.println("<font size=3 color=red>正在处理信息,请稍后......</font><metahttp-equiv='refresh'content='2;url=index.jsp'>");}
st.close();
con.close();
response.sendRedirect("index.jsp");
%>
上面程序的错误,不知道怎么改~
请高手指点
群21605458欢迎您的家加入!~[em1]
User_Month,User_Day,User_Birthday,User_QQ,sql;%>
<%!Connection con;%>
<%!Statement st;%>
<%!ResultSet rs;%>
<%
User_Name=request.getParameter("username");//获取指定空间的值
User_Name=new String(User_Name.getBytes("ISO-8859-1"));//中文显示
User_Password1=request.getParameter("password1");
User_Password2=request.getParameter("password2");
User_Sex=request.getParameter("sex");
User_Sex=new String(User_Sex.getBytes("ISO-8859-1"));
User_Email=request.getParameter("email");
User_Address=request.getParameter("address");
User_Address=new String(User_Address.getBytes("ISO-8859-1"));
User_Year=request.getParameter("year");
User_Month=request.getParameter("month");
User_Day=request.getParameter("day");
User_QQ=request.getParameter("qq");
if((User_Name.indexOf("")>0)||(User_Name.indexOf("@")>0)||
(User_Name.indexOf("=")>0)||(User_Name.indexOf("%")>0)){//检查是否含有非法字符
response.sendRedirect("err.jsp");
return;
}
if((User_Password1.length()<6)||(User_Password1.length()>12)){//检验密码长度
response.sendRedirect("err.jsp");
return;
}
if(!User_Password1.equals(User_Password2)){//检验密码是否相等
response.sendRedirect("err.jsp");
return;
}
if(User_Email.equals("")){//检验邮箱是否为空
response.sendRedirect("err.jsp");
return;
}
if(!User_Year.equals("")){//获取生日
if((User_Month.equals(""))&&(User_Day.equals("")))
User_Birthday=User_Year+"年"+User_Month+"月"+User_Day+"日";
}
else
if((User_Month.equals(""))&&(User_Day.equals("")))
User_Birthday="秘密";
else{
User_Birthday=User_Month+"月"+User_Day+"日";
}
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:BBS","","");
st=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
sql="select * from user1 where name='"+User_Name+"'";
st.executeQuery(sql);
//rs.first();
if(rs.getRow()>0){
response.sendRedirect("err.jsp");}
else{
sql="insert into user1(name,password,sex,email,address,birthday,qq,rank,fwcs,ftcs) values('"+User_Name+"','"+User_Password1+"','"+User_Sex+"','"+User_Email+"','"+User_Address+"','"+User_Birthday+"','"+User_QQ+"','新手上路',1,0)";
st.executeUpdate(sql);
session.putValue("username",User_Name);
session.putValue("userrank","新手上路");
out.println("<font size=3 color=red>正在处理信息,请稍后......</font><metahttp-equiv='refresh'content='2;url=index.jsp'>");}
st.close();
con.close();
response.sendRedirect("index.jsp");
%>
上面程序的错误,不知道怎么改~
请高手指点
群21605458欢迎您的家加入!~[em1]