Odp: Potrzebuje pomocy z buypoints.php
<?PHP
#################### CONFIG ###################################################
$config['dotpay'][0]['id'] = numer id; # numer ID zarejestrowanego klienta
$config['dotpay'][0]['code'] = "tresc"; # identyfikator uslug SMS
$config['dotpay'][0]['type'] = "sms"; # typ konta: C1 - 8 znakowy kod bezobslugowy, sms - dla sprawdzania SMSow
$config['dotpay'][0]['addpoints'] = 100; # ile premium punktow daje dany sms
$config['dotpay'][0]['sms_number'] = 73068; # numer na jaki nalezy wyslac kod
$config['dotpay'][0]['sms_text'] = "AP.tresc"; # tresc jaka ma byc w SMSie
$config['dotpay'][0]['sms_cost'] = "3.66 zl brutto"; # cena za wyslanie sms
$config['dotpay'][1]['id'] = id; # numer ID zarejestrowanego klienta
$config['dotpay'][1]['code'] = "tresc"; # identyfikator uslug SMS
$config['dotpay'][1]['type'] = "sms"; # typ konta: C1 - 8 znakowy kod bezobslugowy, sms - dla sprawdzania SMSow
$config['dotpay'][1]['addpoints'] = 600; # ile premium punktow daje dany sms
$config['dotpay'][1]['sms_number'] = "79068"; # numer na jaki nalezy wyslac kod
$config['dotpay'][1]['sms_text'] = "AP."; # tresc jaka ma byc w SMSie
$config['dotpay'][1]['sms_cost'] = "10.98 zl brutto"; # cena za wyslanie sms
function check_code($code, $posted_code, $user_id, $type)
{
$handle = fopen("http://dotpay.pl/check_code.php?id=".$user_id."&code=".$code."&check=".$posted_code."&type=".$type."&del=0", 'r');
$status = fgets($handle, 8);
$czas_zycia = fgets($handle, 24);
fclose($handle);
$czas_zycia = rtrim($czas_zycia);
return array($status, $czas_zycia);
}
function delete_code($code, $posted_code, $user_id, $type)
{
$handle = fopen("http://dotpay.pl/check_code.php?id=".$user_id."&code=".$code."&check=".$posted_code."&type=".$type."&del=1", 'r');
fclose($handle);
}
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;
}
#################################################################################
$sms_type = (int) $_POST['sms_type'];
$posted_code = trim($_POST['code']);
$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->load($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_code))
$errors[] = 'Prosze wpisac kod z SMSa.';
if(!$account->isLoaded())
$errors[] = 'Konto/konto postaci o podanym nicku nie istnieje.';
if(count($errors) == 0)
{
if($config['site']['verify_code_shop'] == 'yes')
{
//check verification code
$string = strtoupper($_SESSION['string']);
$userstring = strtoupper($verify_code);
$_SESSION['string'] = mt_rand(1,99999);
if(empty($string))
$errors[] = "Kod z obrazka w sesji jest pusty, sproboj ponownie.";
else
{
if(empty($userstring))
$errors[] = "Prosze wpisac kod z obrazka.";
else
{
if($string != $userstring)
$errors[] = "Kod z obrazka jest niepoprawny.";
}
}
}
if(count($errors) == 0)
{
$code_info = check_code($config['dotpay'][$sms_type]['code'], $posted_code, $config['dotpay'][$sms_type]['id'], $config['dotpay'][$sms_type]['type']);
if($code_info[0] == 0)
$errors[] = 'Podany kod z SMS jest niepoprawny lub wybrano zla opcje SMSa.';
else
{
if(add_points($account, $config['dotpay'][$sms_type]['addpoints']))
{
$code_info = delete_code($config['dotpay'][$sms_type]['code'], $posted_code, $config['dotpay'][$sms_type]['id'], $config['dotpay'][$sms_type]['type']);
$main_content .= '<h2><font color="red">Dodano '.$config['dotpay'][$sms_type]['addpoints'].' punktow premium do konta: '.$to_user.' !</font></h2>';
}
else
$errors[] = 'Wystapil blad podczas dodawania punktow do konta, sproboj ponownie.';
}
}
}
}
if(count($errors) > 0)
{
$main_content .= '<h2><font color="red">Wystapily bledy:</font></h2><b>';
foreach($errors as $error)
$main_content .= '* '.$error.'<br />';
$main_content .= '</b><hr />';
}
$main_content .= '<h1><font color="red">SMS!</font></h1>Kup punkty premium, mozesz je wymienic w sklepie OTSa na przedmioty w grze, aby zakupic punkty premium wyslij SMSa:';
foreach($config['dotpay'] as $sms)
$main_content .= '<br /><b>* Na numer <font color="red">'.$sms['sms_number'].'</font> o tresci <font color="red"><b>'.$sms['sms_text'].'</b></font> za <font color="red"><b>'.$sms['sms_cost'].'</b></font>, a za kod zwrotny dostaniesz <font color="red"><b>'.$sms['addpoints'].'</b></font> punktow premium.</b>';
$main_content .= '<br />W SMSie zwrotnym otrzymasz specjalny kod. Wpisz ten kod w formularzu wraz z nickiem postaci lub numerem konta osoby ktora ma otrzymac punkty.<hr /><hr />
Serwis SMS obslugiwany przez <a href="http://www.dotpay.pl" target="_blank">Dotpay.pl</a><br />
Regulamin: <a href="http://www.dotpay.pl/regulaminsms" target="_blank">http://www.dotpay.pl/regulaminsms</a><br />
Usluga dostepna w sieciach: Orange, Plus GSM, Era.<br />
<b>'.$config['server']['serverName'].'</b> nie odpowieda za zle wpisane tresci SMS.<hr />
<form action="index.php?subtopic=buypoints" method="POST"><table>';
$main_content .= '<tr><td><b>Nick postaci lub numer konta: </b></td><td><input type="text" size="20" value="'.$to_user.'" name="to_user" /></td></tr>
<tr><td><b>Kod z SMSa: </b></td<td><input type="text" size="20" value="'.$posted_code.'" name="code" /></td></tr><tr><td><b>Typ wyslanego SMSa: </b></td><td><select name="sms_type">';
foreach($config['dotpay'] as $id => $sms)
$main_content .= '<option value="'.$id.'">numer '.$sms['sms_number'].' - kod '.$sms['sms_text'].' - SMS za '.$sms['sms_cost'].'</option>';
$main_content .= '</select></td></tr>';
if($config['site']['verify_code'] == 'yes')
$main_content .= '<tr><td><B>Kod weryfikacji: </B></td><td><img src="imgverification/imagebuilder.php?image_refresher='.mt_rand(1,99999).'" border="0" alt=""></td></tr>
<tr><td><B>Wpisz kod weryfikacji: </B></td><td><INPUT id="verify" NAME="verify_code" VALUE="" SIZE=30></td></tr>';
$main_content .= '<tr><td></td><td><input type="submit" value="Sprawdz" /></td></tr></table></form>';
?>