phpBB.com     phpBB Academy     phpBB Modders     phpBB Weekly     ktuk     phpBB Hacks     Vlad Studio  

Paypal Donations Page

Simple page where users can donate to your forum via paypal

Not enough for a full proper MOD, but too useful not to share
Forum rules
Please read over our forum guidelines

Paypal Donations Page

Postby kenny » 08 Aug 2008, 12:43

Very simple Paypal Donations page. So simple that it's more effort to document it here than it was to make it :P

paypal.php
Code: Select all
<?php
/**
*
* @package phpBB3
* @version $Id: paypal.php 0006 13:23 08/08/2008 kenny $
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* @ignore
*/
define('IN_PHPBB'true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH './';
$phpEx substr(strrchr(__FILE__'.'), 1);
include(
$phpbb_root_path 'common.' $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();

$mode request_var('mode''');

// Load the appropriate paypal file
switch ($mode)
{
    case 
'success':
        
$l_title 'Success, you have successfully donated to ' $config['sitename'];
        
$template->set_filenames(array(
            
'body' => 'paypal/success_body.html')
        );
    break;

    case 
'cancel':
        
$l_title 'Donation cancelled!';
        
$template->set_filenames(array(
            
'body' => 'paypal/cancel_body.html')
        );
    break;

    default:
        
$l_title 'Donate to ' $config['sitename'];
        
$template->set_filenames(array(
            
'body' => 'paypal/paypal_body.html')
        );
    break;
}

$sitename $config['sitename'];

// Lets build a page ...
$template->assign_vars(array(
    
'SITENAME'     => $sitename,
    
'L_FAQ_TITLE'    => $l_title,
    
'L_BACK_TO_TOP'    => $user->lang['BACK_TO_TOP'])
);

page_header($l_title);

make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));

page_footer();

?>

Place the following template files inside a "paypal" folder in your templates directory.

paypal/paypal_body.html
Code: Select all
<!-- INCLUDE overall_header.html -->

   <h2>Donate to {SITENAME}</h2>

<div class="panel">
   <div class="inner"><span class="corners-top"><span></span></span>

   <fieldset class="fields2">
   <p>Support {SITENAME} by making a donation using PayPal.<br />
   Your donations ensure that we can pay our hosting bills and are able to keep this site online for the benefit of our users.<br />
   <br />If you are able to donate more than &#163;5 it will keep us motiviated to produce Rewards for our Supporters and helps us that much more. :)
</p>
<br />
   <dl>
       <dt>

<!-- Replace this code with your own paypal code -->
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="image" src="https://www.paypal.com/en_GB/i/btn/x-click-but21.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1">
<input type="hidden" name="encrypted" value="----- INSERT YOUR CUSTOM PAYPAL CODE HERE || CHECK THE PAYPAL WEBSITE ON HOW TO GENERATE THIS -----
"></form>
<!-- Replace this code with your own paypal code -->

</dt>
    </dl>

    </fieldset>

   <span class="corners-bottom"><span></span></span></div>
</div>

<!-- INCLUDE overall_footer.html -->

paypal/cancel_body.html
Code: Select all
<!-- INCLUDE overall_header.html -->

   <h2>Donation Cancelled</h2>

<div class="panel">
   <div class="inner"><span class="corners-top"><span></span></span>

   <fieldset class="fields2">
   <p>It seems you have decided to cancel your donation to {SITENAME}<br />
   Don't worry, it's ok - but do think about donating in the future - the more donations we get, the better we can make the site :)
   <br />Thanks for checking out the site none the less<br /><br />
   The {SITENAME} Team</p>
    </fieldset>

   <span class="corners-bottom"><span></span></span></div>
</div>

<!-- INCLUDE overall_footer.html -->

paypal/success_body.html
Code: Select all
<!-- INCLUDE overall_header.html -->

   <h2>Donation Successfull</h2>

<div class="panel">
   <div class="inner"><span class="corners-top"><span></span></span>

   <fieldset class="fields2">
   <p>Congratulations, you have successfully donated to {SITENAME}!<br /><br />
   Your donation, no matter how big or small, is very greatly appreciated and will go towards keeping the site online<br />
   Hopefully in the future, we can set up a rewards system for those who have donated<br />
   For now though, you have your utmost thanks<br /><br />
   The {SITENAME} team.
</p>
    </fieldset>

   <span class="corners-bottom"><span></span></span></div>
</div>

<!-- INCLUDE overall_footer.html -->

