<!--#include file="sd_mdb.asp"-->
<!--#include file="../sd_md5.asp"-->
<%
if session("User")="" then
	response.write"<SCRIPT language=JavaScript>alert('您尚未登录！');"
	response.write"location.href=""sd_admin_login.asp"";</SCRIPT>"
end if
%>
<%
	if request("act") = "save" then
		act=request.QueryString("act")
		name=request.form("txt_user_name")
		pass=request.form("txt_pass_word")
		pass2=request.form("txt_pass_word_r")
		points=request.form("txt_user_points")
		qq=request.form("txt_user_qq")
		email=request.form("txt_user_email")
		call addsave()
	ELSE
%>
<HTML>
<HEAD>
<TITLE>1</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
<LINK href="images/Admin_css.css" type=text/css rel=stylesheet>
<script language="javascript" src="js/prototype.js"></script>

</HEAD>
<BODY>
<script language="javascript">
<!--

function check_post()
{
	if($F('api_type')=='system_user')
	{
		if($F('txt_user_name')==""){
			$('notice_user_name').innerHTML="<img src='images/check_error.gif' width=13 height=13 align=absmiddle/>&nbsp;<font color='red'>用户名不能为空！</font>";
			Field.focus('txt_user_name');
			return false;
		}
		else{
			$('notice_user_name').innerHTML="<img src='images/check_right.gif' width=13 height=13 align=absmiddle/>";
		}
	}
	if($F('txt_pass_word')==""){
		$('notice_pass_word').innerHTML="<img src='images/check_error.gif' width=13 height=13 align=absmiddle/>&nbsp;<font color='red'>密码不能为空！</font>";
		Field.focus('txt_pass_word');
		return false;
	}
	else{
		$('notice_pass_word').innerHTML="<img src='images/check_right.gif' width=13 height=13 align=absmiddle/>";
	}
	if($F('txt_pass_word').length>12){
		Field.focus('txt_pass_word');
		Field.clear('txt_pass_word');
		$('notice_pass_word').innerHTML="<img src='images/check_error.gif' width=13 height=13 align=absmiddle/>&nbsp;<font color='red'>密码在6-12之间！</font>";
		return false;
	}
	
	if($F('txt_pass_word').length<6){
	
		Field.clear('txt_pass_word');
		$('notice_pass_word').innerHTML="<img src='images/check_error.gif' width=13 height=13 align=absmiddle/>&nbsp;<font color='red'>密码在6-12之间！</font>";
		Field.focus('txt_pass_word');
		
		return false;
	}
	
	$('notice_pass_word').innerHTML="<img src='images/check_right.gif' width=13 height=13 align=absmiddle/>";

	if($F('txt_pass_word')!=$F('txt_pass_word_r')){
		$('notice_pass_word_r').innerHTML="<img src='images/check_error.gif' width=13 height=13 align=absmiddle/>&nbsp;<font color='red'>密码不一致！</font>";
		Field.clear('txt_pass_word_r');
		Field.focus('txt_pass_word_r');
		return false;
	}
	else{
		$('notice_pass_word_r').innerHTML="<img src='images/check_right.gif' width=13 height=13 align=absmiddle/>";
	}
	if($F('txt_user_qq')==""){
		$('notice_user_qq').innerHTML="<img src='images/check_error.gif' width=13 height=13 align=absmiddle/>&nbsp;<font color='red'>QQ号不能为空！</font>";
		Field.focus('txt_user_qq');
		return false;
	}
	else{
		$('notice_user_qq').innerHTML="<img src='images/check_right.gif' width=13 height=13 align=absmiddle/>";
	}
	$("check_info").submit();
}

