📄 reg.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace PSP
{
/// <summary>
/// Summary description for reg.
/// </summary>
public class reg : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Panel pnlRegister;
protected System.Web.UI.WebControls.Label lblMsg;
protected System.Web.UI.WebControls.Button btRegister;
protected System.Web.UI.WebControls.CheckBox chkGetUpdate;
protected System.Web.UI.WebControls.CheckBox chkAgreement;
protected System.Web.UI.WebControls.TextBox txtEmail;
protected System.Web.UI.WebControls.TextBox txtScreenName;
protected System.Web.UI.WebControls.TextBox txtPass;
protected System.Web.UI.WebControls.TextBox txtQuickName;
protected System.Web.UI.WebControls.RegularExpressionValidator RegularExpressionValidator1;
string _userID;
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btRegister.Click += new System.EventHandler(this.btRegister_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void btRegister_Click(object sender, System.EventArgs e)
{
this.lblMsg.Visible = true;
this.lblMsg.Text = "";
if(this.chkAgreement.Checked == false)
{
this.lblMsg.Text = "您必须同意服务条款来使用Podlook服务";
return;
}
this.txtEmail.Text = this.txtEmail.Text.Trim();
if(this.txtQuickName.Text.Length == 0 || this.txtQuickName.Text.Length >20)
{
this.lblMsg.Text = "请检查用户名";
return;
}
if(this.txtEmail.Text.Length == 0 || this.txtEmail.Text.Length >20)
{
this.lblMsg.Text = "请检查Email";
return;
}
this._userID = Framework.AddUser(CMS.HandleString(this.txtEmail.Text), CMS.HandleString(this.txtPass.Text),
CMS.HandleString(this.txtScreenName.Text), Page.Request.UserHostAddress, this.chkGetUpdate.Checked,
CMS.HandleString(this.txtQuickName.Text) );
if(this._userID == "-1")
{
this.lblMsg.Text = "此Email已被使用,请换用一个,谢谢";
return;
}
if(this._userID == "-2")
{
this.lblMsg.Text = "此用户名已被使用,请换用一个,谢谢";
return;
}
if(this._userID == "-3")
{
this.lblMsg.Text = "此显示别名已被使用,请换用一个,谢谢";
return;
}
if(_userID != null & _userID != "-1")
{
//Remove Cookie
HttpCookie aCookie;
int limit = Request.Cookies.Count - 1;
for (int i = 0; i <= limit; i++)
{
aCookie = Request.Cookies[i];
aCookie.Expires = DateTime.Now.AddDays(-1);
Response.Cookies.Add(aCookie);
}
//Set Cookie
HttpCookie cookie = new HttpCookie("PSP_UserID");
cookie.Value = _userID.ToString() ;
cookie.Expires = DateTime.Now.AddDays(2000);
Response.Cookies.Add(cookie);
HttpCookie cookie2 = new HttpCookie("PSP_UserName");
cookie2.Value = this.txtQuickName.Text;
cookie2.Expires = DateTime.Now.AddDays(2000);
Response.Cookies.Add(cookie2);
}
this.txtPass.Enabled = false;
this.txtEmail.Enabled = false;
this.txtScreenName.Enabled = false;
this.txtQuickName.Enabled = false;
this.btRegister.Visible = false;
this.lblMsg.Text = "恭喜你,注册成功啦! <a href='default.aspx'>回到主页</a>";
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -