⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 newuser.asp

📁 1 除掉了 时间 限制 2 除掉了 人数 限制 改为 500人 原为5人 3 发现一点小缺陷 增加人员的时候没有判断 登陆名是否重复! 自己写吧~~~:) 4 又 是一点缺陷
💻 ASP
字号:
<!--#include file="../config.ini" -->
<!--#include file="../commfunction.inc" -->
<%

if request("id")<>"" then
	dim connq
	dim rsq
	set connq=server.CreateObject("adodb.connection")
	set rsq=server.CreateObject("adodb.recordset")
	connq.Open connstring
	rsq.Open "select * from usertable where id="&request("id"),connq,2,3,1
	strloginid=rsq("loginid")
	strusername=rsq("username")
	strpassword=rsq("password")
	strtitle=rsq("title")
	strphone=rsq("phone")
	stremail=rsq("email")
	strTerritory=rsq("Territory")
	strbranch=rsq("branchid")
	strdepartment=rsq("departmentid")
	strmaxdiscount=rsq("maxdiscount")
	stradmin=rsq("admin")
	strpaymentterm=rsq("paymentterm")
	strdescription=rsq("description")
	rsq.Close
	set rsq=nothing
	connq.Close
	set connq=nothing
else
	strmaxdiscount=0
end if

if request("username")<>"" then
	dim conn
	dim rs
	set conn=server.CreateObject("adodb.connection")
	set rs=server.CreateObject("adodb.recordset")
	conn.Open connstring
	if request("id")="" then
		rs.Open "select * from usertable",conn,2,3,1
		rs.AddNew 
		rs("loginid")=request("loginid")
		rs("logintimes")=0
	else
		rs.Open "select * from usertable where id="&request("id"),conn,2,3,1
	end if
	

	rs("username")=request("username")
	rs("password")=request("password")
	rs("title")=request("title")
	rs("phone")=request("phone")
	rs("email")=request("email")
	rs("Territory")=request("Territory")
	rs("branchid")=request("branch")
	rs("departmentid")=request("department")
	if request("maxdiscount")="" then
		rs("maxdiscount")=0
	else
		rs("maxdiscount")=request("maxdiscount")
	end if
	rs("paymentterm")=request("paymentterm")
	rs("description")=request("description")
	if request("admin")=1 then
		rs("admin")=1
	else
		rs("admin")=0
	end if

	rs.Update 
	rs.Close 
	set rs=nothing
	if request("id")="" then
		set rsmenu=conn.execute("select id from leftmenu")
		do while not rsmenu.eof
			
			'response.write "insert into closedmenu(menuid,userid,closedby,disable,read,edit,add,del)values("&rsq("id")&",'"&request("loginid")&"','sa',0,1,0,0,0)"
			'response.end
			conn.execute("insert into closedmenu(menuid,userid,closedby,disable,[read],edit,[add],del)values("&rsmenu("id")&",'"&request("loginid")&"','sa',0,1,0,0,0)")
		rsmenu.movenext
		loop
			
	end if
	conn.Close 
	set conn=nothing
%>
<script language=javascript>
	window.opener.location.reload();
	window.close();
