Page 1 of 3

Automatic PayPal Donation System

Posted: Wed Apr 29, 2015 4:45 pm
by u3games
Image

Single panel of automatic donations via paypal.

- You specify the name of the character and the amount to donate.
- The player gets in your inventory, the amount donated.

FEATURES:

+ Config for: currency, item id, count, ...
+ Bonus donation, example: donate 10 euros and gives you 20 items.
+ Delay Protector.
+ Telnet System.
+ Log donations.
+ Multilanguage.
+ SandBox test.
+ Reporting.

https://github.com/u3games/U3G_PayPal_System_MMORPG

Re: Automatic PayPal Donation System

Posted: Wed Apr 29, 2015 5:54 pm
by Pandragon
:shock:

Re: Automatic PayPal Donation System

Posted: Thu Apr 30, 2015 1:03 am
by u3games
Up rev 3 ^^

Re: Automatic PayPal Donation System

Posted: Thu Apr 30, 2015 9:08 am
by orophix
Awesome gonna test it!

Re: Automatic PayPal Donation System

Posted: Sat May 02, 2015 1:43 pm
by dasoldier
Nice :D Keep up the good work.

Re: Automatic PayPal Donation System

Posted: Sat May 02, 2015 7:05 pm
by u3games
dasoldier wrote:Nice :D Keep up the good work.
Thx ^^

Any suggestions to improve?

Re: Automatic PayPal Donation System

Posted: Sat May 02, 2015 8:21 pm
by UnAfraid
try to use activerecord it should be easier and decrease possibilities of sql injection.

Re: Automatic PayPal Donation System

Posted: Mon May 04, 2015 8:31 pm
by dasoldier
u3games wrote:
dasoldier wrote:Nice :D Keep up the good work.
Thx ^^

Any suggestions to improve?
Hmm yes maby, i dont think its 100% fool proof.

What will happen when a player logs into the donation form and then login his character ingame before the paypal payment is done ?

The ipn will only check if a player is online and does not check if telnet is enabled on the server, and now it will just try to add the item trough telnet.
The result will be a failed donation.

Maby add some special characters check.

Code: Select all

/**
Validate name.
*/
function checkname($charname)
{
	if(preg_match("/^[ _A-Za-z0-9-]+$/",$charname))
		return TRUE;
	return FALSE;
}

Code: Select all

$chkname = checkname(mysql_real_escape_string($_POST["custom"]));

Code: Select all

if ($chkname != 0){
............
.......
...
	else{
		echo '<center>Special chars in username are not allowed</center>';
	}


Re: Automatic PayPal Donation System

Posted: Tue May 05, 2015 11:26 am
by u3games
dasoldier wrote:
u3games wrote:
dasoldier wrote:Nice :D Keep up the good work.
Thx ^^

Any suggestions to improve?
Hmm yes maby, i dont think its 100% fool proof.

What will happen when a player logs into the donation form and then login his character ingame before the paypal payment is done ?

The ipn will only check if a player is online and does not check if telnet is enabled on the server, and now it will just try to add the item trough telnet.
The result will be a failed donation.

Maby add some special characters check.

Code: Select all

/**
Validate name.
*/
function checkname($charname)
{
	if(preg_match("/^[ _A-Za-z0-9-]+$/",$charname))
		return TRUE;
	return FALSE;
}

Code: Select all

$chkname = checkname(mysql_real_escape_string($_POST["custom"]));

Code: Select all

if ($chkname != 0){
............
.......
...
	else{
		echo '<center>Special chars in username are not allowed</center>';
	}

Nice, thx for info and code. But it is not necessary, in properties is customizable.

Add Rev 4, multi-language support.

Re: Automatic PayPal Donation System

Posted: Wed May 06, 2015 5:13 pm
by dasoldier
Oke :D

I dont know if you forgot to add dc_donations.sql, or trying to remove the table.

If so then there is still some code left behind in ipn_coins.php.

Code: Select all

// Here we will make a log of all the donations after the payment status is complete
		mysqli_query($db_link, "	INSERT INTO dc_donations (transaction_id,donation,amount,character_name)
						VALUES (
							'".esc($p->ipn_data['txn_id'])."',
							'Paypal, Coins',
							".(float)$amount.",
							'".esc($custom)."'
						)");

Re: Automatic PayPal Donation System

Posted: Wed May 06, 2015 8:54 pm
by u3games
dasoldier wrote:Oke :D

I dont know if you forgot to add dc_donations.sql, or trying to remove the table.

If so then there is still some code left behind in ipn_coins.php.

Code: Select all

// Here we will make a log of all the donations after the payment status is complete
		mysqli_query($db_link, "	INSERT INTO dc_donations (transaction_id,donation,amount,character_name)
						VALUES (
							'".esc($p->ipn_data['txn_id'])."',
							'Paypal, Coins',
							".(float)$amount.",
							'".esc($custom)."'
						)");
Add in rev 7, thx for report ^^

Re: Automatic PayPal Donation System

Posted: Thu May 07, 2015 7:10 pm
by dasoldier
Maby something usefull to add.
creating a whitelist in the ipn script so that not everybody can access the file.
I'm not sure about the ip addresses yet.
But the paypal ipn response ip's should be added. And ofcourse the sandbox addresses.

Code: Select all

if (!in_array($_SERVER['REMOTE_ADDR'],array('paypal.ipn.ip','paypal.ipn.ip','paypal.ipn.ip','paypal.ipn.ip')) {
header("HTTP/1.0 404 Not Found");
exit();
}
When i'm sure what ip adresses are used, i will update the post.

PS. It should be safe tho, since people cannot get the verified payment status.

Re: Automatic PayPal Donation System

Posted: Sat May 09, 2015 8:59 am
by orophix

Code: Select all

 Parse error: syntax error, unexpected '}' in index.php on line 95 
When I try to use it :(

Re: Automatic PayPal Donation System

Posted: Sat May 09, 2015 3:54 pm
by dasoldier
orophix wrote:

Code: Select all

 Parse error: syntax error, unexpected '}' in index.php on line 95 
When I try to use it :(
change line: 15, 38, 62 in index.php

From <? to <?php.

U3games thankyou.php file is missing.

Re: Automatic PayPal Donation System

Posted: Mon May 11, 2015 4:37 pm
by u3games
dasoldier wrote:
orophix wrote:

Code: Select all

 Parse error: syntax error, unexpected '}' in index.php on line 95 
When I try to use it :(
change line: 15, 38, 62 in index.php

From <? to <?php.

U3games thankyou.php file is missing.
Thx, up in rev 8 --> https://github.com/u3games/U3G_PayPal_S ... 06f4ba7758