Use Debian 6.0 (testing)
Image:
PHP Function:
What wrong??
Image:
PHP Function:
PHP:
/* Configure Service DaoPay */
$config['daopay'][0]['appcode'] = 54025;
$config['daopay'][0]['prodcode'] = 'rlpoint4';
$config['daopay'][0]['addpoints'] = '4';
$config['daopay'][0]['cost'] = "1 EUR";
$config['daopay'][1]['appcode'] = 54025;
$config['daopay'][1]['prodcode'] = 'rlpoints20';
$config['daopay'][1]['addpoints'] = '20';
$config['daopay'][1]['cost'] = "5 EUR";
$config['daopay'][2]['appcode'] = 54025;
$config['daopay'][2]['prodcode'] = 'rlpoint60';
$config['daopay'][2]['addpoints'] = '60';
$config['daopay'][2]['cost'] = "15 EUR";
#################################################################################
function save_trans($file, $acc, $code)
{
$hak = fopen($file, "a");
fwrite($hak, $code.'='.$acc.'
');
fclose($hak);
}
function check_code_daopay($appcode, $prodcode, $pin)
{
$handle = fopen("http://daopay.com/svc/pincheck?appcode=".$appcode."&prodcode=".$prodcode."&pin=".$pin, "r");
if ($handle)
{
$status = fgets($handle, 128);
fclose($handle);
if($status[0] == 'o' && $status[1] == 'k')
$return = 1;
else
$return = 2;
}
else
$return = 3;
return $return;
}
/* DaoPay Function - Start Script By Gesior */
if ($_REQUEST['system'] == 'daopay' && $config['daopay_active'] && $config['active_ALL'])
{
#################################################################################
$offer_id = (int) $_POST['offer_id'];
$posted_pincode = trim($_POST['pincode']);
$to_user = trim($_POST['to_user']);
$verify_code = trim($_POST['verify_code']);
#################################################################################
if(!empty($to_user))
{
if(is_numeric($to_user))
{
$account = new OTS_Account();
$account->find($to_user);
}
else
{
$player = new OTS_Player();
$player->find($to_user);
if($player->isLoaded())
$account = $player->getAccount();
else
$account = new OTS_Account();
}
if(empty($posted_pincode))
$errors[] = 'Please enter your PIN code.';
if(!$account->isLoaded())
$errors[] = 'Account/account of player with this name doesn\'t exist.';
if(count($errors) == 0)
{
if($config['site']['verify_code_shop'])
{
//check verification code
$string = strtoupper($_SESSION['string']);
$userstring = strtoupper($verify_code);
$_SESSION['string'] = mt_rand(1,99999);
if(empty($string))
$errors[] = "Code from verification image in session is empty, try again.";
else
{
if(empty($userstring))
$errors[] = "Please enter code from verification image.";
else
{
if($string != $userstring)
$errors[] = "Code from verification image is wrong.";
}
}
}
function add_points(OTS_Account $account, $number_of_points)
{
if($account->isLoaded())
{
$account->setCustomField('premium_points', ($account->getCustomField('premium_points')+$number_of_points));
return true;
}
else
return false;
}
if(count($errors) == 0)
{
$code_info = check_code_daopay($config['daopay'][$offer_id]['appcode'], $config['daopay'][$offer_id]['prodcode'], $posted_pincode);
if($code_info == 3)
$errors[] = 'Server has problem with connection to daopay.com, can\'t verify PIN code.';
elseif($code_info == 2)
$errors[] = 'Wrong PIN code, try to enter code again.';
elseif($code_info == 1)
{
if(add_points($account,$config['daopay'][$offer_id]['addpoints']))
{
save_trans('config/daopay.log', $account->getId(), $posted_pincode);
$main_content .= '<h2><font color="red">Good PIN code. Added '.$config['daopay'][$offer_id]['addpoints'].' Premium Points to account of: '.$to_user.' !</font></h2>';
}
else
$errors[] = 'Error occured, try again.';
}
}
}
}
if(count($errors) > 0)
{
$main_content .= '<font color="red"><b>Errors occured:</b></font>';
foreach($errors as $error)
$main_content .= '<br />* '.$error;
$main_content .= '<hr /><hr />';
}
/* Start Scripting by RaikND*/
/* System Languange BY RaikND*/
elseif($_REQUEST['lng'] == 'eng')
{
$main_content .= '<table align="" width="100%" height="100%">
<tr bgcolor=#133838><th><center>DaoPay Automatic System</th></tr>';
$main_content .= '<tr><td><b><center><font color="red">Donation for NDGames, with these points you can buy in the <a href="?subtopic=xenoriashop">Shop</a>. To obtain Premium Points and to obtain his item/vip</font></td></tr>
<tr><td>· When this donation realizing these <font color="green"><b>Accepting</b></font> the previous <a href="?subtopic=donate">Rules</a>.</tr></td>
<tr><td>· On Having clicked the <b><i>following links</b></i> and having done the donation, wait to that carge the bar and they obtain the code that they give him, then on having had it guarded well, return to this site and your code sticks in the system of below and certainly, if they buy it of <b><i>1EUR</b></i>, they cannot buy it of <b><i>5EUR</b></i>.</td></tr>
';
}
elseif($_REQUEST['lng'] == 'es')
{
$main_content .= '<table align="" width="100%" height="100%">
<tr bgcolor=#133838><th><center>Sistema Automatico de DaoPay</th></tr>';
$main_content .= '<tr><td><b><center><font color="red">Donacion para NDGames, con estos puntos puedes comprar en la <a href="?subtopic=xenoriashop">Shop</a>. Para obtener <u>Premium Points</u> y obtener su item/vip</font></td></tr>
<tr><td>· Al realizar esta donacion estas <font color="green"><b>Aceptando</b></font> las anteriores <a href="?subtopic=donate">Reglas</a>.</tr></td>
<tr><td>· Al Clicar los <b><i>siguientes links</i></b> y hacer la donacion, esperen a que se carge la barra y obtengan el <b><i>codigo que le dan</b></i>, luego al tenerlo bien guardado, regrese a este sitio y pega tu codigo en el sistema de abajo y porsupuesto, si compran la de <b><i>1EUR</b></i>, no podran comprar la de <b><i>5EUR</b></i>.</td></tr>
';
}
/* End System Languange*/
foreach($config['daopay'] as $offer) {
$order++;
$main_content .= '<tr><td><b>'.$order.'. Cantidad: <font color="red"><a href="http://daopay.com/payment/?appcode='.urlencode($offer['appcode']).'&prodcode='.urlencode($offer['prodcode']).'">Donar '.$offer['cost'].' para obtener '.$offer['addpoints'].' premium points</a></font><br></tr></td>';
}
$main_content .= '</table>';
$main_content .= '<hr /><form action="?subtopic=donate&system=daopay" method="POST"><table>';
$main_content .= '<tr><td><b>Player name or account name: </b></td><td><input type="text" size="20" value="'.$to_user.'" name="to_user" /></td></tr>
<tr><td><b>PIN code: </b></td<td><input type="text" size="20" value="'.$posted_pincode.'" name="pincode" /></td></tr><tr><td><b>Offer type: </b></td><td><select name="offer_id">';
foreach($config['daopay'] as $id => $offer)
$main_content .= '<option value="'.$id.'">'.$offer['prodcode'].' - cost '.$offer['cost'].' - points '.$offer['addpoints'].'</option>';
$main_content .= '</select></td></tr>';
if($config['site']['verify_code_shop'])
$main_content .= '<tr><td><B>Verify code: </B></td><td><img src="imgverification/imagebuilder.php?image_refresher='.mt_rand(1,99999).'" border="0" alt=""></td></tr>
<tr><td><B>Enter verify code: </B></td><td><INPUT id="verify" NAME="verify_code" VALUE="" SIZE=30></td></tr>';
$main_content .= '<tr><td></td><td><input type="submit" value="Check Code" /></td></tr></table></form>';
What wrong??
Last edited: