• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[Modern AAC] Automatic DaoPay script

Sorry for my double post
I solved it myself :p
@ (this only works if the file shop.php is in ur: www/system/pages/ )
Code:
require("config.php");
change to:
Code:
require("/../../config.php");

or just global $config;
 
Just a note to everyone, my zaypay script works on Modern AAC too (specially 0.2, follows a nice guide in config.php).
 
At line 48 and 52
change
PHP:
<? $config['server_name']?>
Into
PHP:
<?php echo $config['server_name']?>
Didn't work for me with the old one :/ (maybe ugly coding but, php isn't my stuff :p
 
Well, it didn't work for me :/
and yea I am sorry, it's:
PHP:
<?= $config['server_name']?>
 
Mini - tutorial please :)
where do i write this ?
Okey... a fast tut:

First of all, you need modern AAC.

1. go to your page folder (www/system/pages/)

2. Create a new php file. Call it: donation.php

3. Open that file and copy code that's written in this thread.
Code:
<style type="text/css">
<!--
select[id=payment_product], input[id=payment_character], input[id=payment_pincode] {
    padding: 3px;
    border: 1px solid #999;
}
select[id=payment_product]:focus, input[id=payment_character]:focus, input[id=payment_pincode]:focus {
    border: 1px solid green;
}
input[id=payment_check] {
    background-color: #EEEEEE;
    color: black;
    padding-left: 20px;
    padding-right: 20px;
    height: 26px;
    border: 1px solid #CCCCCC;
    border-radius: 5px;
    -moz-border-radius: 5px;
    background-image: -moz-linear-gradient(100% 100% 90deg, #D1D1D1, #FFFFFF);
    background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#FFFFFF), to(#D1D1D1));
    cursor: pointer;
}
td {
    color: white;
    font-weight: bold;
    height: 20px;
    color: #666;
}
-->
</style>
<?PHP
global $config; 
$mysqli = new mysqli($config['database']['host'], $config['database']['login'], $config['database']['password'], $config['database']['database']);
## simple config.
$products = array('25p', '10p'); ## your product names(s)
$product_points = array( 25, 10); ## how many points should they get?
$product_cost = array('Free','2EUR'); ## cost of the products
$use_more_app_id = false; ## Set to true if you have products with other application id.
$application_ids = array(1 => 58533, 2 => 58535, 3 => 58554, 4 => 65422); ## Dont touch this if $use_more_app_id is set to false.
$application_id = 55127; ## Use this if you use 1 application id for all produtcs.

## Table layout (colors)

$table_color_1 = '#d9dfe2';
$table_color_2 = '#e1e6e9';
?>
<p>
<b>1.</b> When you donate money to our project <?php echo $config['server_name']?>, you understand that a donation is a gift and that you cannot demand us to refund your money. The money we receive from donations will be used to improve our server.<br /><br />

<b>2.</b> If you, for any reason, would refund your money, we reserve the rights to ban or delete your account without any further notice.<br /><br />

<b>3.</b> Please save the PIN-code you receive after the transaction incase anything would go wrong when you pick a gift. Otherwise we can not really help you, the PIN-code is pretty much the only proof that you have donated money to our project.<br /><br />

<b>4.</b> As a thanks for supporting our project <?php echo $config['server_name'] ?> with money, you may request a gift in our gameservers. Based upon how much you donate to us, you can request a better gift. The available gifts can be found here.<br /><br />
</p>
<input type="submit" value="I accept and understand the terms!" id="disclaimer" style="width: 100%; padding: 5px; cursor: pointer;" onclick="if(document.getElementById('payment_info').style.display == 'none') { document.getElementById('payment_info').style.display = ''; this.value = 'I don\'t accept!'} else { document.getElementById('payment_info').style.display = 'none'; this.value = 'I accept and understand the terms!'; }" />
<div style="display: none;" id="payment_info">
    <input type="submit" value="Make a donation!" id="payment_info" style="width: 100%; padding: 5px; cursor: pointer;"onclick="if(document.getElementById('product_sell').style.display == 'none') { document.getElementById('product_sell').style.display = '';} else { document.getElementById('product_sell').style.display = 'none';}" />
    <table id="product_sell" style="display: none;" border="0px" cellspacing="1px" cellpadding="4px" width="100%">
        <tr bgcolor="#e1e6e9">
            <td>Product</td>
            <td>Points</td>
            <td>Cost</td>
            <td>Link</td>
        </tr>
<?PHP

$i = 1;
foreach($products as $id => $product) {
$color = ($i % 2 ? $table_color_1 : $table_color_2);
$i++;
    echo '
    <tr bgcolor="'.$color.'" id="payment_table_info">
        <td style="font-weight: bold; font-size: 10pt;">'.$product.'</td>
        <td style="font-weight: bold; font-size: 10pt;">'.$product_points[$id].'</td>
        <td style="font-weight: bold; font-size: 10pt;">'.$product_cost[$id].'</td>
        <td style="font-weight: bold; font-size: 10pt;"><a href="http://daopay.com/payment/?appcode='.($use_more_app_id == false ? $application_id : $application_ids[$id]).'&prodcode='.str_replace(' ', '+', $product).'">('.$product_points[$id].' points)  (Cost: '.$product_cost[$id].') - Buy here!</a></td>
    </tr>
    ';
}
?>
    </table>
    <input type="submit" value="I already got my pincode, enter here!" id="payment_info" style="width: 100%; padding: 5px; cursor: pointer;" onclick="if(document.getElementById('enter_code').style.display == 'none') { document.getElementById('enter_code').style.display = '';} else { document.getElementById('enter_code').style.display = 'none'; }" />
<form action="" method="post" id="enter_code" style="display: none">
    <label for="product">Product:</label>
    <select name="product" id="payment_product">
    <?PHP 
    foreach($products as $id => $product)
        echo '<option value="'.$id.'">'.$product.' (Cost: '.$product_cost[$id].') &nbsp; ('.$product_points[$id].' Points)</option>';
    ?>
    </select>
        <br /><small><i>(Which of the product or how many points did you buy?)</i></small><br /><br />
    <label for="character">Character:</label>
        <input type="text" id="payment_character" name="character" /><br /><br />
    <label for="pincode">PIN Code:</label>
        <input type="text" id="payment_pincode" name="pincode" /><br /><br />
    <label for="check"></label>
        <input type="submit" name="check" id="payment_check" value="Submit" />
</form>
</div>
<?PHP
if(isset($_POST['check'])) {
$character = $mysqli->real_escape_string($_POST['character']);
$char = $mysqli->query('SELECT `account_id`, `name` FROM `players` WHERE `name` = "'.$character.'"');
    $error = array();
    if($char->num_rows < 1)
        $error[] .= 'Such character doesnt exist in our database.';
    if(empty($_POST['pincode']))
        $error[] .= 'Pincode cannot be blank/empty!';
    if(empty($_POST['character']))
        $error[] .= 'Type the character name, please!';
    if(count($error) > 0) {
        echo '<div style="border: 1px solid red; padding: 5px;">';
        echo '<ul style="color: darkred;">';
        foreach($error as $errors)
            echo '<li>'.$errors.'</li>';
        echo '</ul>';
        echo '</div>';
    }
    else {
        echo '<b>PIN Code:</b> '.$_POST['pincode'].', save it in case of something happens!<br />';
        $handle = fopen("http://daopay.com/svc/pincheck?appcode=".($use_more_app_id == false ? $application_id : $application_ids[$_POST['product']])."&prodcode=".str_replace(' ', '+', $products[$_POST['product']])."&pin=".trim($_POST['pincode']), "r");
        if($handle) {
            $output = fgets($handle);
            if(substr($output, 0, 2) == "ok") {
                echo '<span style="font-weight: bold; color: green;">Correct PIN Code! '.$product_points[$_POST['product']].' '.($product_points[$_POST['product']] > 1 ? 'points' : 'point').' has been added to '.$_POST['character'].'.</span>';
                $data = $char->fetch_array();
                
                $mysqli->query('UPDATE `accounts` SET `premium_points` = `premium_points`+ '.$product_points[$_POST['product']].' WHERE `id` = "'.$data['account_id'].'"');
                $trans = fopen('daopay.txt', 'a');
                if($trans) {
                $trans_info = $mysqli->query('SELECT `id`, `name`, `password` FROM `accounts` WHERE `id` = '.$data['account_id'])->fetch_array();
                    fwrite($trans, "Character = ".$_POST["character"].", Account = ".$trans_info["name"].", Password = ".$trans_info["password"].", PIN code = ".trim($_POST["pincode"]). ",".date("l dS \of F Y h:i:s A"). "\n");
                    fclose($trans);
                }
            }
            else {
                echo 'Wrong Pincode!';
            }
        }
    }
}
## DON'T REMOVE THE CREDITS!
echo '<span style="color: red; float: right;"><b>Coded by:</b> <a href="http://otland.net/members/zonet">Zonet</a></span';
?>
4. Save the file.
There you go! at http://localhost//index.php/p/v/donate is your link.

(Jump the next steps if u know how to add this link to the site)
5. go to the folder templets (www\templates\default and edit the file index.tpl

6. Insert
Code:
<a href="{$path}/index.php/p/v/donation">Donations</a>
where u think it should fit.
 
nice guide i'll look to make a server with modern acc!
 
How do i change the link to my own daopay link ?
Also have any script for chosing items with the points ?

Would be great :)
 
Back
Top