• 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!

Windows Znote AAC PAYGOL

Leyla Cullin

Honey
Joined
Jul 13, 2015
Messages
36
Reaction score
1
Location
Germany
Hey at all,

I want to use PayGol SMS and i created a multiprice service at PayGol. While testing I notice that the player gets redirected to the success-page but would not get the points. Also there is no entry of any paygol-donation I can find in my database.

I tried several codes and ideas from otland I found but nothing did work. I just set the codes back to default.

buypoints.php
PHP:
<?php require_once 'engine/init.php';
protect_page();
include 'layout/overall/header.php';

// Import from config:
$paypal = $config['paypal'];
$prices = $config['paypal_prices'];

if ($paypal['enabled']) {
?>

<h1>Buy Points</h1>
<h2>Buy points using Paypal:</h2>
<table id="buypointsTable" class="table table-striped table-hover">
    <tr class="yellow">
        <th>Price:</th>
        <th>Points:</th>
        <?php if ($paypal['showBonus']) { ?>
            <th>Bonus:</th>
        <?php } ?>
        <th>Action:</th>
    </tr>
        <?php
        foreach ($prices as $price => $points) {
        echo '<tr class="special">';
        echo '<td>'. $price .'('. $paypal['currency'] .')</td>';
        echo '<td>'. $points .'</td>';
        if ($paypal['showBonus']) echo '<td>'. calculate_discount(($paypal['points_per_currency'] * $price), $points) .' bonus</td>';
        ?>
        <td>
            <form action="https://www.paypal.com/cgi-bin/webscr" method="POST">
                <input type="hidden" name="cmd" value="_xclick">
                <input type="hidden" name="business" value="<?php echo $paypal['email']; ?>">
                <input type="hidden" name="item_name" value="<?php echo $points .' shop points on '. $config['site_title']; ?>">
                <input type="hidden" name="item_number" value="1">
                <input type="hidden" name="amount" value="<?php echo $price; ?>">
                <input type="hidden" name="no_shipping" value="1">
                <input type="hidden" name="no_note" value="1">
                <input type="hidden" name="currency_code" value="<?php echo $paypal['currency']; ?>">
                <input type="hidden" name="lc" value="GB">
                <input type="hidden" name="bn" value="PP-BuyNowBF">
                <input type="hidden" name="return" value="<?php echo $paypal['success']; ?>">
                <input type="hidden" name="cancel_return" value="<?php echo $paypal['failed']; ?>">
                <input type="hidden" name="rm" value="2">
                <input type="hidden" name="notify_url" value="<?php echo $paypal['ipn']; ?>" />
                <input type="hidden" name="custom" value="<?php echo (int)$session_user_id; ?>">
                <input type="submit" value="  PURCHASE  ">
            </form>
        </td>
        <?php
        echo '</tr>';
        }
        ?>
</table>
<?php } ?>

<?php
if ($config['paygol']['enabled'] == true) {
?>
<!-- PayGol Form using Post method -->
<h2>Buy points using Paygol:</h2>
<?php $paygol = $config['paygol']; ?>
<p><?php echo " Pay ". $paygol['price'] ." ". $paygol['currency'] ." for ". $paygol['points'] ." points:"; ?></p>
<form name="pg_frm" method="post" action="http://www.paygol.com/micropayment/paynow" >
    <input type="hidden" name="pg_serviceid" value="<?php echo $paygol['serviceID']; ?>">
    <input type="hidden" name="pg_currency" value="<?php echo $paygol['currency']; ?>">
    <input type="hidden" name="pg_name" value="<?php echo $paygol['name']; ?>">
    <input type="hidden" name="pg_custom" value="<?php echo $session_user_id; ?>">
    <input type="hidden" name="pg_price" value="<?php echo $paygol['price']; ?>">
    <input type="hidden" name="pg_return_url" value="<?php echo $paygol['returnURL']; ?>">
    <input type="hidden" name="pg_cancel_url" value="<?php echo $paygol['cancelURL']; ?>">
    <input type="image" name="pg_button" src="http://www.paygol.com/micropayment/img/buttons/150/black_en_pbm.png" border="0" alt="Make payments with PayGol: the easiest way!" title="Make payments with PayGol: the easiest way!">
</form>
<?php }