</script>
<%
end if
%>
<HTML><HEAD><TITLE>用户</TITLE>
<LINK href="../global.css" rel=STYLESHEET type=text/css>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<body>
<script language="javascript">
function save(){
	if (form1.loginid.value==''){
		alert('请输入登录名');
		form1.loginid.focus();
		return;
	}
	if (form1.password.value==''){
		alert('请输入密码');
		form1.password.focus();
		return;
	}
	if (form1.username.value==''){
		alert('请输入用户名');
		form1.username.focus();
		return;
	}
	if (form1.repeatpassword.value==''){
		alert('请输入重复密码');
		form1.repeatpassword.focus();
		return;
	}
	if (form1.password.value!=form1.repeatpassword.value){
		alert('两次密码不一样');
		form1.repeatpassword.focus();
		return;
	}
	form1.submit();
}
</script>
 <form name=form1  method="post"  id=form1>
    <table width="100%" height="20" border="0" cellpadding="0" cellspacing="0">
   <tr> 
    <td height="25"><strong><font size="2" class=title><b><%if request("id")="" then%>新建用户<%else%>编辑用户<%end if%></b></font></strong></td>
      <td>&nbsp;</td>
    </tr>
    <tr > 
      <td height="16" colspan="2" background="../images/title.gif">&nbsp;</td>
    </tr>
    <tr>
      <td height=4></td>
    </tr>
	<tr><td>
	<div align="center" style="cursor:hand"><a onclick="save();"><img src="../images/button_save.gif" style="cursor:hand"></a>&nbsp;&nbsp;&nbsp;&nbsp;<a onclick="window.close();"><img src="../images/button_cancel.gif"  style="cursor:hand"></a> 
    </div></td>
    </tr>
 </table>

  <table width="100%" align="center" cellspacing="1" bgcolor="#FFFFFF">
    <tr bgcolor="white"> 
      <td width="15%" bgcolor="DEDFDE"><div align="center"><font color="#FF0000">* 
          </font>登录名</div></td>
      <td width="35%" bgcolor="EFEFEF"> 
        <%if request("id")<>"" then%>
        <%=strloginid%> 
        <input name=loginid type=hidden value="<%=strloginid%>" size="14">
        <%else%>
        <input name=loginid type=text value="<%=strloginid%>" size="14"> 
        <%end if%>
      </td>
      <td width="15%" bgcolor="DEDFDE"><div align="center"><font color="#FF0000">* 
          </font>密码</div></td>
      <td width="35%" bgcolor="EFEFEF"> <input name=password type=password value="<%=strpassword%>" size="14"></td>
    </tr>
    <tr  bgcolor="white"> 
      <td width="15%" nowrap bgcolor="DEDFDE"><div align="center"><font color="#FF0000">* 
          </font>用户姓名</div></td>
      <td width="35%" bgcolor="EFEFEF"> <input name=username type=text value="<%=strusername%>" size="14"></td>
      <td width="15%" bgcolor="DEDFDE"><div align="center"><font color="#FF0000">* 
          </font>重复密码</div></td>
      <td width="35%" bgcolor="EFEFEF"> <input name=repeatpassword type=password value="<%=strpassword%>" size="14"></td>
    </tr>
    <tr  bgcolor="white"> 
      <td width="15%" bgcolor="DEDFDE" ><div align="center">职务</div></td>
      <td width="35%" bgcolor="EFEFEF"> <input name=title type=text value="<%=strtitle%>" size="14"></td>
      <td width="15%" bgcolor="DEDFDE"><div align="center">电话</div></td>
      <td width="35%" bgcolor="EFEFEF"> <input name=phone type=text value="<%=strphone%>" size="14"></td>
    </tr>
    <tr  bgcolor="white"> 
      <td width="15%" bgcolor="DEDFDE" ><div align="center">电子邮件</div></td>
      <td width="35%" bgcolor="EFEFEF"> <input name=email type=text value="<%=stremail%>" size="14"></td>
      <td width="15%" bgcolor="DEDFDE"><div align="center">区域</div></td>
      <td width="35%" bgcolor="EFEFEF"> <select name=Territory>
          <option value=-1></option>
          <%getdefine "区域",strTerritory%>
        </select> </td>
    </tr>
    <tr  bgcolor="white"> 
      <td width="15%" height="23" bgcolor="DEDFDE" ><div align="center">办事处</div></td>
      <td width="35%" bgcolor="EFEFEF"> <select name=branch>
          <option value=-1></option>
          <%getdefine "办事处",strbranch%>
        </select> </td>
      <td width="15%" bgcolor="DEDFDE"><div align="center">部门</div></td>
      <td width="35%" bgcolor="EFEFEF"> <select name=department>
          <option value=-1></option>
          <%getdefine "部门",strdepartment%>
        </select> </td>
    </tr>
    <tr  bgcolor="white">
      <td bgcolor="DEDFDE" nowrap><div align="center">允许付款方式</div></td>
      <td bgcolor="EFEFEF"><select name=paymentterm>
          <option value=-1></option>
          <%getdefine "付款方式",strpaymentterm%>
        </select></td>
      <td bgcolor="DEDFDE"><div align="center">最大折扣</div></td>
      <td bgcolor="EFEFEF"><input name=maxdiscount type=text value="<%=strmaxdiscount%>" size="4">
        %</td>
    </tr>
    <tr  bgcolor="white"> 
      <td width="15%" bgcolor="DEDFDE" ><div align="center">管理员</div></td>
      <td width="35%" bgcolor="EFEFEF"> <input type="checkbox" name="admin" value=1 <%if stradmin=true then Response.Write "checked"%>></td>
      <td width="15%" bgcolor="DEDFDE"><div align="center"></div></td>
      <td width="35%" bgcolor="EFEFEF">&nbsp; </td>
    </tr>
    <tr  bgcolor="white"> 
      <td width="15%" bgcolor="DEDFDE" ><div align="center">描述</div></td>
      <td colspan="3" bgcolor="EFEFEF"> <textarea name="description" cols="45" rows="4"><%=strdescription%></textarea> 
      </td>
    </tr>
  </table>
</form>

⌨️ 快捷键说明

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