DragonPrime - LoGD Resource Community
Welcome Guest
  • Good evening, Guest.
    Please log in, or register.
  • October 16, 2018, 10:41:28 PM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1]   Go Down
  Print  
Author Topic: PayPal Bar  (Read 3680 times)
0 Members and 1 Guest are viewing this topic.
Excalibur
Member
Mod God
*****
Offline Offline

Posts: 573


I'm a newbie, plz forgive me!


View Profile WWW
« on: September 25, 2005, 06:56:22 AM »

I've adapted the PayPalBar by Ariadoss (with his permission) to use it in 0.97, and here we go:

Open common.php and find:
Quote
   $paypalstr .= '</td></tr></table>';
After add:
Code:
/*
Original code for 1.0.x by Danilo Stern-Sapad and Nicholas Moline
0.97 version by Excalibur (www.ogsi.it/logd)
*/
    $donatetext = getsetting("donatetext","<b><font color=yellow>Thanks for the help</b></font>"); // Text to display explaining donations,text
    $need = getsetting("monthlygoal", 40); // Amount Needed
    $color_bar = "269A26"; // What color do you want for the bar?
    $bg_bar = "777777";  // What color for the remainder of the goal?
    $text = "Monthly Goal:<br>$";
    $text1 = " of $";
    $sql = "SELECT substring(processdate,1,7) AS month, sum(amount)-sum(txfee) AS profit FROM paylog GROUP BY month DESC LIMIT 1";
    $result = db_query($sql);
    $needed = $need;
    while ($row = db_fetch_assoc($result)) {
          $have = $row['profit'];
          $month = $row['month'];
    }
    if($month != date("Y-m"))$have = 0;
    $color = $color_bar;
    $bgcolor = $bg_bar;
    if ($have >= $needed) {
        $percent = 100;
        $roundpercent = 100;
    } elseif ($have == 0) {
        $percent = 0;
        $roundpercent = 0;
    } else {
        $percent = $have / $needed * 100;
        $roundpercent = ceil($percent);
    }
    $nonpercent = 100 - $roundpercent;
    $display .= "<center><small>" . $donatetext . "</small></center><br /><dt><center>
    <table style='border: solid 1px #000000;' bgcolor='" . $bgcolor . "' cellpadding='0' cellspacing='0' width='100' height='10'>
    <tr><td width='$roundpercent' bgcolor='$color'></td><td width='$nonpercent'></td></tr></table></center><br><center><small>" . $text . $have . $text1 . $needed . " (" . $roundpercent . "%)</small></center></dt>";
    $paypalstr.=$display;
    //Excalibur: end code for PayPalBar
To use this code you need a table similar to the one used in 1.0 (paylog), here the SQL query to create it:
Code:
CREATE TABLE `paylog` (
  `payid` int(11) NOT NULL auto_increment,
  `info` text NOT NULL,
  `response` text NOT NULL,
  `txnid` varchar(32) NOT NULL default '',
  `amount` float(9,2) NOT NULL default '0.00',
  `name` varchar(50) NOT NULL default '',
  `acctid` int(11) unsigned NOT NULL default '0',
  `processed` tinyint(4) unsigned NOT NULL default '0',
  `filed` tinyint(4) unsigned NOT NULL default '0',
  `txfee` float(9,2) NOT NULL default '0.00',
  `processdate` datetime NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY  (`payid`),
  KEY `txnid` (`txnid`)
) TYPE=MyISAM;
If you want to automate the registration of PayPal donations you have to create a script that acquires the info from PayPal, else you can insert them manually.

I hope someone will find this usefull as I do

Excalibur
Logged

Spock: Random chance seems to have operated in our favor.
McCoy: In plain, non-Vulcan English, we've been lucky.
Spock: I believe I said that, Doctor.
Devilzimti
Guest
« Reply #1 on: October 15, 2005, 09:01:05 AM »

Great  Smiley
I was looking for this )D(
Logged
Excalibur
Member
Mod God
*****
Offline Offline

Posts: 573


I'm a newbie, plz forgive me!


View Profile WWW
« Reply #2 on: October 15, 2005, 09:30:44 AM »

Glad you like it  Cheesy
Logged

Spock: Random chance seems to have operated in our favor.
McCoy: In plain, non-Vulcan English, we've been lucky.
Spock: I believe I said that, Doctor.
Arune
Member
Mod God
*****
Offline Offline

Posts: 718


Arune Vai - khatfield


View Profile WWW
« Reply #3 on: November 24, 2005, 11:57:27 PM »

Just installed this myself, nice work
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Play LoGD on Dragonprime

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
24 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search