if (!$config['paypal']['enabled'] && !$config['paygol']['enabled']) echo '<h1>Buy Points system disabled.</h1><p>Sorry, this functionality is disabled.</p>';
include 'layout/overall/footer.php'; ?>

paygol_ipn.php
PHP:
<?php
require 'config.php';
require 'engine/database/connect.php';

// check that the request comes from PayGol server
if(!in_array($_SERVER['REMOTE_ADDR'],
  array('109.70.3.48', '109.70.3.146', '109.70.3.210'))) {
  header("HTTP/1.0 403 Forbidden");
  die("Error: Unknown IP");
}

// get the variables from PayGol system
$message_id    = getValue($_GET['message_id']);
$service_id    = getValue($_GET['service_id']);
$shortcode    = getValue($_GET['shortcode']);
$keyword    = getValue($_GET['keyword']);
$message    = getValue($_GET['message']);
$sender     = getValue($_GET['sender']);
$operator    = getValue($_GET['operator']);
$country    = getValue($_GET['country']);
$custom     = getValue($_GET['custom']);
$points     = getValue($_GET['points']);
$price     = getValue($_GET['price']);
$currency    = getValue($_GET['currency']);

$paygol = $config['paygol'];
$new_points = $paygol['points'];

// Update logs:
mysql_insert("INSERT INTO `znote_paygol` VALUES ('', '$custom', '$price', '$new_points', '$message_id', '$service_id', '$shortcode', '$keyword', '$message', '$sender', '$operator', '$country', '$currency')");

// Fetch points
$account = mysql_select_single("SELECT `points` FROM `znote_accounts` WHERE `account_id`='$custom';");
// Calculate new points
$new_points = $account['points'] + $new_points;
// Update new points
mysql_update("UPDATE `znote_accounts` SET `points`='$new_points' WHERE `account_id`='$custom'");
?>

Thanks for any help and feel loved by me,
Leyla Cullin
 
Hey at all,

I want to use PayGol SMS and i created a multiprice service at PayGol. While testing I notice that the player gets redirected to the success-page but would not get the points. Also there is no entry of any paygol-donation I can find in my database.

I tried several codes and ideas from otland I found but nothing did work. I just set the codes back to default.

buypoints.php
PHP:
<?php require_once 'engine/init.php';
protect_page();
include 'layout/overall/header.php';

// Import from config:
$paypal = $config['paypal'];
$prices = $config['paypal_prices'];

if ($paypal['enabled']) {
?>

<h1>Buy Points</h1>
<h2>Buy points using Paypal:</h2>
<table id="buypointsTable" class="table table-striped table-hover">
    <tr class="yellow">
        <th>Price:</th>
        <th>Points:</th>
        <?php if ($paypal['showBonus']) { ?>
            <th>Bonus:</th>
        <?php } ?>
        <th>Action:</th>
    </tr>
        <?php
        foreach ($prices as $price => $points) {
        echo '<tr class="special">';
        echo '<td>'. $price .'('. $paypal['currency'] .')</td>';
        echo '<td>'. $points .'</td>';
        if ($paypal['showBonus']) echo '<td>'. calculate_discount(($paypal['points_per_currency'] * $price), $points) .' bonus</td>';
        ?>
        <td>
            <form action="https://www.paypal.com/cgi-bin/webscr" method="POST">
                <input type="hidden" name="cmd" value="_xclick">
                <input type="hidden" name="business" value="<?php echo $paypal['email']; ?>">
                <input type="hidden" name="item_name" value="<?php echo $points .' shop points on '. $config['site_title']; ?>">
                <input type="hidden" name="item_number" value="1">
                <input type="hidden" name="amount" value="<?php echo $price; ?>">
                <input type="hidden" name="no_shipping" value="1">
                <input type="hidden" name="no_note" value="1">
                <input type="hidden" name="currency_code" value="<?php echo $paypal['currency']; ?>">
                <input type="hidden" name="lc" value="GB">
                <input type="hidden" name="bn" value="PP-BuyNowBF">
                <input type="hidden" name="return" value="<?php echo $paypal['success']; ?>">
                <input type="hidden" name="cancel_return" value="<?php echo $paypal['failed']; ?>">
                <input type="hidden" name="rm" value="2">
                <input type="hidden" name="notify_url" value="<?php echo $paypal['ipn']; ?>" />
                <input type="hidden" name="custom" value="<?php echo (int)$session_user_id; ?>">
                <input type="submit" value="  PURCHASE  ">
            </form>
        </td>
        <?php
        echo '</tr>';
        }
        ?>
</table>
<?php } ?>

