exist_table("Presence")){ $db->query("SELECT UserID FROM Presence WHERE UserID='".$db->escape($agentid)."' AND SecureSessionID='".$db->escape($sessionid)."'"); } else { $db->query("SELECT UUID FROM agents WHERE UUID='".$db->escape($agentid)."' AND secureSessionID='".$db->escape($sessionid)."'"); } list($UUID) = $db->next_record(); $db->close(); if($UUID) { $membership_levels = array('levels' => 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)); header("Content-type: text/xml"); echo $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."")); echo $response_xml; } return ""; } # # Perform the buy # xmlrpc_server_register_method($xmlrpc_server, "buyLandPrep", "buy_land"); function buy_land($method_name, $params, $app_data) { global $economy_source_account; $req = $params[0]; $agentid = $req['agentId']; $sessionid = $req['secureSessionId']; $amount = $req['currencyBuy']; $real = $req['estimatedCost']; $billableArea = $req['billableArea']; $ipAddress = $_SERVER['REMOTE_ADDR']; # # Validate Requesting user has a session # $db = new DB(OPENSIM_DB_HOST, OPENSIM_DB_NAME, OPENSIM_DB_USER, OPENSIM_DB_PASS); if ($db->exist_table("Presence")){ $db->query("SELECT UserID FROM Presence WHERE UserID='".$db->escape($agentid)."' AND SecureSessionID='".$db->escape($sessionid)."'"); } else { $db->query("SELECT UUID FROM agents WHERE UUID='".$db->escape($agentid)."' AND secureSessionID='".$db->escape($sessionid)."'"); } list($UUID) = $db->next_record(); $db->close(); if ($UUID) { if($amount > 0) { if(!process_transaction($agentid, $real, $ipAddress)) { header("Content-type: text/xml"); $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."")); echo $response_xml; return ""; } move_money($economy_source_account, $agentid, $amount, 0, 0, 0, 0, "Currency purchase",0,$ipAddress); } header("Content-type: text/xml"); $response_xml = xmlrpc_encode(array('success' => True)); echo $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."")); echo $response_xml; } return ""; } # # Process XMLRPC request # $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); ?>