}
catch (Exception ex)
{
ShowMessage("您的输入有误!,请检查后重新注册!");
}
try
{
//读取指定节点下的value值
string strFlag = Base.XMLProcess.Read("xml/EmailFlag.xml", "/Item/flag/mode[@type='userRegister']", "value");
if (strFlag == "")
strFlag = "us_register";
if (Base.Common.isMail(txtEmail.Text.Trim()))
nspBase.Core.clsEmail.SendMail(strFlag, txtEmail.Text.Trim());
}
catch
{
ShowMessage("邮件发送失败!");
}
Solely.UserRegistr set = Solely.UserRegistr.GateItem();
if (set.ManageRegister) //是否需要审核
{
ShowMessage("注册成功!请等待管理员审核!","../Default.aspx");
}
else
{
try
{
DataSet tableset = RUser.GetDataTable(TUser.LoginName, TUser.Password);
GetRequest.SetCookie("LoginName", tableset.Tables[0].Rows[0]["LoginName"].ToString());
GetRequest.SetCookie("CheckInfo", tableset.Tables[0].Rows[0]["Password"].ToString());
GetRequest.SetCookie("UserID", tableset.Tables[0].Rows[0]["UserID"].ToString());
GetRequest.SetCookie("GradeID", tableset.Tables[0].Rows[0]["GradeID"].ToString());
GetRequest.SetCookie("CompanyName", tableset.Tables[0].Rows[0]["CompanyName"].ToString());
Response.Redirect("Success.aspx");
}
catch
{
ShowMessage("登陆失败!");
}
} }
catch (Exception ex)
{
ShowMessage("您的输入有误!,请检查后重新注册!");
}
try
{
//读取指定节点下的value值
string strFlag = Base.XMLProcess.Read("xml/EmailFlag.xml", "/Item/flag/mode[@type='userRegister']", "value");
if (strFlag == "")
strFlag = "us_register";
if (Base.Common.isMail(txtEmail.Text.Trim()))
nspBase.Core.clsEmail.SendMail(strFlag, txtEmail.Text.Trim());
}
catch
{
ShowMessage("邮件发送失败!");
}
Solely.UserRegistr set = Solely.UserRegistr.GateItem();
if (set.ManageRegister) //是否需要审核
{
ShowMessage("注册成功!请等待管理员审核!","../Default.aspx");
}
else
{
try
{
DataSet tableset = RUser.GetDataTable(TUser.LoginName, TUser.Password);
GetRequest.SetCookie("LoginName", tableset.Tables[0].Rows[0]["LoginName"].ToString());
GetRequest.SetCookie("CheckInfo", tableset.Tables[0].Rows[0]["Password"].ToString());
GetRequest.SetCookie("UserID", tableset.Tables[0].Rows[0]["UserID"].ToString());
GetRequest.SetCookie("GradeID", tableset.Tables[0].Rows[0]["GradeID"].ToString());
GetRequest.SetCookie("CompanyName", tableset.Tables[0].Rows[0]["CompanyName"].ToString());
Response.Redirect("Success.aspx");
}
catch
{
ShowMessage("登陆失败!");
}
} }
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnCancel_Click(object sender, EventArgs e)
{
Response.Redirect("~/member/Index.aspx");
}
}
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using UserInfo;
using Product;
using Base;
public partial class _register : BasePage
{
protected void Page_Load(object sender, EventArgs e)
{
if (CheckCookies())
{
Response.Redirect("../Error.aspx?err=1");
return;
}
if (!IsPostBack)
{
if (bind())
{
IndustryBind();
isShow();
}
this.bt.Text = Common.GetBottom(bt.Text);
this.dl.Text = Base.Common.GetBottom(this.dl.Text);
}
} private void isShow()
{
Solely.UserRegistr set = Solely.UserRegistr.GateItem(); //是否启用验证码
if (set.isCode)
{
this.trCode.Visible = true;
this.ViewState["isCode"] = "1";
}
else
{
this.trCode.Visible = false;
this.ViewState["isCode"] = "0";
}
//是否启用验证问题
if (set.isQuestion)
{
this.ViewState["isQuestion"] = "1";
string[] strQuestrion;
string[] strAnswer;
if (set.Question.Contains("!"))
{ strQuestrion = set.Question.Split('!'); //分解问题存入数组
strAnswer = set.Answer.Split('!');
Random randObj = new Random();
int intRandom = randObj.Next(0, 50);
this.divAnswer.InnerText = strQuestrion[intRandom % strQuestrion.Length] + " " + strAnswer[intRandom % strQuestrion.Length];
this.ViewState["Answer"] = strAnswer[intRandom % strQuestrion.Length];
}
else
{
this.divAnswer.InnerText = set.Question + " ? " + set.Answer;
this.ViewState["Answer"] = set.Answer;
return;
}
}
else
{
this.ViewState["isQuestion"] = "0";
this.trQuestion.Visible = false;
}
} private bool bind()
{
try
{
string IP = Base.GetRequest.GetIP();
int outReturn = 0;
int intIP = Solely.UserRegistr.CheckIP(IP);
Solely.UserRegistr set = Solely.UserRegistr.GateItem();
this.ViewState["intGradeID"] = set.VipGrade;
if (!set.isRegister) //是否允许注册
{
Response.Redirect("../Error.aspx?err=0");
return false;
}
else
{
if (outReturn == -1) //IP是否允许注册
{
ShowMessage("您的IP在此段时间已经注册过请过会儿在注册", Config.WebURL);
return false;
}
else
{
ViewState.Add("BannedUser", set.BannedUser);
ViewState.Add("BreakTime", set.MinTimeRegister);
ViewState.Add("Minimum", set.Minimum);
ViewState.Add("Longest", set.Longest);
this.HidminName.Value = set.Minimum.ToString();
this.HidmaxName.Value = set.Longest.ToString(); if (set.OnlyUser_Email) //是否一个Email只能注册一个帐号
{
this.hidEmail.Value = "1";
}
return true;
}
}
}
catch (Exception e)
{
ShowMessage(e.Message);
}
return true;
} /// <summary>
/// 所属行业
/// </summary>
private void IndustryBind()
{
IIndustryType II = new RIndustryType();
DataTable db = II.GetDataTable(0);
dropIndustry.DataSource = db.DefaultView;
dropIndustry.DataTextField = "Type";
dropIndustry.DataValueField = "ID";
dropIndustry.DataBind(); } /// <summary>
/// 注册信息提交
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnServer_Click(object sender, EventArgs e)
{
string msgText = "";
string code = this.yangzheng.Text;
string testString = this.txtLoginName.Text;
//验证码
if (this.ViewState["isCode"].ToString() == "1")
{
if (!CheckCode(code)) //验证码检测
{
ShowMessage("验证码错误!");
return;
}
} //验证答案
if (this.ViewState["isQuestion"].ToString() == "1")
{
if (!this.txtQuestion.Text.Equals(this.ViewState["Answer"].ToString()))
{
ShowMessage("验证问题不正确!");
return;
}
}
int min = 4;
int max = 12;
min = int.Parse(this.ViewState["Minimum"].ToString());
max = int.Parse(this.ViewState["Longest"].ToString());
if ((testString.Length < min) || (testString.Length > max)) //(Base.Common.IsIncludeChineseCode(this.txtLoginName.Text.Trim()) ||
{
msgText = min + "~" + max + "位之间";
}
if (!this.txtPassword.Text.Trim().Equals(this.txtOldPassword.Text))
{
msgText = msgText + "<br/>两次密码输入不一致";
}
string noUser = "";
noUser = this.ViewState["BannedUser"].ToString();
if (noUser.IndexOf(this.txtLoginName.Text) > 0) //会员名检测
{
ShowMessage("不允许注册的会员名");
return;
}
if (msgText != "")
{
ShowMessage(msgText, Config.WebURL);
}
else
{
SaveUserInfo();
} } /// <summary>
/// 保存会员提交的信息