<?php
if ($config['paygol']['enabled'] == true) {
?>
<!-- PayGol Form using Post method -->
<h2>Buy points using Paygol:</h2>
<?php $paygol = $config['paygol']; ?>
<p><?php echo " Pay ". $paygol['price'] ." ". $paygol['currency'] ." for ". $paygol['points'] ." points:"; ?></p>
<form name="pg_frm" method="post" action="http://www.paygol.com/micropayment/paynow" >
    <input type="hidden" name="pg_serviceid" value="<?php echo $paygol['serviceID']; ?>">
    <input type="hidden" name="pg_currency" value="<?php echo $paygol['currency']; ?>">
    <input type="hidden" name="pg_name" value="<?php echo $paygol['name']; ?>">
    <input type="hidden" name="pg_custom" value="<?php echo $session_user_id; ?>">
    <input type="hidden" name="pg_price" value="<?php echo $paygol['price']; ?>">
    <input type="hidden" name="pg_return_url" value="<?php echo $paygol['returnURL']; ?>">
    <input type="hidden" name="pg_cancel_url" value="<?php echo $paygol['cancelURL']; ?>">
    <input type="image" name="pg_button" src="http://www.paygol.com/micropayment/img/buttons/150/black_en_pbm.png" border="0" alt="Make payments with PayGol: the easiest way!" title="Make payments with PayGol: the easiest way!">
</form>
<?php }

if (!$config['paypal']['enabled'] && !$config['paygol']['enabled']) echo '<h1>Buy Points system disabled.</h1><p>Sorry, this functionality is disabled.</p>';
include 'layout/overall/footer.php'; ?>

paygol_ipn.php
PHP:
<?php
require 'config.php';
require 'engine/database/connect.php';

// check that the request comes from PayGol server
if(!in_array($_SERVER['REMOTE_ADDR'],
  array('109.70.3.48', '109.70.3.146', '109.70.3.210'))) {
  header("HTTP/1.0 403 Forbidden");
  die("Error: Unknown IP");
}

// get the variables from PayGol system
$message_id    = getValue($_GET['message_id']);
$service_id    = getValue($_GET['service_id']);
$shortcode    = getValue($_GET['shortcode']);
$keyword    = getValue($_GET['keyword']);
$message    = getValue($_GET['message']);
$sender     = getValue($_GET['sender']);
$operator    = getValue($_GET['operator']);
$country    = getValue($_GET['country']);
$custom     = getValue($_GET['custom']);
$points     = getValue($_GET['points']);
$price     = getValue($_GET['price']);
$currency    = getValue($_GET['currency']);

$paygol = $config['paygol'];
$new_points = $paygol['points'];

// Update logs:
mysql_insert("INSERT INTO `znote_paygol` VALUES ('', '$custom', '$price', '$new_points', '$message_id', '$service_id', '$shortcode', '$keyword', '$message', '$sender', '$operator', '$country', '$currency')");

