flagflag  If you want to see English page, please click "English" Button at Left.

Re: LoadUrl Money

このトピックの投稿一覧へ

なし Re: LoadUrl Money

msg# 1.5.1
depth:
2
前の投稿 - 次の投稿 | 親投稿 - 子投稿なし | 投稿日時 2012-2-21 15:44
milo  Not too shy to talk   投稿数: 30
Hi Guy,

Here are the changes I make to be able to work with a key to security for the payment module.

sorry for the tag code, but it would nl2br() power that can be read ^^

First create table mysql:

CREATE TABLE IF NOT EXISTS `openmoney` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`avname` varchar(255) NOT NULL,
`avkey` char(36) NOT NULL,
`token` char(40) NOT NULL,
`virtualm` int(11) NOT NULL,
`realm` double NOT NULL DEFAULT '0',
`status` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=67 ;


Next modify opensim.mysql.php
add this function:

function opensim_set_avatar_session($name, $uuid,$token,$amount,$cout, &$db=null)
{
global $OpenSimVersion;

if (!isGUID($uuid)) return null;

if (!is_object($db)) $db = & opensim_new_db();
if ($OpenSimVersion==null) opensim_get_db_version($db);

$firstname = null;
$lastname = null;
$fullname = null;

if ($db->exist_table('openmoney')) {
$db->query("INSERT INTO openmoney SET avname='$name',avkey='$uuid',token='$token',virtualm='$amount',realm='$cout'");
$errno = $db->Errno;
}

return $errno;
}

On helper.php
edit this function "add_money":

function add_money($agentID, $amount, $prix, $avname, $secureID=null)
{
if (!isGUID($agentID)) return false;

//
if (!USE_CURRENCY_SERVER) {
env_set_money_transaction(null, $agentID, $amount, 5010, 0, "Buy Money", 0, 0, "");
$res["success"] = true;
return $res;
}

//
// XML RPC to Region Server
//
if (!isGUID($secureID, true)) return false;

$results = opensim_get_server_info($agentID);
$serverip = $results["serverIP"];
$httpport = $results["serverHttpPort"];
$serveruri = $results["serverURI"];
if ($serverip=="") return false;

$results = opensim_get_avatar_session($agentID);

$sessionID = $results["sessionID"];
$token = sha1($sessionID.":".uniqid(time()));
$retour = opensim_set_avatar_session($avname,$agentID,$token,$amount,$prix); //// <------------------------ ADD THIS LINE
if($retour) return false; //// <------------------------ ADD THIS LINE

if ($secureID==null) $secureID = $results["secureID"];

$req = array('clientUUID'=>$agentID,
'clientSessionID'=>$sessionID,
'clientSecureSessionID'=>$secureID,
'amount'=>$amount,
'clientTokenID'=>$token); //// <------------------------ ADD THIS LINE
$params = array($req);
$request = xmlrpc_encode_request('AddBankerMoney', $params);

$response = do_call($serverip, $httpport, $serveruri, $request);
//file_put_contents("log.txt", print_r($response,true));
return $response;
}

On Currency.php
section buy_currency

if($transactionPermit){
$res = add_money($agentid, $amount,$cost,$avname, $sessionid);
if ($res["success"])
$ret = true;
if ($ret && $res["settle"])
{
}
}

svn update
On MoneyModule.cs
i have edit this section:

public XmlRpcResponse AddBankerMoneyHandler(XmlRpcRequest request, IPEndPoint remoteClient)

search :

if (dlg!=null) {
dlg.SendUrlToUser(bankerUUID, "SYSTEM", UUID.Zero, UUID.Zero, false, m_settle_message, m_settle_url);
}

replace by:

if (dlg!=null) {
dlg.SendUrlToUser(bankerUUID, "SYSTEM", UUID.Zero, UUID.Zero, false, m_settle_message, m_settle_url+(string)requestParam["clientTokenID"]);
}

after:
./runprebuild.sh && nant clean && nant
cd opensim.currency
./build.sh

On OpenSim.ini
SettlementURL = "http://www.mywebsite.com/?token="
each avatar clicking that buy the L$, will receive a LoadURL with a unique key for each transaction.

Personally I adapt this system for multiple payment system.

Enjoy !

Milo
投票数:125 平均点:4.72

投稿ツリー

  条件検索へ


サイト内 検索

ログイン

ユーザー名:

パスワード:


パスワード紛失
新規登録

サブ メニュー

ミニカレンダー

前月2024年 4月翌月
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
<今日>

オンライン状況

134 人のユーザが現在オンラインです。 (3 人のユーザが Forum を参照しています。)

登録ユーザ: 0
ゲスト: 134

もっと...

アクセスカウンタ

今日 : 1566215662156621566215662
昨日 : 1795517955179551795517955
総計 : 2337463923374639233746392337463923374639233746392337463923374639
Powered by XOOPS Cube 2.1© 2001-2006 XOOPS Cube Project
Design by XoopsDesign.com