Google Web

8 abr. 2010

Chatty

No recuerdo quien me pidio el codigo original de Chatty, el cual no es muy cool. Pero aqui esta:


<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Text" %>

String [] arr1;
private void Page_Load(object sender, System.EventArgs e)
{
NameValueCollection coll=Request.QueryString;
arr1 = coll.AllKeys;
if(arr1.Length.ToString() == "2")
{

SaveData();
}
else
{
WriteXML();
}


}

private void WriteXML()
{
SqlConnection sqlCon = new SqlConnection(@"User ID=devil_admin;");
StringBuilder sb = new StringBuilder();
DateTime hoy = DateTime.Now;
DataSet ds = new DataSet();
int i=0;

string [,] cad = new string [,]{
{":D",""},
{":(",""},
{":)",""},
{"fuck",""},
{":S",""},
{"<",""}, {">",""}
};
Response.ContentType = "text/xml";
Response.ContentEncoding = Encoding.UTF8;
sb.Append("(html)(META HTTP-EQUIV='CACHE-CONTROL' CONTENT='NO-CACHE' /)(body)");
try
{
string sqlcmd = "SELECT TOP 25 * FROM Chat ORDER BY ID Desc";
SqlDataAdapter sqlad = new SqlDataAdapter(sqlcmd, sqlCon);
sqlad.Fill(ds, "Datame");
DataTable dt = ds.Tables["Datame"];
foreach (DataRow dr in dt.Rows)
{
string comment = dr["comment"].ToString().Trim();
for (i=0;i20 || s.Length < 2) return; if (arr1[1].Length >150 || arr1[1].Length < 2) return; if(s.IndexOf("crow") >= 0)
s = "dev-crw";
if(s.IndexOf("babuchas") >= 0)
s = "dev-dth";
if(s.IndexOf("dev-pig") >= 0)
s = "faker";
if(s.IndexOf("devpig") >= 0)
s = "faker";
if(s == "dev-chatty")
s = "dev-pig";
if(s.IndexOf("dev-rat") >= 0)
s = "lammer";
if(s.IndexOf("iunk")>=0)
s = "dev-rat";
Response.Write(s);
sqlCon.Open();
string sqlcmd = "SELECT TOP 1 * FROM Chat ORDER BY ID Desc";
SqlCommand sqlcom1 = new SqlCommand(sqlcmd, sqlCon);
SqlDataReader sqlrd = sqlcom1.ExecuteReader();

while(sqlrd.Read())
{
if(sqlrd.GetString(1).Trim() == s)
if(sqlrd.GetString(2).Trim() == arr1[1])
return;
}
sqlrd.Close();

sqlcmd = "INSERT INTO Chat ([user], comment, ticks) values ('" + s + "', '" + arr1[1] + "', '" + hoy.ToString() + "')";
SqlCommand sqlcom = new SqlCommand(sqlcmd, sqlCon);

sqlcom.ExecuteNonQuery();
sqlCon.Close();
}




Alguién recuerda lo de faker? Jajajaja era tan simple.