using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using System.IO;
using System.Xml;
using System.Data;
using System.Net;
using System.Threading;
using System.Data.OleDb;
public partial class admin9h_adduser : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//if (string.IsNullOrEmpty(admins.isadmin()))
//{
// Response.Write("<script>window.parent.location='../login.aspx';</script>");
// Response.End();
//}
if (!IsPostBack)
pagebind();
}
protected void pagebind()
{
}
protected void Button_Click(object sender, EventArgs e)
{
//Response.Write(sendsns("【圣域传奇】最火爆的国战网游今日16时震撼开启。升级领Q币登陆发现金sycq.xkyx.com", "13910687714"));
//Response.End();
string FILE_NAME = Server.MapPath("./") + "tel_sns_" + System.DateTime.Now.ToString("hh_MM_ss") + ".txt";
if (!File.Exists(FILE_NAME))
{
StreamWriter sr = File.CreateText(FILE_NAME);
sr.Close();
}
StreamWriter x = new StreamWriter(FILE_NAME, true, System.Text.Encoding.Default);
x.Write("开始发送");
//Encoding encode = System.Text.Encoding.GetEncoding("gb2312");
//HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create("http://202.85.214.57:30002/shttp.recmt?ua=9hservice&pw=753peach&mobile=18610810873&msg='" + Server.UrlEncode("uuu编码后") + "'");
//myReq.Method = "GET";
//myReq.ContentType = "application/x-www-form-urlencoded";
接收HTTP做出的响应
//WebResponse myResp = myReq.GetResponse();
//Stream ReceiveStream = myResp.GetResponseStream();
//StreamReader readStream = new StreamReader(ReceiveStream, encode);
//Char[] read = new Char[256];
//int count = readStream.Read(read, 0, 256);
//string str = null;
//while (count > 0)
//{
// str += new String(read, 0, count);
// count = readStream.Read(read, 0, 256);
//}
//readStream.Close();
//myResp.Close();
string str = "-1";
string strCon;
strCon = Server.MapPath("./") + "tele.xls";
if (!System.IO.File.Exists(strCon))
{
Response.Write("请检查是否存在xls");
x.Close();
}
else
{
string sql = "";
DataSet rs = ExcelToDS(strCon);
int zol = 0;
for (int i = 0; i < rs.Tables[0].Rows.Count; i++)
{
if (!string.IsNullOrEmpty(rs.Tables[0].Rows[i][0].ToString()))
zol = i + 1;
}
string temp = "";
bool pas = false;
for (int i = 0; i < zol; i++)//100 zol
{
Thread.Sleep(100);//1000
// zzz = Convert.ToInt16((i + 1 * 1.00) / zol * 100);
try
{
//qingma(sendsns("【圣域传奇】最火爆的国战网游今日16时震撼开启。升级领Q币登陆发现金sycq.xkyx.com", rs.Tables[0].Rows[i][0].ToString().Trim());
if (qingma(sendsns("【圣域传奇】最火爆的国战网游今日16时震撼开启。升级领Q币登陆发现金sycq.xkyx.com", rs.Tables[0].Rows[i][0].ToString().Trim())).ToString().Substring(0, 1) != "1")
{
x.Write("\r\n" + "第 " + i + " 条数据出问题,返回电话号码:" + rs.Tables[0].Rows[i][0].ToString());
pas = true;
break;
}
else
{
x.Write("\r\n" + rs.Tables[0].Rows[i][0].ToString());
}
}
catch
{
Thread.Sleep(2000);
try
{
if (qingma(sendsns("【圣域传奇】最火爆的国战网游今日16时震撼开启。升级领Q币登陆发现金sycq.xkyx.com", rs.Tables[0].Rows[i][0].ToString().Trim())).ToString().Substring(0, 1) != "1")
{
x.Write("\r\n" + "第 " + i + " 条数据出问题,返回电话号码:" + rs.Tables[0].Rows[i][0].ToString());
pas = true;
break;
}
else
{
x.Write("\r\n" + rs.Tables[0].Rows[i][0].ToString());
}
}
catch
{
pas = true;
x.Write("\r\n" + "第 " + i + " 条数据超时,返回电话号码:" + rs.Tables[0].Rows[i][0].ToString());
break;
}
}
}
if (!pas)
{
x.Write("\r\n" + "发送成功");
x.Close();
}
else
{
x.Write("\r\n" + "失败");
x.Close();
}
}
}
public DataSet ExcelToDS(string Path)
{
string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Path + ";" + "Extended Properties=Excel 8.0;";
OleDbConnection conn = new OleDbConnection(strConn);
conn.Open();
string strExcel = "";
OleDbDataAdapter myCommand = null;
DataSet ds = null;
strExcel = "select * from [sheet1$]";
myCommand = new OleDbDataAdapter(strExcel, strConn);
ds = new DataSet();
myCommand.Fill(ds, "table1");
return ds;
}
public static int GetCharInStringCount(string Char, string String)
{
string str = String.Replace(Char, "");
return (String.Length - str.Length) / Char.Length;
}
private string sendsns(string str1,string tel)
{
Encoding encode = System.Text.Encoding.GetEncoding("gb2312");
HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create("http://1111111111:30002/shttp.recmt?ua=2222222&pw=3333333&mobile=" + tel + "&msg=" + Server.UrlEncode(str1) + "");
myReq.Method = "GET";
myReq.ContentType = "application/x-www-form-urlencoded";
//接收HTTP做出的响应
WebResponse myResp = myReq.GetResponse();
Stream ReceiveStream = myResp.GetResponseStream();
StreamReader readStream = new StreamReader(ReceiveStream, encode);
Char[] read = new Char[256];
int count = readStream.Read(read, 0, 256);
string str = null;
while (count > 0)
{
str += new String(read, 0, count);
count = readStream.Read(read, 0, 256);
}
readStream.Close();
myResp.Close();
return str;
}
private string qingma(string str)
{
str = str.ToLower();
str=str.Replace("<root><result>","");
str=str.Replace("</i></root>","");
str = str.Replace("</result></root>", "");
str = str.Replace("</result><i>", "|");
return str;
// return "1|0007727884";
}
}
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using System.IO;
using System.Xml;
using System.Data;
using System.Net;
using System.Threading;
using System.Data.OleDb;
public partial class admin9h_adduser : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//if (string.IsNullOrEmpty(admins.isadmin()))
//{
// Response.Write("<script>window.parent.location='../login.aspx';</script>");
// Response.End();
//}
if (!IsPostBack)
pagebind();
}
protected void pagebind()
{
}
protected void Button_Click(object sender, EventArgs e)
{
//Response.Write(sendsns("【圣域传奇】最火爆的国战网游今日16时震撼开启。升级领Q币登陆发现金sycq.xkyx.com", "13910687714"));
//Response.End();
string FILE_NAME = Server.MapPath("./") + "tel_sns_" + System.DateTime.Now.ToString("hh_MM_ss") + ".txt";
if (!File.Exists(FILE_NAME))
{
StreamWriter sr = File.CreateText(FILE_NAME);
sr.Close();
}
StreamWriter x = new StreamWriter(FILE_NAME, true, System.Text.Encoding.Default);
x.Write("开始发送");
//Encoding encode = System.Text.Encoding.GetEncoding("gb2312");
//HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create("http://202.85.214.57:30002/shttp.recmt?ua=9hservice&pw=753peach&mobile=18610810873&msg='" + Server.UrlEncode("uuu编码后") + "'");
//myReq.Method = "GET";
//myReq.ContentType = "application/x-www-form-urlencoded";
接收HTTP做出的响应
//WebResponse myResp = myReq.GetResponse();
//Stream ReceiveStream = myResp.GetResponseStream();
//StreamReader readStream = new StreamReader(ReceiveStream, encode);
//Char[] read = new Char[256];
//int count = readStream.Read(read, 0, 256);
//string str = null;
//while (count > 0)
//{
// str += new String(read, 0, count);
// count = readStream.Read(read, 0, 256);
//}
//readStream.Close();
//myResp.Close();
string str = "-1";
string strCon;
strCon = Server.MapPath("./") + "tele.xls";
if (!System.IO.File.Exists(strCon))
{
Response.Write("请检查是否存在xls");
x.Close();
}
else
{
string sql = "";
DataSet rs = ExcelToDS(strCon);
int zol = 0;
for (int i = 0; i < rs.Tables[0].Rows.Count; i++)
{
if (!string.IsNullOrEmpty(rs.Tables[0].Rows[i][0].ToString()))
zol = i + 1;
}
string temp = "";
bool pas = false;
for (int i = 0; i < zol; i++)//100 zol
{
Thread.Sleep(100);//1000
// zzz = Convert.ToInt16((i + 1 * 1.00) / zol * 100);
try
{
//qingma(sendsns("【圣域传奇】最火爆的国战网游今日16时震撼开启。升级领Q币登陆发现金sycq.xkyx.com", rs.Tables[0].Rows[i][0].ToString().Trim());
if (qingma(sendsns("【圣域传奇】最火爆的国战网游今日16时震撼开启。升级领Q币登陆发现金sycq.xkyx.com", rs.Tables[0].Rows[i][0].ToString().Trim())).ToString().Substring(0, 1) != "1")
{
x.Write("\r\n" + "第 " + i + " 条数据出问题,返回电话号码:" + rs.Tables[0].Rows[i][0].ToString());
pas = true;
break;
}
else
{
x.Write("\r\n" + rs.Tables[0].Rows[i][0].ToString());
}
}
catch
{
Thread.Sleep(2000);
try
{
if (qingma(sendsns("【圣域传奇】最火爆的国战网游今日16时震撼开启。升级领Q币登陆发现金sycq.xkyx.com", rs.Tables[0].Rows[i][0].ToString().Trim())).ToString().Substring(0, 1) != "1")
{
x.Write("\r\n" + "第 " + i + " 条数据出问题,返回电话号码:" + rs.Tables[0].Rows[i][0].ToString());
pas = true;
break;
}
else
{
x.Write("\r\n" + rs.Tables[0].Rows[i][0].ToString());
}
}
catch
{
pas = true;
x.Write("\r\n" + "第 " + i + " 条数据超时,返回电话号码:" + rs.Tables[0].Rows[i][0].ToString());
break;
}
}
}
if (!pas)
{
x.Write("\r\n" + "发送成功");
x.Close();
}
else
{
x.Write("\r\n" + "失败");
x.Close();
}
}
}
public DataSet ExcelToDS(string Path)
{
string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Path + ";" + "Extended Properties=Excel 8.0;";
OleDbConnection conn = new OleDbConnection(strConn);
conn.Open();
string strExcel = "";
OleDbDataAdapter myCommand = null;
DataSet ds = null;
strExcel = "select * from [sheet1$]";
myCommand = new OleDbDataAdapter(strExcel, strConn);
ds = new DataSet();
myCommand.Fill(ds, "table1");
return ds;
}
public static int GetCharInStringCount(string Char, string String)
{
string str = String.Replace(Char, "");
return (String.Length - str.Length) / Char.Length;
}
private string sendsns(string str1,string tel)
{
Encoding encode = System.Text.Encoding.GetEncoding("gb2312");
HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create("http://1111111111:30002/shttp.recmt?ua=2222222&pw=3333333&mobile=" + tel + "&msg=" + Server.UrlEncode(str1) + "");
myReq.Method = "GET";
myReq.ContentType = "application/x-www-form-urlencoded";
//接收HTTP做出的响应
WebResponse myResp = myReq.GetResponse();
Stream ReceiveStream = myResp.GetResponseStream();
StreamReader readStream = new StreamReader(ReceiveStream, encode);
Char[] read = new Char[256];
int count = readStream.Read(read, 0, 256);
string str = null;
while (count > 0)
{
str += new String(read, 0, count);
count = readStream.Read(read, 0, 256);
}
readStream.Close();
myResp.Close();
return str;
}
private string qingma(string str)
{
str = str.ToLower();
str=str.Replace("<root><result>","");
str=str.Replace("</i></root>","");
str = str.Replace("</result></root>", "");
str = str.Replace("</result><i>", "|");
return str;
// return "1|0007727884";
}
}