Automatic PayPal Donation System

Have you created a useful tool? or Do you want to get help building one? This is the right place!
Forum rules
READ NOW: L2j Forums Rules of Conduct
User avatar
u3games
Posts: 1156
Joined: Sun Feb 27, 2011 7:00 pm
Location: España
Contact:

Automatic PayPal Donation System

Post 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
Last edited by u3games on Wed May 06, 2015 11:29 pm, edited 5 times in total.
Image
User avatar
Pandragon
Posts: 704
Joined: Tue Jul 26, 2005 7:38 pm

Re: Automatic PayPal Donation System

Post by Pandragon »

:shock:
User avatar
u3games
Posts: 1156
Joined: Sun Feb 27, 2011 7:00 pm
Location: España
Contact:

Re: Automatic PayPal Donation System

Post by u3games »

Up rev 3 ^^
Image
orophix
Posts: 13
Joined: Sat Apr 25, 2015 1:42 am

Re: Automatic PayPal Donation System

Post by orophix »

Awesome gonna test it!
dasoldier
Posts: 73
Joined: Wed May 31, 2006 6:26 pm
Location: Holland
Contact:

Re: Automatic PayPal Donation System

Post by dasoldier »

Nice :D Keep up the good work.
User avatar
u3games
Posts: 1156
Joined: Sun Feb 27, 2011 7:00 pm
Location: España
Contact:

Re: Automatic PayPal Donation System

Post by u3games »

dasoldier wrote:Nice :D Keep up the good work.
Thx ^^

Any suggestions to improve?
Image
User avatar
UnAfraid
L2j Veteran
L2j Veteran
Posts: 4199
Joined: Mon Jul 23, 2007 4:25 pm
Location: Bulgaria
Contact:

Re: Automatic PayPal Donation System

Post by UnAfraid »

try to use activerecord it should be easier and decrease possibilities of sql injection.
Image
dasoldier
Posts: 73
Joined: Wed May 31, 2006 6:26 pm
Location: Holland
Contact:

Re: Automatic PayPal Donation System

Post 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>';
	}

User avatar
u3games
Posts: 1156
Joined: Sun Feb 27, 2011 7:00 pm
Location: España
Contact:

Re: Automatic PayPal Donation System

Post 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.
Last edited by u3games on Wed May 06, 2015 8:33 pm, edited 2 times in total.
Image
dasoldier
Posts: 73
Joined: Wed May 31, 2006 6:26 pm
Location: Holland
Contact:

Re: Automatic PayPal Donation System

Post 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)."'
						)");
User avatar
u3games
Posts: 1156
Joined: Sun Feb 27, 2011 7:00 pm
Location: España
Contact:

Re: Automatic PayPal Donation System

Post 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 ^^
Image
dasoldier
Posts: 73
Joined: Wed May 31, 2006 6:26 pm
Location: Holland
Contact:

Re: Automatic PayPal Donation System

Post 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.
orophix
Posts: 13
Joined: Sat Apr 25, 2015 1:42 am

Re: Automatic PayPal Donation System

Post by orophix »

Code: Select all

 Parse error: syntax error, unexpected '}' in index.php on line 95 
When I try to use it :(
dasoldier
Posts: 73
Joined: Wed May 31, 2006 6:26 pm
Location: Holland
Contact:

Re: Automatic PayPal Donation System

Post 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.
User avatar
u3games
Posts: 1156
Joined: Sun Feb 27, 2011 7:00 pm
Location: España
Contact:

Re: Automatic PayPal Donation System

Post 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
Image
Post Reply