View Single Post
  #1296  
Old 12-07-2006, 01:22 PM
Dead-Meat Dead-Meat is offline
 
Join Date: Nov 2006
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm trying to get something to work in PayPal Donations 2.0.2, Paypal Donations For vBulletin 3.5.
I've been looking at the php codes from the alldonators.php and created a new php file which I am showing through an iframe.

I want to show all donators from the current month and not as it is doing now, from all months. I'm redoing the php file to get the data from the paypalipn table, because that one inserts a date of transaction which I can use.

What I need is a way to compair the current month with the month that is stored in the payment_date table. The type of the table is varchar instead of datetime and looks like this: 12:00:00 November 25 2006 PST. I managed to bring this date back to the three letters of the month, but I can't figure out how to only show those results that match the current month. Any help is greatly appreciated.

This is the php code that I created now. (There's probably a lot left from the alldonators.php code that isn't needed, but it currently gets half the job done).
PHP Code:
<?
/*======================================================================*\
|| #################################################################### ||
|| # Paypal Donations for vBulletin 3.5 - Version 2.00                # ||
|| # ---------------------------------------------------------------- # ||
|| # Copyright ?2005 The Noble Pagan, Inc. All Rights Reserved.       # ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------------------------------------------------------- # ||
|| # This Addon Contributed by DSBoyce8624                            # ||
|| # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html # ||
|| # ---------------------------------------------------------------- # ||
|| #################################################################### ||
\*======================================================================*/



// ######################### REQUIRE BACK-END ############################
require_once('./global.php');

$month = date("M");

echo "<link href=\"donors.css\" rel=\"stylesheet\" type=\"text/css\">";
echo "<center><table>";
echo "<tr><td colspan=2 align=center><a href=\"forums/alldonors.php\" target=\"_top\">Our Donators</a></td></tr>";

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################

// ###### Show All Donors ######
$query = $vbulletin->db->query_read("SELECT * FROM ".TABLE_PREFIX."donation_paypalipn WHERE userid != '0' AND valid != '0' ORDER BY mc_gross DESC");
$num = $vbulletin->db->num_rows($query);
$pic='';
$i = 1;
$p = 1;
while ($row = $vbulletin->db->fetch_array($query)){
    $avatar_row = $vbulletin->db->query_first("SELECT user.showdonor, user.username, user.avatarid, user.avatarrevision, avatar.avatarpath, NOT ISNULL(customavatar.filedata) AS hascustomavatar, customavatar.dateline AS avatardateline
                                                                            FROM ".TABLE_PREFIX."user AS user
                                                                            LEFT JOIN ".TABLE_PREFIX."avatar AS avatar ON(avatar.avatarid = user.avatarid)
                                                                            LEFT JOIN ".TABLE_PREFIX."customavatar AS customavatar ON(customavatar.userid = user.userid)
                                                                            WHERE user.userid = '".$row['userid']."'");
                    
    if ($avatar_row['avatarid']){
        $avatarurl = $avatar_row['avatarpath'];
    } else {
        if ($avatar_row['hascustomavatar']){
            if ($vbulletin->options['usefileavatar']){
                $avatarurl = $vbulletin->options['avatarurl']."/avatar".$row['userid']."_".$avatar_row['avatarrevision'].".gif";
            } else {
                $avatarurl = "image.php?".$session['sessionurl']."u=".$row['userid']."&amp;dateline=".$avatar_row['avatardateline'];
            }
        } else {
            $avatarurl = '';
        }
    }
    $userid = $row['userid'];
    $avatar = '<img src="'.$avatarurl.'" border="0">';
    $username = stripslashes($avatar_row['username']);
    $show_as_donor = $avatar_row['showdonor'];
    $total = number_format($row['mc_gross'], 2, '.', ',');
    $currency = $row['mc_currency'];
    $date = date("M", strtotime($row['payment_date']));
    


echo "<tr><td><font size=\"1\">$username</font></td><td><font size=\"1\">$total $currency $month $date</font></td></tr>";
}
{
echo "</table></center>";
}
/*======================================================================*\
|| #################################################################### ||
|| # alldonors -- Fileversion 2.00                                    # ||
|| # Date Version Finalized -- 03 July 2005                           # ||
|| #################################################################### ||
\*======================================================================*/
?>
This is what it outputs now:
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02443 seconds
  • Memory Usage 1,810KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete