using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void LoginBtn_Click(object sender, EventArgs e)
{
if (LoginID.Text.Trim() == string.Empty)
{
Response.Write("");
return;
}
if (LoginPwd.Text!= "123456")
{
Response.Write("");
return;
}
if (!IfLonined())
{
Response.Write("");
return;
}
Session["username"] = LoginID.Text;
if (Application["user"] == null)
{
Application["user"] = Session["username"];
}
else {
Application["user"] += "," + Session["username"];
}
Response.Redirect("send.aspx");
}
protected bool IfLonined()
{
Application.Lock();
string users;
string[]user;
if (Application["user"]!=null)
{
users = Application["user"].ToString();
user = users.Split(',');
foreach(string s in user)
{
if(s==LoginID.Text.Trim().ToString())
{
return false;
}
}
}
Application.UnLock();
return true;
}
protected void LoginPWD_TextChanged(object sender, EventArgs e)
{
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class Register : System.Web.UI.Page
{
protected ArrayList ItemList = new ArrayList();
protected void Page_Load(object sender, EventArgs e)
{
Response.AddHeader("Refresh", "1");
Application.Lock();
string users;
string[] user;
if (Application["user"]!=null)
{
users = Application["user"].ToString();
user = users.Split(',');
for(int i=user.Length-1;i>=0;i--)
{
ItemList.Add(user[i].ToString());
}
UserList.DataSource = ItemList;
UserList.DataBind();
}
Application.UnLock();
}
protected void UserList_SelectedIndexChanged(object sender, EventArgs e)
{
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class send : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["username"] != null)
{
Username.Text = Session["username"].ToString() + "说:";
}
else
{
Response.Redirect("login.aspx");
}
}
protected void SendBtn_Click(object sender, EventArgs e)
{
string message;
message = "" + Session["username"].ToString() + "说:";
message += Message.Text;
message += "(" + DateTime.Now.ToString() + ")";
message += "
";
Application.Lock();
if (chk.Checked)
Application["chatcontent"] = (string)Application["chatcontent"] + message + "" + "";
else
Application["chatcontent"] = (string)Application["chatcontent"] + message;
Application.UnLock();
Message.Text = null;
}
protected void LoginBtn_Click(object sender, EventArgs e)
{
Response.Redirect("login.aspx");
}
protected void LoginOutBtn_Click(object sender, EventArgs e)
{
Application.Lock();
if (Application["user"] != null)
{
string users;
string[] user;
users = Application["user"].ToString();
Application["user"] = null;
user = users.Split(',');
foreach (string s in user)
{
if (s != Session["username"].ToString())
{
if (Application["user"] == null)
{
Application["user"] = s;
}
else
{
Application["uesr"] = Application["user"] + "," + s;
}
}
}
}
if (Session["username"] != null)
{
Session["username"] = null;
}
Application.UnLock();
Response.Redirect("login.aspx");
}
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
}
}