📄 webicq.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace xajh.chat
{
/// <summary>
/// webicq 的摘要说明。
/// </summary>
public class webicq : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Literal byts_errormsg;
protected System.Web.UI.WebControls.TextBox callword;
protected System.Web.UI.WebControls.Button byts_submit;
protected System.Web.UI.WebControls.TextBox callname;
private x.UserInfo info;
private void Page_Load(object sender, System.EventArgs e)
{
if (this.Session["info"] == null)
{
this.Server.Transfer ("../error.aspx?v=relogin");
}
info = (x.UserInfo) this.Session["info"];
if (info.RoomID == "false")
{
this.Server.Transfer ("../error.aspx?v=outchat");
}
if (!this.Page.IsPostBack)
{
this.callname.Text = this.Request.QueryString["name"];
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.byts_submit.Click += new System.EventHandler(this.byts_submit_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void byts_submit_Click(object sender, System.EventArgs e)
{
string call_name = callname.Text.Trim();
string call_word = callword.Text.Trim();
if (call_name == info.UserName)
{
this.byts_errormsg.Text = "不能呼叫自己!";
return;
}
if (call_word == "" || call_word == null)
{
this.byts_errormsg.Text = "请指定呼叫内容!";
return;
}
x.CheckUse useinfo = var.public_webicq;
if (useinfo.MinGrade != -1 && info.Grade < useinfo.MinGrade)
{
this.Response.Write ("<script language=javascript type=text/javascript>alert('等级小于 " + useinfo.MinGrade + " 不能呼叫!')</script>");
return;
}
if (useinfo.MaxGrade != -1 && info.Grade > useinfo.MaxGrade)
{
this.Response.Write ("<script language=javascript type=text/javascript>alert('等级大于 " + useinfo.MaxGrade + " 不能呼叫!')</script>");
return;
}
if (useinfo.MinFGrade != -1 && info.FGrade < useinfo.MinFGrade)
{
this.Response.Write ("<script language=javascript type=text/javascript>alert('战斗等级小于 " + useinfo.MinFGrade + " 不能呼叫!')</script>");
return;
}
if (useinfo.MaxFGrade != -1 && info.FGrade > useinfo.MaxFGrade)
{
this.Response.Write ("<script language=javascript type=text/javascript>alert('战斗等级大于 " + useinfo.MaxFGrade + " 不能呼叫!')</script>");
return;
}
if (useinfo.MinGGrade != -1 && info.Gold < useinfo.MinGGrade)
{
this.Response.Write ("<script language=javascript type=text/javascript>alert('会员等级小于 " + useinfo.MinGGrade + " 不能呼叫!')</script>");
return;
}
if (useinfo.MaxGGrade != -1 && info.Gold > useinfo.MaxGGrade)
{
this.Response.Write ("<script language=javascript type=text/javascript>alert('会员等级大于 " + useinfo.MaxGGrade + " 不能呼叫!')</script>");
return;
}
if (useinfo.CheckSex == "boy" && info.Sex != "boy")
{
this.Response.Write ("<script language=javascript type=text/javascript>alert('性别必须为 男 才能呼叫!')</script>");
return;
}
if (useinfo.CheckSex == "girl" && info.Sex != "girl")
{
this.Response.Write ("<script language=javascript type=text/javascript>alert('性别必须为 女 才能呼叫!')</script>");
return;
}
if (useinfo.CheckIn != "(无)" || useinfo.sql != "")
{
string sql = @"select [点券],[银两],[存款],[武功],[智力],[内力],[体力],[攻击],[防御],[生命],[魅力],[精确] from [注册用户] where [id]=" + info.DataID;
if (useinfo.CheckIn != "(无)")
{
sql += " and " + useinfo.CheckIn;
}
OleDbConnection MyConn = new OleDbConnection(var.public_conn);
MyConn.Open();
OleDbCommand MyComm = new OleDbCommand(sql, MyConn);
OleDbDataReader dr = MyComm.ExecuteReader();
if (dr.Read())
{
for (int i = 0; i < 3; i ++)
{
if (useinfo.Run_Name[i] != "(无)")
{
if ((int)dr[useinfo.Run_Name[i]] < useinfo.Run_Value[i])
{
dr.Close();
MyConn.Close();
MyConn.Dispose();
this.Response.Write ("<script language=javascript type=text/javascript>alert('使用呼叫要耗费" + useinfo.Run_Name[i] + " " + useinfo.Run_Value[i] + ",而你的" + useinfo.Run_Name[i] + "不够!')</script>");
return;
}
}
}
if (useinfo.sql != "")
{
dr.Close();
MyComm.CommandText = @"update [注册用户] set " + useinfo.sql.Substring(0, useinfo.sql.Length - 1) + " where [id]=" + info.DataID;
MyComm.ExecuteNonQuery();
MyConn.Close();
MyConn.Dispose();
}
else
{
dr.Close();
MyConn.Close();
MyConn.Dispose();
}
}
else
{
dr.Close();
MyConn.Close();
MyConn.Dispose();
this.Response.Write ("<script language=javascript type=text/javascript>alert(\"必须符合 " + useinfo.CheckIn + " 才能呼叫!\")</script>");
return;
}
}
string toroom = "";
ArrayList roomlist = var.public_roomlist;
for (int i = 0; i < roomlist.Count; i ++)
{
if (((ArrayList) this.Application["byts_xajh_chat_online_" + roomlist[i]]).IndexOf(call_name) != -1)
{
toroom = roomlist[i].ToString();
break;
}
}
if (toroom == "")
{
this.byts_errormsg.Text = "该聊友不在聊天室内,不能呼叫!";
return;
}
call_word = this.Server.HtmlEncode(call_word).Replace("\r", "$br;").Replace("\n", "").Replace("\\", "\\\\").Replace("/", "\\/").Replace("\"", "\\\"");
string[] aword = new string[9];
aword[0] = "only";
aword[1] = info.UserName;
aword[2] = call_name;
aword[3] = "";
aword[4] = "";
aword[5] = "";
aword[6] = call_word;
aword[7] = "webicq";
aword[8] = DateTime.Now.ToLongTimeString();
this.Application.Lock();
ArrayList words = (ArrayList) this.Application["byts_xajh_chat_words_" + toroom];
words.Add(aword);
words.RemoveAt(0);
this.Application["byts_xajh_chat_line_" + toroom] = (int) this.Application["byts_xajh_chat_line_" + toroom] + 1;
this.Application.UnLock();
this.callname.BackColor = System.Drawing.Color.FromName("#DCD8D0");
this.callname.Enabled = false;
this.callword.BackColor = System.Drawing.Color.FromName("#DCD8D0");
this.callword.Enabled = false;
this.byts_errormsg.Text = "^呼叫信息已经成功发送!";
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -