📄 xcreg.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<jsp:useBean id="dbc" scope="session" class="net.dmresearch.util.DBConnection" />
<jsp:useBean id="charset" scope="session" class="net.dmresearch.util.Charset" />
<jsp:useBean id="dateformat" scope="session" class="net.dmresearch.util.Dateformat" />
<%
String username = request.getParameter("username");
String user = request.getParameter("user");
String pwd1 = request.getParameter("pwd1");
String pwd2 = request.getParameter("pwd2");
String tel = request.getParameter("tel");
String id ="",cid="";
dbc.getConnection();
String sql="";
if((dbc.getCount("select count(*) from users where user='"+user+"'")>0)||(dbc.getCount("select count(*) from custs where cuser='"+user+"'")>0)){
dbc.close();
out.println("用户帐号已经存在!");
}
else{
sql = "insert into custs(cname,cuser,cpwd,check,tel,pubtime) values('"+username+"','"+user+"','"+pwd1+"','0','"+tel+"','"+dateformat.getStringDate()+"')";
dbc.update(charset.ISO_2_GBK(sql));
out.println(sql+"<br>");
dbc.close();
dbc.getConnection();
sql = "select cid from custs where cuser='"+user+"'";
cid= dbc.getSpecialValue(sql);
out.println(sql+"<br>");
sql = "insert into users(username,user,password,part,tel,cid,check) values('"+username+"','"+user+"','"+pwd1+"','0','"+tel+"','"+cid+"','1')";
out.println(sql+"<br>");
dbc.update(charset.ISO_2_GBK(sql));
dbc.close();
dbc.getConnection();
sql = "select id from users where user='"+user+"'";
id= dbc.getSpecialValue(sql);
out.println(sql+"<br>");
/**
* 系统默认给客户注册的对应帐号赋予客户管理员的角色 == beign
*/
String programname="",modelname="";
dbc.getConnection();
sql = "select id,programname,modelname from actors where actorid='2'";//actorname='"+actorname+"'"
ResultSet rs = dbc.getRS(sql);
int errortag=0;
while(rs.next()){
modelname = charset.ISO_2_GBK(rs.getString(3));
programname = charset.ISO_2_GBK(rs.getString(2));
if(dbc.getCount("select count(*) from userauth where programname='"+programname+"' and user='"+username+"'")>0){
//已经存在该权限
continue;
}
else{
dbc.update(charset.GBK_2_ISO("insert into userauth(user,modelname,programname,authid,grantbyuser) values('"+user+"','"+modelname+"','"+programname+"','"+rs.getString(1)+"','admin')"));
}
out.println("<br>errortag= "+errortag);
}
rs = null;
dbc.close();
/**
* 系统默认给客户注册的对应帐号赋予客户管理员的角色 == end
*/
//part=0 表示超级管理员
session.setAttribute("part","0");
session.setAttribute("cid",cid);
session.setAttribute("user",user);
session.setAttribute("id",id);
session.setAttribute("username",username);
response.sendRedirect("../done.jsp");
}
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -