We moved our repositories to BitBucket!

If you can't login or you can't register to the forums do not rise an issue, instead please write to support (at) l2jserver.com

Check our wiki!

Report server issues here

Forum has been updated to phpBB 3.2, let's see if this fixes some minor bugs we had.

Thank you for visiting http://www.l2jserver.com/

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
Advanced User
Advanced User
Posts: 1148
Joined: Sun Feb 27, 2011 7:00 pm
Location: España
Contact:

Automatic PayPal Donation System

Post by u3games » Wed Apr 29, 2015 4:45 pm

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
Advanced User
Advanced User
Posts: 697
Joined: Tue Jul 26, 2005 7:38 pm

Re: Automatic PayPal Donation System

Post by Pandragon » Wed Apr 29, 2015 5:54 pm

:shock:

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

Re: Automatic PayPal Donation System

Post by u3games » Thu Apr 30, 2015 1:03 am

Up rev 3 ^^
Image

orophix
Posts: 13
Joined: Sat Apr 25, 2015 1:42 am

Re: Automatic PayPal Donation System

Post by orophix » Thu Apr 30, 2015 9:08 am

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 » Sat May 02, 2015 1:43 pm

Nice :D Keep up the good work.

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

Re: Automatic PayPal Donation System

Post by u3games » Sat May 02, 2015 7:05 pm

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

Any suggestions to improve?
Image

User avatar
UnAfraid
L2j Veteran
L2j Veteran
Posts: 4195
Joined: Mon Jul 23, 2007 4:25 pm
Location: Bulgaria
Contact:

Re: Automatic PayPal Donation System

Post by UnAfraid » Sat May 02, 2015 8:21 pm

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 » Mon May 04, 2015 8:31 pm

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
Advanced User
Advanced User
Posts: 1148
Joined: Sun Feb 27, 2011 7:00 pm
Location: España
Contact:

Re: Automatic PayPal Donation System

Post by u3games » Tue May 05, 2015 11:26 am

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 » Wed May 06, 2015 5:13 pm

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
Advanced User
Advanced User
Posts: 1148
Joined: Sun Feb 27, 2011 7:00 pm
Location: España
Contact:

Re: Automatic PayPal Donation System

Post by u3games » Wed May 06, 2015 8:54 pm

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 » Thu May 07, 2015 7:10 pm

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 » Sat May 09, 2015 8:59 am

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 » Sat May 09, 2015 3:54 pm

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
Advanced User
Advanced User
Posts: 1148
Joined: Sun Feb 27, 2011 7:00 pm
Location: España
Contact:

Re: Automatic PayPal Donation System

Post by u3games » Mon May 11, 2015 4:37 pm

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