<?php
if($_REQUEST['ac']=='import'){
	if(!$_POST['username'] || !$_POST['password'] || !$_POST['mailtype']){
			die('the account is error');
	}
	//163
	if($_POST['mailtype']=='163'){
		
		require_once "class.163Http.php";
		$http163 = new http163();
		
		$res = $http163->getAddressList(trim($_POST['username']), trim($_POST['password']));
	}

	//sohu
	if($_POST['mailtype']=='sohu'){
		
		require_once "class.sohuHttp.php";
		$sohuHttp = new sohuHttp();
		
		$res = $sohuHttp->getAddressList(trim($_POST['username']), trim($_POST['password']));
	}
	
	//sina
	elseif($_POST['mailtype']=='sina'){
		require_once "class.sinaHttp.php";
		$sinahttp = new sinaHttp();
		
		$res = $sinahttp->getAddressList(trim($_POST['username']), trim($_POST['password']));
	}
	
	//yahoo
	elseif($_POST['mailtype']=='yahoo.cn' || $_POST['mailtype']=='yahoo.com' || $_POST['mailtype']=='yahoo.com.cn'){
		require_once "class.yahooHttp.php";
		$yahooHttp = new yahooHttp();
		
		$res = $yahooHttp->getAddressList(trim($_POST['username']).'@'.$_POST['mailtype'], trim($_POST['password']));
	}
	
	//tom
	elseif($_POST['mailtype']=='tom'){
		require_once "class.tomHttp.php";
		$tomhttp = new tomHttp();
		
		$res = $tomhttp->getAddressList(trim($_POST['username']), trim($_POST['password']));
	}
	
	//gmail
	elseif($_POST['mailtype']=='gmail'){
		require_once "class.gmailHttp.php";
		$gmailHttp = new gmailHttp();
		
		$res = $gmailHttp->getAddressList(trim($_POST['username']), trim($_POST['password']));
	}
	
	//126
	elseif($_POST['mailtype']=='126'){
		require_once "class.126Http.php";
		$http126 = new http126();
		
		$res = $http126->getAddressList(trim($_POST['username']), trim($_POST['password']));
	}	
	
	//yeah
	elseif($_POST['mailtype']=='yeah'){
		require_once "class.yeahHttp.php";
		$yeahHttp = new yeahHttp();
		
		$res = $yeahHttp->getAddressList(trim($_POST['username']), trim($_POST['password']));
	}	
	
	if($res){
		var_dump($res);
	}else{
		echo $res;exit;
	}
}
elseif($_REQUEST['ac']=='msn'){
	if(!$_POST['username'] || !$_POST['password']){
			die('the account is error');
	}
	require_once "class.msnHttp.php";
	$msn = new hotmail;
	$res = $msn->qGrab(trim($_POST['username']), trim($_POST['password']));
	
	if($res){
		var_dump($res);
	}else{
		echo $res;exit;
	}
}
echo "<hr/><a href='index.php'>返回继续查询</a>"
?>