# dostepych activation dotpay and payment systems, value: true / false
$ config [ 'dotpay'] = array ();
$ config [ 'dotpay_active'] = true # dotpay active system?
$ config [ 'dotpay_active_sms'] = true # dotpay active system?
$ config [ 'dotpay_active_transfer'] = true # dotpay active system?
Example # Config for SMS
$ config [ 'dotpay'] [0] [ 'id'] = 21468 # ID registered customer
config $ [ 'dotpay'] [0] [ 'code'] = "DEB3 '# ID SMS
$ config [ 'dotpay'] [0] [ 'type'] = "SMS" # type: C1 - 8 digit code, maintenance-free, SMS - SMS for checking
$ config [ 'dotpay'] [0] [ 'addpoints'] = 100 # how many premium points gives an sms
$ config [ 'dotpay'] [0] [ 'sms_number'] = 73068; # number to send the code
$ config [ 'dotpay'] [0] [ 'sms_text'] = "AP.DEB3" # content to be in SMSie
$ config [ 'dotpay'] [0] [ 'sms_cost'] = "3.66 PLN; # price of sending SMS
Example # Config for a bank transfer / credit card
$ config [ 'dotpay'] [1] [ 'id'] = 21468 # ID registered customer
$ config [ 'dotpay'] [1] [ 'code'] = "debt" # ID SMS
$ config [ 'dotpay'] [1] [ 'type'] = "C1" # type: C1 - 8 digit code, maintenance-free, SMS - SMS for checking
$ config [ 'dotpay'] [1] [ 'addpoints'] = 400 # how many premium points gives an sms
$ config [ 'dotpay'] [1] [ 'sms_number'] = ""; # number to send the code
$ config [ 'dotpay'] [1] [ 'sms_text'] = "debt" # content to be in SMSie
$ config [ 'dotpay'] [1] [ 'sms_cost'] = "5 PLN" # price of sending SMS
# DaoPay activation of the system
$ config [ 'daopay'] = array ();
$ config [ 'daopay_active'] = true # daopay active system?
# Example config for daopay
$ config [ 'daopay'] [0] [ 'appcode'] = 46870 #
$ config [ 'daopay'] [0] [ 'prodcode'] = 'DEB3' #
$ config [ 'daopay'] [0] [ 'addpoints'] ='200'; #
$ config [ 'daopay'] [0] [ 'cost'] = "2 euro inc. VAT #
################################################## ###############################
function save_trans ($ file, $ acc, $ code)
(
$ hook = fopen ($ file, "a");
fwrite ($ hook, $ code .'='.$ acc. "
');
fclose ($ hook);
)
check_code_daopay function ($ appcode, $ prodcode, $ pin)
(
$ handle = fopen ( "http://DaoPay.com/svc/PINcheck?appcode =". $ appcode. "& subkey =". $ 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;
)
check_code_dotpay function ($ 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);
)
/ / Https: / / daopay.com / svc / pay.svc? Tidkey = 46870 & subkey = DEB3
delete_code_dotpay function ($ 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);
)
add_points function (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 ($ _REQUEST [ 'scheme'] == 'daopay' & & $ config [ 'daopay_active'])
(
################################################## ###############################
$ 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-> 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_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'] == 'yes')
(
/ / check verification code
$ string = strtoupper ($ _SESSION [ 'string']);
$ userstring = strtoupper ($ verify_code);
$ _SESSION [ 'String'] = mt_rand (1.99999);
if (empty ($ string))
$ errors [] = "Code from image verification in session is empty, try again."
else
(
if (empty ($ userstring))
$ errors [] = "Please enter verification code from image."
else
(
if ($ string! = $ userstring)
$ errors [] = "Code from image verification is wrong."
)
)
)
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 a problem with connection to daopay.com, can \' t verify the 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 ( 'trans / daopay.log', $ account-> getid (), $ posted_pincode);
$ main_content .= 'Good <h2> <font color="red"> PIN code. Added '. $ Config [' daopay '] [$ offer_id] [' addpoints']. " Premium Points to account of: '. $ To_user. " </ font> </ h2> ';
)
else
$ errors [] = 'Error occurred, try again.';
)
)
)
)
if (count ($ errors)> 0)
(
$ main_content .= '<font color="red"> <b> Errors occurred: </ b> </ font>';
foreach ($ errors as $ error)
$ main_content .= '<br /> *'. $ error;
$ main_content .= '<hr /> <hr />';
)
$ main_content .= 'Buy Premium Points. For this points you can buy Paccani / items in Shop. To buy points: <br />
1. Visit one of our pages and donate us (send an SMS / call special number). <br />
2. After donate daopay.com will show you the PIN code. <br />
3. Save this somewhere PIN code and open this page again. <br />
4. Enter your character name or account and your PIN code in form below. <br />
5. Select donation cost from list and press "Check Code". <br />
6. If account and PIN code is valid you get premium points. <br />
7. Open "Offer Shop" and buy items / Paccani:) <br />
<font color="red"> <b> Our pages: </ b> </ font> ';
foreach ($ config [ 'daopay'] as $ offer)
$ main_content .= '<br /> <b> * Address <font color="red"> <a href = "https: / / daopay.com / svc / pay.svc? tidkey ='. urlencode ($ offer [ 'appcode']).'& subkey ='. urlencode ($ offer [ 'prodcode']).'"> https: / / daopay.com / svc / pay.svc? tidkey ='. $ offer [ 'appcode'] . '& subkey ='. $ offer [ 'prodcode'].'</ a> </ font> - <font color="red"> <b>. $ offer [' cost'].'</ b> </ font> - <font color="red"> <b> '. $ offer [' addpoints'].'</ b> </ font> premium points </ b> ';
$ main_content .= '<hr /> action="index.php?subtopic=buypoints&system=daopay" <form method="POST"> <table>';
$ main_content .= '<tr> <td> <b> Player name or account number: </ 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'] == 'yes')
$ 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>' ;
)
elseif ($ _REQUEST [ 'scheme'] == 'dotpay' & & $ config [ 'dotpay_active'])
(
################################################## ###############################
$ 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 [] = 'Please enter the code from the SMS / transfer.';
if (! $ account-> isLoaded ())
$ errors [] = 'account / account given by the nickname does not exist.';
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 [] = "image verification code from the session is empty, Please try again."
else
(
if (empty ($ userstring))
$ errors [] = "Please enter the verification code from the image."
else
(
if ($ string! = $ userstring)
$ errors [] = "Code from the image verification is not valid."
)
)
)
if (count ($ errors) == 0)
(
$ code_info = check_code_dotpay ($ config [ 'dotpay'] [$ sms_type] [ 'code'], $ posted_code, $ config [ 'dotpay'] [$ sms_type] [ 'ID'], $ config [ 'dotpay'] [ $ sms_type] [ 'type']);
if ($ code_info [0] == 0)
$ errors [] = 'The code of the SMS / transfer is wrong or evil options selected SMS / transfer.';
else
(
if (add_points ($ account, $ config [ 'dotpay'] [$ sms_type] [ 'addpoints']))
(
save_trans ( 'trans / dotpay.log', $ account-> getid (), $ posted_code);
$ code_info = delete_code_dotpay ($ config [ 'dotpay'] [$ sms_type] [ 'code'], $ posted_code, $ config [ 'dotpay'] [$ sms_type] [ 'id'], $ config [ 'dotpay'] [ $ sms_type] [ 'type']);
$ main_content .= '<h1> <font color="red"> Added'. $ config [ 'dotpay'] [$ sms_type] [ 'addpoints']. " points premium to account: '. $ to_user. " </ font> </ h1> ';
)
else
$ errors [] = 'An error occurred while adding points to your account, Try again.';
)
)
)
)
if (count ($ errors)> 0)
(
$ main_content .= 'There were errors:';
foreach ($ errors as $ error)
$ main_content .= '<br /> *'. $ error;
$ main_content .= '<hr /> <hr />';
)
if ($ config [ 'dotpay_active_sms'])
(
$ main_content .= '<h2> text </ h2> Buy premium points, you can replace them in the shop for OTSa Paccani / items in the game to buy premium items send SMS:';
foreach ($ config [ 'dotpay'] as $ sms)
if ($ text [ 'type'] == 'sms')
$ main_content .= '<br /> * The number <b> <font color="red">. $ sms [' sms_number'].'</ font> <font color="red"> of contents <b > '. $ sms [' sms_text'].'</ b> </ font> <font color="red"> <b> for '. $ sms [' sms_cost'].'</ b> </ font > and get the code for <font color="red"> <b> '. $ sms [' addpoints'].'</ b> </ font> points premium. </ b> ';
$ main_content .= '<br /> SMSie In return you will receive a special code. Enter the code on the form along with Nick as a person or account number to receive points. <br />
SMS service is supported by <a href="http://www.dotpay.pl" Dotpay.pl target="_blank"> </ a> <br />
Terms: <a href="http://www.dotpay.pl/regulaminsms" http://www.dotpay.pl/regulaminsms target="_blank"> </ a> <br />
Available networks: Orange, Plus GSM, Era. <br />
<b> '. $ config [' server '] [' servername'].'</ b> is not appropriate for the content mistyped text message. <hr /> ';
)
if ($ config [ 'dotpay_active_transfer'])
(
$ main_content .= '<h2> transfer / credit card </ h2> Buy premium points, you can replace them in the shop for OTSa Paccani / items in the game to buy premium items go to one of the addresses and fill out the form:';
foreach ($ config [ 'dotpay'] as $ transfer)
if ($ transfer [ 'type'] == 'C1')
$ main_content .= '<br /> <b> Address * - <a href = "https: / / ssl.allpay.pl /? id ='. $ transfer [ 'id'].'& code ='. $ transfer [ 'code'].'">< font color = "red"> https: / / ssl.allpay.pl /? id ='. $ transfer [ 'id'].'& code ='. $ transfer [ 'code '].'</ font> </ a> - <font color="red"> expense <b> '. $ transfer [' sms_cost'].'</ b> </ font>, and get the code for the < font color = "red"> <b> '. $ transfer [' addpoints'].'</ b> </ font> points premium. </ b> ';
$ main_content .= 'When will your bank transfer (with credit cards and Internet banks in the list is a matter of seconds) to e-mail address you provided on the form you will receive the code. This can replace the code on that page points to the premium in the form below. <hr /> ';
)
$ main_content .= '<form action="index.php?subtopic=buypoints&system=dotpay" method="POST"> <table>';
$ main_content .= '<tr> <td> Nick <b> form or account number: </ b> </ td> <td> <input type = "text" size = "20" value ="'.$ to_user . ' "name =" to_user "/> </ td> </ tr>
<tr> <td> <b> code SMS: </ b> </ td <td> <input type = "text" size = "20" value ="'.$ posted_code. ' "name =" code " /> </ td> </ tr> <tr> <td> <b> sent SMS Type: </ b> </ td> <td> <select name="sms_type"> ';
foreach ($ config [ 'dotpay'] as $ id => $ sms)
if ($ text [ 'type'] == 'sms')
$ main_content .= '<option value="'.$id.'"> number'. $ sms [ 'sms_number']. " - Code '. $ Sms [' sms_text ']. " - SMS for '. $ Sms [' sms_cost'].'</ option> ';
elseif ($ transfer [ 'type'] == 'C1')
$ main_content .= '<option value="'.$id.'"> transfer - code'. $ sms [ 'sms_text']. " - For '. $ Sms [' sms_cost'].'</ option> ';
$ main_content .= '</ select> </ td> </ tr>';
if ($ config [ 'site'] [ 'verify_code_shop'] == 'yes')
$ main_content .= '<tr> <td> <B> Verification code: </ B> </ td> <td> <img src = "imgverification / imagebuilder.php? image_refresher ='. mt_rand (1.99999). ' "border =" 0 "alt =""></ td> </ tr>
<tr> <td> <B> Enter the verification 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="Sprawdz" /> </ td> </ tr> </ table> </ form>';
)
else
(
if ($ config [ 'dotpay_active'])
$ main_content .= '<br /> <br /> <a href="index.php?subtopic=buypoints&system=dotpay"> <h2> For users from Poland - LINK </ h2> </ a> <h3> Pay SMS, credit card or bank transfer. </ h3> ';
if ($ config [ 'daopay_active'])
$ main_content .= '<br /> <br /> <a href="index.php?subtopic=buypoints&system=daopay"> <h2> For all users - LINK </ h2> </ a> <h3> Send SMS (not for all countries) or call special number to donate and get points. </ h3> ';
)
>