<?php

	@set_time_limit(0);
	@ignore_user_abort(true);
	require '../siteinfo.php';
	require '../Source/class/cronjob.class.php';
	require '../Agreement/Cellphone/class.php';

	if (empty($_GET['server']) || $_GET['server']<1 || $_GET['server']>8 || @$_GET['job']!=$websitejob){
		die ('Parameter error!');
	}

	//连接数据库
	$localhost = mysql_connect ($sqlhost,$sqluser,$sqlpass)or die ('连接数据库失败，请联系网站管理员！');
	mysql_select_db ($sqldata,$localhost);
	mysql_query ('SELECT COUNT(id) FROM fw'.$_GET['server']);
	$result = mysql_query ('SELECT * FROM fw'.$_GET['server']);
	$cron = new cron;

	while ($row = mysql_fetch_array ($result)){

		$sql = mysql_fetch_array (mysql_query ("SELECT * FROM `qqlist` WHERE `qq`='$row[qq]'"));

		if ($sql['qy'] != 'false'){
			$nos = $sql['nos'];
			if ($nos < 300){
				if ($sql['Agreement'] == '3G'){
					if ($cron -> Login_3G ($row['qq'],$row['sid'])){
						$time++;
						echo '<h5>登陆成功---3G协议</h5>';
					}else if ($cron -> Login_Cellphone ($sql['qq'],$sql['pw'])){
						$time++;
						echo '<h5>登陆成功---3G协议</h5>';
					}else{
						$nos++;
						mysql_query ("UPDATE `qqlist` SET `nos`='$nos' WHERE `qq`='$row[qq]'");
						echo '<h5>登陆失败---3G协议</h5>';
					}
				}else{
					if ($cron -> Login_Cellphone ($sql['qq'],$sql['pw'])){
						$time++;
						echo '<h5>登陆成功---手机协议</h5>';
					}else if ($cron -> Login_3G ($row['qq'],$row['sid'])){
						$time++;
						echo '<h5>登陆成功---手机协议</h5>';
					}else{
						$nos++;
						mysql_query ("UPDATE qqlist SET nos='$nos' WHERE qq='$row[qq]'");
						echo '<h5>登陆失败---手机协议</h5>';
					}
				}

				//usleep (300000);

			}
		}

	}

	$cron -> economize_time ($time);
	echo '<h3><font color="red">共耗用时间: '.$cron -> hi_time().' 秒</font></h3>';
