21,886
社区成员
发帖
与我相关
我的任务
分享
<?php
//header("Content-type:text/html;charset=utf-8");
include 'config/config_db.php';
$conn = @mysql_connect(DB_HOST,DB_USER,DB_PASSWORD);
if (!$conn){
die("连接数据库失败:" . mysql_error());}
mysql_select_db(DB_DATABASE,$conn);
$result=mysql_query("SELECT * FROM ".DB_PREFIX."lists WHERE is_3g='0' AND is_online='0'");
class socket{
var $socket; //socket 句柄
var $sendflag = ">>>";
var $recvflag = "<<<";
var $response;
var $debug = 1;
function __construct($hostname,$port) {
$this->hostname=$hostname;
$this->port=$port;
}
function socket(){
$address = gethostbyname($this->hostname);
$this->socket = socket_create(AF_INET,SOCK_STREAM,SOL_TCP);
$result = socket_connect($this->socket,$address,$this->port);
if($this->debug == 1){
if ($result < 0) {
echo "socket_connect() failed.\nReason: ($result) " . socket_strerror($result) . "<br>";
} else{
echo "connect OK.<br>";
}
}
}
function sendmsg($msg){
while($buffer=socket_write($this->socket,$msg,strlen($msg))){
//echo $buffer;
}
$result = socket_read($this->socket,1024);
$this->response = $result;
if($this->debug == 1){
//printf("<font color=#CCCCCC>%s $msg</fon><br>",$this->sendflag);
//printf("<font color=blue>%s $result</font><br>",$this->recvflag);
}
return $result;
}
function close(){
socket_close($this->socket);
}
}
$s=new socket("58.60.12.177",14000);
while($row = mysql_fetch_array($result)){
$s->socket();
$s->sendmsg("VER=1.4&CON=1&CMD=Login&SEQ=112255&UIN=".$row['qq_number']."&PS=".$row['qq_pw']."&M5=1&LG=0&LC=812822641C978097&GD=5MWX2PF3FOVGTP6B&CKE=\r\n");
/*$s->sendmsg("VER=1.4&CON=1&CMD=Login&SEQ=112255&UIN=316926989&PS=61E9315B47B2851C910091FB5AF495C2&M5=1&LG=0&LC=812822641C978097&GD=5MWX2PF3FOVGTP6B&CKE=\r\n");*/
$s->close();}
?>