Create a link to the paypal.php file wherever you like - easiest place is next to the FAQ / Members links in the breadcrumbs bar. Have a look at how the are created to see how you do it. Also, remember to add your custom paypal form info into the paypal_body.html file or you page won't work. There's more information on paypals website on how to generate a custom donations button 8-)
|| 6 String Romance || Myspace || phpBB.com || Need Freelance Work? ||
If you need one of my MODs installed - click here


Are you a musician in the Glasgow area interested in acoustic events? The ArtBox
User avatar
kenny kenny is probably rawking out on RockBand \m/
Project Leader
Project Leader
 
Posts: 647
Joined: 06 Jun 2008, 11:38
Location: Airdrie, UK

Donate to 6 String MODs
If you like any of the work that I do here, please consider donating.
click the image on the left for a list of some of the advantages of donating



Paypal Donations Page

Postby scouthostinguk » 08 Jan 2009, 20:45

hi Kenny,

Great code snippet for my site, but i'm getting these errors:
Code: Select all
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3836: Cannot modify header information - headers already sent by (output started at /paypal.php:1)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3838: Cannot modify header information - headers already sent by (output started at /paypal.php:1)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3839: Cannot modify header information - headers already sent by (output started at /paypal.php:1)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3840: Cannot modify header information - headers already sent by (output started at /paypal.php:1)

Any ideas on how to fix theses erorrs

Thanks

David
User avatar
scouthostinguk
Registered User
Registered User
 
Posts: 4
Joined: 08 Jan 2009, 20:39

Paypal Donations Page

Postby kenny » 08 Jan 2009, 21:43

Hi David,

That kind of error usually suggests that there is either whitespace or other characters at the start of the file. The very first character of the file should be a < If that's not the case for your file, delete anything before that, save the file and re-upload :)
|| 6 String Romance || Myspace || phpBB.com || Need Freelance Work? ||
If you need one of my MODs installed - click here


Are you a musician in the Glasgow area interested in acoustic events? The ArtBox
User avatar
kenny kenny is probably rawking out on RockBand \m/
Project Leader
Project Leader
 
Posts: 647
Joined: 06 Jun 2008, 11:38
Location: Airdrie, UK

Paypal Donations Page

Postby scouthostinguk » 08 Jan 2009, 22:18

kenny wrote:Hi David,

That kind of error usually suggests that there is either whitespace or other characters at the start of the file. The very first character of the file should be a < If that's not the case for your file, delete anything before that, save the file and re-upload :)


Thanks for your help on this.

Link added to bottom of page.

David
User avatar
scouthostinguk
Registered User
Registered User
 
Posts: 4
Joined: 08 Jan 2009, 20:39

Paypal Donations Page

Postby kenny » 08 Jan 2009, 22:30

Cool, glad you got it sorted and than you very much for adding a link :mrgreen:
|| 6 String Romance || Myspace || phpBB.com || Need Freelance Work? ||
If you need one of my MODs installed - click here


Are you a musician in the Glasgow area interested in acoustic events? The ArtBox
User avatar
kenny kenny is probably rawking out on RockBand \m/
Project Leader
Project Leader
 
Posts: 647
Joined: 06 Jun 2008, 11:38
Location: Airdrie, UK

Paypal Donations Page

Postby vonhazey » 15 Jan 2010, 22:59

Kenny great snippet any chance I could have a paypal body.html like the one on here as its more what i'm after please? :D
User avatar
vonhazey vonhazey has donated to 6 String MODs
Donator
Donator
 
Posts: 58
Joined: 03 Dec 2009, 13:43
Location: Deepcar, UK

Paypal Donations Page

Postby kenny » 16 Jan 2010, 05:22

|| 6 String Romance || Myspace || phpBB.com || Need Freelance Work? ||
If you need one of my MODs installed - click here


Are you a musician in the Glasgow area interested in acoustic events? The ArtBox
User avatar
kenny kenny is probably rawking out on RockBand \m/
Project Leader
Project Leader
 
Posts: 647
Joined: 06 Jun 2008, 11:38
Location: Airdrie, UK

Re: Paypal Donations Page

Postby vonhazey » 16 Jan 2010, 14:20

Cheers Kenny
User avatar
vonhazey vonhazey has donated to 6 String MODs
Donator
Donator
 
Posts: 58
Joined: 03 Dec 2009, 13:43
Location: Deepcar, UK




Return to Code Snippets

Who is online

Google [Bot], MSN [Bot]


cron