function checkuser(user_name)
{
	if(user_name==''){
        $('notice_user_name').innerHTML="<img src='images/check_error.gif'/><font color='red'>用户名不能为空！</font>";
        Field.focus('txt_user_name');
    }
}
-->
</script>
<FORM name="form1" action="sd_index_usersadd.asp?act=save" method="post">
<table height="1" border="0" cellpadding="3"  cellspacing="1" bgcolor="#F2F9E8" class="admintable1">
  <tr>
    <td colspan="2" class="admintitle">添加会员</td>
  </tr>
  <tr>
    <td width="20%" height="30" align="right" bgcolor="#FFFFFF">会 员 名：</td>
    <td width="80%" bgcolor="#FFFFFF"><input name="txt_user_name" type="text" id="txt_user_name" size="25" onblur="checkuser(this.value)">&nbsp;<span id="notice_user_name">唯一帐号，4位以上，推荐用Email地址。</span></td>
  </tr>
  <tr>
    <td height="30" align="right" bgcolor="#FFFFFF">会员密码：</td>
    <td bgcolor="#FFFFFF"><input name="txt_pass_word" type="password" id="txt_pass_word">&nbsp;<span id="notice_pass_word">密码在6-12个字符，最好用英文，数字和符号。</span></td>
  </tr>
  <tr>
    <td height="30" align="right" bgcolor="#FFFFFF">确认密码：</td>
    <td bgcolor="#FFFFFF"><input name="txt_pass_word_r" type="password" id="txt_pass_word_r">&nbsp;<span id="notice_pass_word_r"></span></td>
  </tr>
  <tr>
    <td height="30" align="right" bgcolor="#FFFFFF">会 员 币：</td>
    <td bgcolor="#FFFFFF"><input name="txt_user_points" type="text" id="txt_user_points" onKeyUp="value=value.replace(/[^\d.]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d.]/g,''))">&nbsp;必须为数字。</td>
  </tr>
  <tr>
    <td height="30" align="right" bgcolor="#FFFFFF">腾讯Q Q：</td>
    <td bgcolor="#FFFFFF"><input name="txt_user_qq" type="text" id="txt_user_qq" >&nbsp;<span id="notice_user_qq">真实QQ号，方便您与他人交换链接</span></td>
  </tr>
  <tr>
    <td height="30" align="right" bgcolor="#FFFFFF">Email：</td>
    <td bgcolor="#FFFFFF"><input name="txt_user_email" type="text" id="txt_user_email" >&nbsp;<span id="notice_user_email">真实Email，方便您与他人交换链接</span></td>
  </tr>
  <tr>
    <td height="30" align="right" bgcolor="#FFFFFF"></td>
    <td bgcolor="#FFFFFF"><input name="api_type" type="hidden" id="api_type" value="system_user" /><input type="submit" name="Submit" value="确认提交"></td>
  </tr>
</table>
</form>
<%
end if%>
<%sub addsave()
	if name="" or pass="" or pass2="" then
		response.write"<SCRIPT language=JavaScript>alert('用户资料不全！请检查！');"
		response.write"javascript:history.back();</SCRIPT>"
	end if
	if pass<>pass2 then
		response.write"<SCRIPT language=JavaScript>alert('两次密码输入不一致！请检查！');"
		response.write"javascript:history.back();</SCRIPT>"
	end if
	U_Ip=Request.ServerVariables("HTTP_X_FORWARDED_FOR")
	If U_Ip="" Then U_Ip=Request.ServerVariables("REMOTE_ADDR")
	
	set rs=server.createobject("adodb.recordset")
	sql="select * from [sd_user] where sd_user='"&name&"'"
	rs.open sql,conn,1,3
	if rs.bof or rs.eof then
		rs.addnew
		rs("sd_User")=name
		rs("sd_Pass")=md5(pass)
		rs("sd_points")=points
		rs("sd_QQ")=qq
		rs("sd_Email")=email
		rs.update
		rs.close
		set rs=nothing
		response.write"<SCRIPT language=JavaScript>alert('用户名添加成功！');"
		response.write"location='sd_index_usersadd.asp';</SCRIPT>"
	else
		rs.update
		rs.close
		set rs=nothing
		response.write"<SCRIPT language=JavaScript>alert('用户名已经存在！');"
		response.write"javascript:history.back();</SCRIPT>"
	end if
end sub%>
<!--#include file="sd_copy.asp"-->
</BODY>
</HTML>