// Fetch points
$account = mysql_select_single("SELECT `points` FROM `znote_accounts` WHERE `account_id`='$custom';");
// Calculate new points
$new_points = $account['points'] + $new_points;
// Update new points
mysql_update("UPDATE `znote_accounts` SET `points`='$new_points' WHERE `account_id`='$custom'");
?>

Thanks for any help and feel loved by me,
Leyla Cullin
The old version on ZnoteAAC is bugged (the one you're using), as you can see, the file doesn't include "getValue" function.
It's also possible to abuse the old file (the one you're using) by sending 'fake msgs', because the file doesn't check if the service is yours or not.

Use the latest version on github instead: https://github.com/Znote/ZnoteAAC/blob/master/paygol_ipn.php
 
I tried that already. It does not work for me. I tried it again now... It does not work for me again.

paygol_ipn.php
PHP:
<?php
require 'config.php';
require 'engine/database/connect.php';
// check that the request comes from PayGol server
if(!in_array($_SERVER['REMOTE_ADDR'],
    array('109.70.3.48', '109.70.3.146', '109.70.3.210'))) {
    header("HTTP/1.0 403 Forbidden");
    die("Error: Unknown IP");
}
// Fetch and sanitize POST and GET values
function getValue($value) {
    return (!empty($value)) ? sanitize($value) : false;
}
function sanitize($data) {
    return htmlentities(strip_tags(mysql_znote_escape_string($data)));
}
// get the variables from PayGol system
$message_id    = getValue($_GET['message_id']);
$service_id    = getValue($_GET['service_id']);
$shortcode    = getValue($_GET['shortcode']);
$keyword    = getValue($_GET['keyword']);
$message    = getValue($_GET['message']);
$sender     = getValue($_GET['sender']);
$operator    = getValue($_GET['operator']);
$country    = getValue($_GET['country']);
$custom     = getValue($_GET['custom']);
$points     = getValue($_GET['points']);
$price     = getValue($_GET['price']);
$currency    = getValue($_GET['currency']);
// config paygol settings
$paygol = $config['paygol'];
// Check if request serviceID is the same as it is in config
if($service_id != $paygol['serviceID']) {
    header("HTTP/1.0 403 Forbidden");
    die("Error: serviceID does not match.");
}
$new_points = $paygol['points'];
// Update logs:
mysql_insert("INSERT INTO `znote_paygol` VALUES ('', '$custom', '$price', '$new_points', '$message_id', '$service_id', '$shortcode', '$keyword', '$message', '$sender', '$operator', '$country', '$currency')");
// Fetch points
$account = mysql_select_single("SELECT `points` FROM `znote_accounts` WHERE `account_id`='$custom';");
// Calculate new points
$new_points = $account['points'] + $new_points;
// Update new points
mysql_update("UPDATE `znote_accounts` SET `points`='$new_points' WHERE `account_id`='$custom'");
?>

config.php (PayGol Part)
PHP:
    //////////////////
    /// PAYGOL SMS ///
    //////////////////
    // !!! Paygol takes 60%~ of the money, and send aprox 40% to your paypal.
    // You can configure paygol to send each month, then they will send money
    // to you 1 month after recieving 50+ eur.
    $config['paygol'] = array(
        'enabled' => true,
        'serviceID' => 339051,// Service ID from paygol.com
        'currency' => 'EUR',
        'price' => 4.99,
        'points' => 25, // Remember to write same details in paygol.com!
        'name' => '25 WOC-Points',
        'returnURL' => "http://".$_SERVER['HTTP_HOST']."/success.php",
        'cancelURL' => "http://".$_SERVER['HTTP_HOST']."/failed.php"
    );

buypoints.php
PHP:
<?php require_once 'engine/init.php';
protect_page();
include 'layout/overall/header.php';

// Import from config:
$paypal = $config['paypal'];
$prices = $config['paypal_prices'];

