JustPaste.it

<?php

/*
English:
This script will help you to integrate the PayGol payments platform on your Open Tibia server. Your users will be able to pay and get in-game points immediately and automatically, no need to wait hours or even days for manual delivery.
Before starting, you must create an account at https://secure.paygol.com/signup
For full technical documentation, visit https://devs.paygol.com/en

Steps:
1) Upload this file to your server, try to make it a hard to guess path.
2) Enter the full path to this file into the "IPN URL" field, at the "Notifications" section of your Paygol dashboard.
Example: http://www.yoursite.com/dtz7895/paygol.php


Español:
Este código te ayudará a integrar la plataforma de pagos PayGol en tu servidor Open Tibia. Tus usuarios podrán pagar y obtener sus puntos de inmediato y de forma automática, sin necesidad de esperar horas o hasta días por una entrega manual.
Antes de comenzar, debes crear una cuenta en https://secure.paygol.com/signup
Para ver documentacion técnica adicional visita https://devs.paygol.com/es

Pasos:
1) Sube este archivo a tu servidor, intenta que sea una ruta difícil de adivinar.
2) Ingresa la ruta completa de este archivo en el campo "URL de IPN", en la sección "Notificaciones" de tu panel de Paygol.
Ejemplo: http://www.yoursite.com/dtz7895/paygol.php
*/


// Secret Key of your Paygol account
$secret_key = "dfd2974a-7703-11e7-91b6-128b57940774";

// Secret key validation
if ($secret_key != $_GET['key']) {
echo "Validation error";
exit;
}

// Custom parameter
$custom = $_GET['custom'];

// Get price and currency. Price always has a decimal point and 2 decimals (e.g. 10.00 EUR, 9000.00 CLP).
$frmprice = $_GET['frmprice'];
$frmcurrency = $_GET['frmcurrency'];

// Get points based on the price and currency.
switch ($frmprice." ".$frmcurrency){

// Possible prices and their points. You can add as many as you want.
case "5.00 EUR": $points = yy; break;
case "10.00 EUR": $points = yy; break;
case "20.00 EUR": $points = yy; break;

// If the price doesn't match any of the options above, stop script.
default: echo "Price validation failed";
exit;

}

// Replace this information with your database details
$dbhost = "127.0.0.1"; //Your database domain
$dbuser = "root"; //Database username
$dbpassword = "mypassword"; //Database password
$db = "mydb"; //Database name

//Connect to Database
$conn = mysql_connect($dbhost, $dbuser, $dbpassword);
mysql_select_db($db);
$sql = "UPDATE accounts SET premium_points = premium_points+$points WHERE name = '$custom'";
mysql_query($sql);
mysql_close($conn);
?>