All pastes #982118 Raw Edit

landtool

public text v1 · immutable
·published 2008-04-12 08:45 UTC
rendered paste body
<? 

// This file enables buying land in the client.

// For this to work, the all clients using the client to purchase land need to add
// -helperURI <WebpathToThisDirectory> to the commandline parameters when starting the client!
// ex: '-helperURI http://foo.bar/'  if this file is in the root folder of the website foo.bar



include("settings/config.php");
include("settings/mysql.php");


function preflightBuyLandPrep_func($method_name, $params, $app_data)
{

	$confirmValue = "password";

	$req = $params[0];
	$agentid = str_replace("\'","",$req['agentId']);
	$sessionid = str_replace("\'","",$req['secureSessionId']);
	$amount = $req['currencyBuy'];
	$billableArea = $req['billableArea'];
	// Validate Requesting user has a session
	$DbLink = new DB;
	$DbLink->query("SELECT UUID FROM ".C_SESSION_TBL." WHERE UUID='$agentid' and secureSessionID='$sessionid'");
	list($UUIDUSER) = $DbLink->next_record();

	if($UUIDUSER){

	$membership_levels = array('levels'=>array('id'=>"00000000-0000-0000-0000-000000000000",'description'=>"some level"));
	
	
	$landUse = array('upgrade'=>False,'action'=>"".SYSURL."");
	$currency = array('estimatedCost'=>0);
	$membership = array('upgrade'=>False,
				'action'=>"".SYSURL."",
				'levels'=>$membership_levels);
	

		$response_xml = xmlrpc_encode(array(
				'success'=>True,'currency'=>$currency,
				'membership'=>$membership,
				'landUse'=>$landUse,
				'currency'=>$currency,
				'confirm'=>$confirmvalue
			));
		header("Content-type: text/xml");
		print $response_xml;
	} else {
				
		header("Content-type: text/xml");
		$response_xml = xmlrpc_encode(array(
					'success'=>False,
					'errorMessage'=>"\n\nUnable to Authenticate\n\nClick URL for more info.",
					'errorURI'=> "".SYSURL.""
					));
		print $response_xml;

	}
		

	return "";
}
function buy_func($method_name, $params, $app_data)
{
	header("Content-type: text/xml");
	
	$response_xml = xmlrpc_encode(array('success'=>True));

	print $response_xml;
	return "";
}

$xmlrpc_server = xmlrpc_server_create();

xmlrpc_server_register_method($xmlrpc_server, "preflightBuyLandPrep", "preflightBuyLandPrep_func");
xmlrpc_server_register_method($xmlrpc_server, "buyLandPrep", "buy_func");
$request_xml = $HTTP_RAW_POST_DATA;


$response = xmlrpc_server_call_method($xmlrpc_server, $request_xml, '');
//print $response;

xmlrpc_server_destroy($xmlrpc_server);

?>