if ($paypal['enabled']) {
?>

<h1>Buy Points</h1>
<h2>Buy points using Paypal:</h2>
<table id="buypointsTable" class="table table-striped table-hover">
    <tr class="yellow">
        <th>Price:</th>
        <th>Points:</th>
        <?php if ($paypal['showBonus']) { ?>
            <th>Bonus:</th>
        <?php } ?>
        <th>Action:</th>
    </tr>
        <?php
        foreach ($prices as $price => $points) {
        echo '<tr class="special">';
        echo '<td>'. $price .'('. $paypal['currency'] .')</td>';
        echo '<td>'. $points .'</td>';
        if ($paypal['showBonus']) echo '<td>'. calculate_discount(($paypal['points_per_currency'] * $price), $points) .' bonus</td>';
        ?>
        <td>
            <form action="https://www.paypal.com/cgi-bin/webscr" method="POST">
                <input type="hidden" name="cmd" value="_xclick">
                <input type="hidden" name="business" value="<?php echo $paypal['email']; ?>">
                <input type="hidden" name="item_name" value="<?php echo $points .' shop points on '. $config['site_title']; ?>">
                <input type="hidden" name="item_number" value="1">
                <input type="hidden" name="amount" value="<?php echo $price; ?>">
                <input type="hidden" name="no_shipping" value="1">
                <input type="hidden" name="no_note" value="1">
                <input type="hidden" name="currency_code" value="<?php echo $paypal['currency']; ?>">
                <input type="hidden" name="lc" value="GB">
                <input type="hidden" name="bn" value="PP-BuyNowBF">
                <input type="hidden" name="return" value="<?php echo $paypal['success']; ?>">
                <input type="hidden" name="cancel_return" value="<?php echo $paypal['failed']; ?>">
                <input type="hidden" name="rm" value="2">
                <input type="hidden" name="notify_url" value="<?php echo $paypal['ipn']; ?>" />
                <input type="hidden" name="custom" value="<?php echo (int)$session_user_id; ?>">
                <input type="submit" value="  PURCHASE  ">
            </form>
        </td>
        <?php
        echo '</tr>';
        }
        ?>
</table>
<?php } ?>

<?php
if ($config['paygol']['enabled'] == true) {
?>
<!-- PayGol Form using Post method -->
<h2>Buy points using Paygol:</h2>
<?php $paygol = $config['paygol']; ?>
<p><?php echo " Pay ". $paygol['price'] ." ". $paygol['currency'] ." for ". $paygol['points'] ." points:"; ?></p>
<form name="pg_frm" method="post" action="http://www.paygol.com/micropayment/paynow" >
    <input type="hidden" name="pg_serviceid" value="<?php echo $paygol['serviceID']; ?>">
    <input type="hidden" name="pg_currency" value="<?php echo $paygol['currency']; ?>">
    <input type="hidden" name="pg_name" value="<?php echo $paygol['name']; ?>">
    <input type="hidden" name="pg_custom" value="<?php echo $session_user_id; ?>">
    <input type="hidden" name="pg_price" value="<?php echo $paygol['price']; ?>">
    <input type="hidden" name="pg_return_url" value="<?php echo $paygol['returnURL']; ?>">
    <input type="hidden" name="pg_cancel_url" value="<?php echo $paygol['cancelURL']; ?>">
    <input type="image" name="pg_button" src="http://www.paygol.com/micropayment/img/buttons/150/black_en_pbm.png" border="0" alt="Make payments with PayGol: the easiest way!" title="Make payments with PayGol: the easiest way!">
</form>
<?php }

if (!$config['paypal']['enabled'] && !$config['paygol']['enabled']) echo '<h1>Buy Points system disabled.</h1><p>Sorry, this functionality is disabled.</p>';
include 'layout/overall/footer.php'; ?>

There has to me something I do wrong. But what is it? Do I miss something?

