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

donate points not added automatically

lbakiller

New Member
Joined
Aug 27, 2009
Messages
90
Reaction score
1
Location
The Netherlands
my donation system doesn't add donation points automatically :S
paypal is used.

Ipn is enabled.

config.php
PHP:
<?php

$config['donations']['methods'] = array('ContenidoPago' => false, 'PayPal' => true);

$config['donations']['paypal'] = array('Mail' => 'xxx, 'Points' => 10, 'Product' => 'Donation Items', 'Money' => 'EUR', 'Amount' => 5);

$config1['donations']['paypal'] = array('Mail' => 'xxx', 'Points' => 25, 'Product' => 'Donation Items', 'Money' => 'EUR', 'Amount' => 12);

$config2['donations']['paypal'] = array('Mail' => 'xxx', 'Points' => 33, 'Product' => 'Donation Items', 'Money' => 'EUR', 'Amount' => 16);

$config3['donations']['paypal'] = array('Mail' => 'xxx, 'Points' => 55, 'Product' => 'Donation Items', 'Money' => 'EUR', 'Amount' => 25);

$config4['donations']['paypal'] = array('Mail' => 'xxx, 'Points' => 80, 'Product' => 'Donation Items', 'Money' => 'EUR', 'Amount' => 35);

$config['donations']['contenidopago'] = array('Product' => '1347', 'Points' => 4);

?>

xxx= replaced with my e-mail in real script,

functions.php
PHP:
<?php

	class shop {
		function connect() {
			$ots = POT::getInstance();
			$ots->connect(POT::DB_MYSQL, connection());
		return $ots->getDBHandle();
		}
		
		function isInstalled() {
		require('config.php');
			$con = mysql_connect($config['database']['host'], $config['database']['login'], $config['database']['password']);
			mysql_select_db($config['database']['database'],$con);
			if(mysql_query("SELECT * FROM shop_offer,shop_history"))
				return true;
			else
				return false;
		}
		
		function points($account) {
			$SQL = $this->connect();
			$points = $SQL->query('SELECT premium_points FROM accounts WHERE name = "'.$account.'"')->fetch();
			return $points['premium_points'];
		}
		
		function getPlayerAccount($name) {
			$SQL = $this->connect();
			$player = $SQL->query('SELECT account_id FROM players WHERE name = "'.$name.'"')->fetch();
			return $SQL->query('SELECT * from accounts WHERE id = '.$player['account_id'].'');
		}
		
		function AddPremium($name,$days) {
			$SQL = $this->connect();
			$account = $this->getPlayerAccount($name)->fetch();
			return $SQL->query('UPDATE accounts SET premdays = (premdays + '.$days.') WHERE name = "'.$account['name'].'"');
		}
		
		function CharacterList($account) {
			$SQL = $this->connect();
			$id = $SQL->query('SELECT id FROM accounts WHERE name = "'.$account.'"')->fetch();
			return $SQL->query('SELECT * FROM players WHERE account_id = '.$id['id'].'');
		}
		
		function isOnline($name) {
			$SQL = $this->connect();
			$player = $SQL->query('SELECT online FROM players WHERE name = "'.$name.'"')->fetch();
			return $player['online'];
		}
		
		
		function isBanned($name) {
			$SQL = $this->connect();
			$ID = $this->getPlayerAccount($name)->fetch();
			return $SQL->query('SELECT * FROM bans WHERE value = '.$ID['id'].'');
		}
		
		function UnBan($name) {
			$SQL = $this->connect();
			$ID = $this->getPlayerAccount($name)->fetch();
			return $SQL->query('DELETE FROM bans WHERE value = '.$ID['id'].'');
		}
		
		function execute_file($file) {
			if (!file_exists($file)) {
			$this->last_error = "The file $file does not exist.";
			return false;
			}
			$str = file_get_contents($file);
			if (!$str) {
			$this->last_error = "Unable to read the contents of $file.";
			return false;
			}

			// split all the queries into an array
			$quote = '';
			$line = '';
			$sql = array();
			$ignoreNextChar = '';
			for ($i = 0; $i < strlen($str); $i++) {
			if ( !$ignoreNextChar ) {
			$char = substr($str, $i, 1);
			$line .= $char;
			if ($char == ';' && $quote == '') {
			$sql[] = $line;
			$line = '';
			} else if ( $char == '\\' ) {
			// Escape char; ignore the next char in the string
			$ignoreNextChar = TRUE;
			} else if ($char == '"' || $char == "'" || $char == '`') {
			if ( $quote == '' ) // Start of a new quoted string; ends with same quote char
			$quote = $char;
			else if ( $char == $quote ) // Current char matches quote char; quoted string ends
			$quote = '';
			}
			}
			else
			$ignoreNextChar = FALSE;
			}

			if ($quote != '') return false;

			foreach ($sql as $query) {
			if (!empty($query)) {
			$r = mysql_query($query);

			if (!$r) {
			$this->last_error = mysql_error();
			return false;
			}
			}
			}
			return true;

		} 
		
		function install() {
			$SQL = $this->connect();
			if ($this->isInstalled())
				return false;
			else
				return $this->execute_file("gifts/config/Shop.sql");
		}
	}
?>

confirm/paypal.php
PHP:
<?PHP
require("config.php");
require("gifts/config/config.php");
$ots = POT::getInstance();
$ots->connect(POT::DB_MYSQL, connection());
$SQL = $ots->getDBHandle();
$custom = stripslashes(ucwords(strtolower(trim($_REQUEST['custom'])))); 
$session = stripslashes(ucwords(strtolower(trim($_REQUEST['session']))));  
$receiver_email = $_REQUEST['receiver_email'];  
$payment_status = $_REQUEST['payment_status'];  
$mc_gross = $_REQUEST['payment_gross'];  
$payer_email = $_REQUEST['payer_email']; 

if ($payment_status == "Completed" & $receiver_email == $config['donations']['paypal']['Mail'] & $mc_gross == $config['donations']['paypal']['Amount']) {  

$prem = $SQL->query("SELECT premium_points FROM accounts WHERE accounts.name = '".$custom."'")->fetch();  

$points = $prem['premium_points'] + $config['donations']['paypal']['Points'];  

$SQL->query("UPDATE accounts SET premium_points = '".$points."' WHERE name = '".$custom."'"); 

$SQL->query("INSERT INTO shop_donation_history (`id`, `method`, `receiver`, `buyer`, `account`, `points`, `date`) VALUES (NULL, 'PayPal', '".$config['donations']['paypal']['Mail']."', '".$session."', '".$custom."', '".$config['donations']['paypal']['Points']."', '".time()."');");

}  
else  
 {   
 echo("Error.");  
 }  
?>

ipn.php
PHP:
<?php
include("gifts/confirm/paypal.php");
?>

what is wrong?
 
Code:
[LEFT][COLOR=#0000BB][FONT=monospace]<?php

$config[/FONT][/COLOR][COLOR=#007700][FONT=monospace][[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'donations'[/FONT][/COLOR][COLOR=#007700][FONT=monospace]][[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'methods'[/FONT][/COLOR][COLOR=#007700][FONT=monospace]] = array([/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'ContenidoPago' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]false[/FONT][/COLOR][COLOR=#007700][FONT=monospace], [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'PayPal' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]true[/FONT][/COLOR][COLOR=#007700][FONT=monospace]);

[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]$config[/FONT][/COLOR][COLOR=#007700][FONT=monospace][[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'donations'[/FONT][/COLOR][COLOR=#007700][FONT=monospace]][[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'paypal'[/FONT][/COLOR][COLOR=#007700][FONT=monospace]] = array([/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'Mail' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'xxx', '[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Points[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]' => 10, '[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Product[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]' => '[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Donation Items[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]', '[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Money[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]' => '[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]EUR[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]', '[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Amount[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]' => 5);

$config1['[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]donations[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]']['[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]paypal[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'] = array('[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Mail[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]' => '[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]xxx[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]', '[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Points[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]' => 25, '[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Product[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]' => '[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Donation Items[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]', '[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Money[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]' => '[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]EUR[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]', '[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Amount[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]' => 12);

$config2['[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]donations[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]']['[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]paypal[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'] = array('[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Mail[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]' => '[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]xxx[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]', '[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Points[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]' => 33, '[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Product[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]' => '[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Donation Items[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]', '[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Money[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]' => '[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]EUR[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]', '[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Amount[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]' => 16);

$config3['[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]donations[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]']['[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]paypal[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'] = array('[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Mail[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]' => '[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]xxx'[/FONT][/COLOR][COLOR=#007700][FONT=monospace], [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'Points' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]55[/FONT][/COLOR][COLOR=#007700][FONT=monospace], [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'Product' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'Donation Items'[/FONT][/COLOR][COLOR=#007700][FONT=monospace], [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'Money' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'EUR'[/FONT][/COLOR][COLOR=#007700][FONT=monospace], [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'Amount' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]25[/FONT][/COLOR][COLOR=#007700][FONT=monospace]);

[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]$config4[/FONT][/COLOR][COLOR=#007700][FONT=monospace][[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'donations'[/FONT][/COLOR][COLOR=#007700][FONT=monospace]][[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'paypal'[/FONT][/COLOR][COLOR=#007700][FONT=monospace]] = array([/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'Mail' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'xxx', '[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Points[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]' => 80, '[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Product[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]' => '[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Donation Items[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]', '[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Money[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]' => '[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]EUR[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]', '[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Amount[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]' => 35);

$config['[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]donations[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]']['[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]contenidopago[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'] = array('[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Product[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]' => '[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]1347[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]', '[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Points[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]' => 4);

?>
[/FONT][/COLOR][/LEFT]
you forgot to put 'em some place
 
PHP:
<?php


$config['donations']['methods'] = array('ContenidoPago' => false, 'PayPal' => true);


$config['donations']['paypal'] = array('Mail' => 'xxx', 'Points' => 10, 'Product' => 'Donation Items', 'Money' => 'EUR', 'Amount' => 5);


$config1['donations']['paypal'] = array('Mail' => 'xxx', 'Points' => 25, 'Product' => 'Donation Items', 'Money' => 'EUR', 'Amount' => 12);


$config2['donations']['paypal'] = array('Mail' => 'xxx', 'Points' => 33, 'Product' => 'Donation Items', 'Money' => 'EUR', 'Amount' => 16);


$config3['donations']['paypal'] = array('Mail' => 'xxx', 'Points' => 55, 'Product' => 'Donation Items', 'Money' => 'EUR', 'Amount' => 25);


$config4['donations']['paypal'] = array('Mail' => 'xxx', 'Points' => 80, 'Product' => 'Donation Items', 'Money' => 'EUR', 'Amount' => 35);


$config['donations']['contenidopago'] = array('Product' => '1347', 'Points' => 4);


?>
ok
 
Back
Top