<?php
//´úÁì²éÑ¯
require 'common.php';

$url=daddslashes($_GET['url']);

if(!empty($url)){
	$data = get_curl($url,0,0,0,1);
	preg_match("/Location: (.*?)\r\n/iU", $data, $urls);
	if(!$urls[1]) $long_url=$url;else $long_url=$urls[1];
	if(strpos($long_url,'www.battleofballs.com')===false){
		exit('{"code":-3}');
	}
	$refer = str_replace("?","/index_mobile_share.html?",$long_url);
	$account = explode('Account=',$refer);
	$account = urldecode($account[1]);
	$id = intval(trim(getSubstr($refer,"id=","&A")));

	$row=$DB->get_row("SELECT * FROM qiu_job WHERE id='$id' limit 1");
	if($row){
		exit('{"id":"'.$id.'","account":"'.$account.'","add_time":"'.$row['addtime'].'","end_time":"'.$row['endtime'].'","last_time":"'.$row['lasttime'].'","code":0}');
	}else{
		exit('{"code":-1}');
	}
}else{
	exit('{"code":-2}');
}