Is it right to put in mywebsite.eu/paygol_ipn.php at the IPN Website settings of the PayGol Service?

Feel loved by me,
Leyla Cullin
 
Last edited:
I tried that already. It does not work for me. I tried it again now... It does not work for me again.

There has to me something I do wrong. But what is it? Do I miss something?

Is it right to put in mywebsite.eu/paygol_ipn.php at the IPN Website settings of the PayGol Service?

Feel loved by me,
Leyla Cullin
So, you don't receive your points, but you're able to test the service?

At paygol site, do you have these settings correct?
The same you have on config.php

1. enable testing mode
2. check if your ID on your paygol service is the same as it is at config.php. (it has to be)
IMxytIs.png


3. Click on that little pen on the right, to check your IPN address.
TzcshUK.png


If that file name doesn't match the one you have (address/paygol_ipn.php), then it won't work.
 
It does not work for me :(
PHP:
    //////////////////
    /// PAYGOL SMS ///
    //////////////////
    // !!! Paygol takes 60%~ of the money, and send aprox 40% to your paypal.
    // You can configure paygol to send each month, then they will send money
    // to you 1 month after recieving 50+ eur.
    $config['paygol'] = array(
        'enabled' => true,
        'serviceID' => 339237,// Service ID from paygol.com
        'currency' => 'EUR',
        'price' => 4.99,
        'points' => 25, // Remember to write same details in paygol.com!
        'name' => '25 WOC Points',
        'returnURL' => "http://".$_SERVER['HTTP_HOST']."/success.php",
        'cancelURL' => "http://".$_SERVER['HTTP_HOST']."/failed.php"
    );

psut1oqixtmp.png


Thank you very much for your help :(
 
It does not work for me :(
PHP:
    //////////////////
    /// PAYGOL SMS ///
    //////////////////
    // !!! Paygol takes 60%~ of the money, and send aprox 40% to your paypal.
    // You can configure paygol to send each month, then they will send money
    // to you 1 month after recieving 50+ eur.
    $config['paygol'] = array(
        'enabled' => true,
        'serviceID' => 339237,// Service ID from paygol.com
        'currency' => 'EUR',
        'price' => 4.99,
        'points' => 25, // Remember to write same details in paygol.com!
        'name' => '25 WOC Points',
        'returnURL' => "http://".$_SERVER['HTTP_HOST']."/success.php",
        'cancelURL' => "http://".$_SERVER['HTTP_HOST']."/failed.php"
    );

psut1oqixtmp.png


Thank you very much for your help :(
Ops, sorry I had made a typo.
Try to debug it with this one instead http://hastebin.com/zimoheyeno.php
 
It does not work... But I think you had a good Idea for finding the Problem with the Error-Log.
The Error-Log says "Adding points." and when I am right this means, that the IPN-Function works and the problem is the code of editing the Database, right?

But where is the problem... I compared the znote_ tables and they are correct. This is the only thing I know.

Feel loved by me, Leyla.
 
It does not work... But I think you had a good Idea for finding the Problem with the Error-Log.
The Error-Log says "Adding points." and when I am right this means, that the IPN-Function works and the problem is the code of editing the Database, right?

But where is the problem... I compared the znote_ tables and they are correct. This is the only thing I know.

Feel loved by me, Leyla.
Yes, you're right, the problem very lies somewhere there, so let's try to debug it further.
This necessarily isn't related, but what TFS version are you using?

Try with this file now, : http://hastebin.com/opozimuroy.php (added more error_log() messages)
 
Hello,

in the Log-File says "Logs: accname:2, newpoints:25". Maybe it searches for the accountname "2" (Acc ID) instead of the real accountname?

EDIT: Sorry, I took a look in my database and noticed that znote_accounts does not have any accountname. If "accname" = "account_id" in znote_accounts then this is also true. The account_id of the testuser is 2.

Thank you very much :)!
 
Last edited:
Back
Top