array('id' => "00000000-0000-0000-0000-000000000000", 'description' => "some level")); $landUse = array('upgrade' => False, 'action' => "".SYSURL.""); $currency = array('estimatedCost' => convert_to_real($amount)); $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)); } else { $response_xml = xmlrpc_encode(array( 'success' => False, 'errorMessage' => "Unable to Authenticate\n\nClick URL for more info.", 'errorURI' => "".SYSURL."")); } header("Content-type: text/xml"); echo $response_xml; return ""; } # # Perform the buy (所持金が足りないとき) # xmlrpc_server_register_method($xmlrpc_server, "buyLandPrep", "buy_land"); function buy_land($method_name, $params, $app_data) { $req = $params[0]; $agentid = $req['agentId']; $secureid = $req['secureSessionId']; $amount = $req['currencyBuy']; $cost = $req['estimatedCost']; $billableArea = $req['billableArea']; $confim = $req['confirm']; $ipAddress = $_SERVER['REMOTE_ADDR']; // if ($confim!=get_confirm_value($ipAddress)) { $response_xml = xmlrpc_encode(array('success' => False, 'errorMessage'=> "\n\nMissmatch Confirm Value!!", 'errorURI' => "".SYSURL."")); header("Content-type: text/xml"); echo $response_xml; return ""; } $ret = opensim_check_secure_session($agentid, null, $secureid); if ($ret) { if($amount>=0) { if (!$cost) $cost = convert_to_real($amount); if(!process_transaction($agentid, $cost, $ipAddress)) { $response_xml = xmlrpc_encode(array( 'success' => False, 'errorMessage' => "\n\nThe gateway has declined your transaction. Please update your payment method AND try again later.", 'errorURI' => "".SYSURL."")); } // $enough_money = false; $res = add_money($agentid, $amount, $secureid); if ($res["success"]) $enough_money = true; if ($enough_money) { $amount += get_balance($agentid); move_money($agentid, null, $amount, 5002, 0, "Land Purchase", 0, 0, $ipAddress); update_simulator_balance($agentid, -1, $secureid); $response_xml = xmlrpc_encode(array('success' => True)); } else { $response_xml = xmlrpc_encode(array('success' => False, 'errorMessage'=> "\n\nYou do not have sufficient funds for this purchase", 'errorURI' => "".SYSURL."")); } } } else { $response_xml = xmlrpc_encode(array('success' => False, 'errorMessage' => "\n\nUnable to Authenticate\n\nClick URL for more info.", 'errorURI' => "".SYSURL."")); } header("Content-type: text/xml"); echo $response_xml; return ""; } # # Process XMLRPC request # if (!isset($HTTP_RAW_POST_DATA)) $HTTP_RAW_POST_DATA = file_get_contents('php://input'); $request_xml = $HTTP_RAW_POST_DATA; //error_log("landtool.php: ".$request_xml); xmlrpc_server_call_method($xmlrpc_server, $request_xml, ''); xmlrpc_server_destroy($xmlrpc_server);