+-

UserBox

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

Sponsored Links

+- Recent Posts

Re: Code being stripped in HTML block by negative_energy
February 06, 2012, 06:30:36 pm

Re: Code being stripped in HTML block by EzPortal
February 06, 2012, 06:25:25 pm

Re: Code being stripped in HTML block by negative_energy
February 06, 2012, 06:23:16 pm

Re: Flash EzBlock by negative_energy
February 06, 2012, 06:18:40 pm

Re: Code being stripped in HTML block by EzPortal
February 06, 2012, 06:08:49 pm

Code being stripped in HTML block by negative_energy
February 06, 2012, 06:01:55 pm

Re: EzPortal 0.5.1 and Russian encoding by Retrouser
February 04, 2012, 12:59:13 am

Re: Flash EzBlock by negative_energy
January 23, 2012, 12:56:04 am

Re: Flash EzBlock by EzPortal
January 22, 2012, 11:08:10 pm

Flash EzBlock by negative_energy
January 22, 2012, 05:29:23 pm

Author Topic: Stats block  (Read 13596 times)

0 Members and 1 Guest are viewing this topic.

Offline Eddy Matthews

  • Jr. Member
  • **
  • Posts: 50
  • Karma: 1
    • View Profile
Stats block
« on: November 01, 2009, 01:03:39 am »
Would it be possible to get a copy of the Stats EzBlock that you use on your SMFHacks forum vbgamer?

It does exactly what I'm looking for!

Regards
Eddy

Offline Eddy Matthews

  • Jr. Member
  • **
  • Posts: 50
  • Karma: 1
    • View Profile
Re: Stats block
« Reply #1 on: November 02, 2009, 12:25:32 pm »
I see now that your using TP on the other site..... Nevermind, I took the original TP stats block and modified if to work with EzPortal  :)

Regards
Eddy

Offline EzPortal

  • Administrator
  • *****
  • Posts: 624
  • Karma: 42
    • View Profile
Re: Stats block
« Reply #2 on: November 02, 2009, 06:34:34 pm »
Yeah going to probably switch over once SMF 2.0 is released just taking a long time more than I thought.

Offline Eddy Matthews

  • Jr. Member
  • **
  • Posts: 50
  • Karma: 1
    • View Profile
Re: Stats block
« Reply #3 on: November 12, 2009, 03:20:07 am »
I have a problem with the Stats block I wrote for EzPortal - It worked fine under SMF 1.1.10, but now that I've upgraded to SMF 2.0 RC2 it just generates a fatal error:

Call to undefined function db_query() in smf/Sources/Load.php(2078) eval()'d code(1489): eval()'d code on line 27

I'm no programmer, so I'm sure it's something silly that I've done wrong - Can anyone help please?

Code: [Select]
<?xml version="1.0"?>
<!DOCTYPE block-info SYSTEM "http://www.ezportal.com/xml/block-info">
<block-info xmlns="http://www.ezportal.com/xml/block-info" xmlns:ezportal="http://www.ezportal.com/">
<id>eddymatthews:additionalstats</id>
<title>Additional Stats</title>
<version>1.1</version>
<blocktype>php</blocktype>
<forumversion>SMF 2.0.x</forumversion>
<author>Eddy Matthews</author>
<website>http://www.paddleducks.co.uk</website>
<editable>1</editable>
<can_cache>1</can_cache>


<blockdata><![CDATA[global $context, $boarddir, $settings, $options, $scripturl, $user_info, $modSettings;


require($boarddir.'/SSI.php');

    $bullet = '<img src="'.$settings['images_url'].'/icons/divider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
    $bullet2 = '<img src="'.$settings['images_url'].'/icons/divider2.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
    $bullet3 = '<img src="'.$settings['images_url'].'/icons/divider3.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
    $bullet4 = '<img src="'.$settings['images_url'].'/icons/goto.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
    $bullet5 = '<img src="'.$settings['images_url'].'/icons/module2.gif" alt="" border="0" style="margin:0 2px 0 0;" />';

echo'
<div style="font-family: verdana, arial, sans-serif;">';

   // members stats
            echo '
                 <img src="'.$settings['images_url'].'/icons/members.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=mlist"><b>','Members','</b></a>
                 <br />'.$bullet,'Total Members',': ' , isset($modSettings['memberCount']) ? $modSettings['memberCount'] : $modSettings['totalMembers'] , '
                 <br />'.$bullet,'Latest',': <a href="', $scripturl, '?action=profile;u=', $modSettings['latestMember'], '"><b>', $modSettings['latestRealName'], '</b></a>';

global $db_prefix,$modSettings;
$today = strtotime("24 hours ago");
date('j') == 1 ? $thismonth = $today : $thismonth = strtotime(date('F') . ' 1');
date('l') == 'Sunday' ? $thisweek = $today : $thisweek = strtotime('last Sunday');
date('M') == 'January' ? $thisyear = $thismonth : $thisyear = strtotime('January 1');
$query = db_query("SELECT
COUNT(dateRegistered > $thisyear OR NULL) as year,
COUNT(dateRegistered > $thismonth OR NULL) as month,
COUNT(dateRegistered > $thisweek OR NULL) as week,
COUNT(dateRegistered > $today OR NULL) as today
FROM {$db_prefix}members
WHERE is_activated = 1", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);

settype($row['today'], "integer");
settype($row['week'], "integer");
settype($row['month'], "integer");

echo '<br />',$bullet,'New This Month: ', $row['month'],'<br />';
echo $bullet,'New This Week: ', $row['week'],'<br />';
echo $bullet,'New Today: ', $row['today'];

   // more stats
            echo '
                  <hr /><img src="'.$settings['images_url'].'/icons/info.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=stats"><b>','Stats','</b></a>
                 <br />'.$bullet,'Total Posts',': '.$modSettings['totalMessages']. '
                                  <br />'.$bullet,'Total Topics',': '.$modSettings['totalTopics']. '
                                  <br />'.$bullet,'Most Online Today',': '.$modSettings['mostOnlineToday'].'
                                  <br />'.$bullet,'Most Online Ever',': '.$modSettings['mostOnline'].'<br />
  ('.timeformat($modSettings['mostDate']).')
  ';

   // add online users
            echo '<hr /><img src="'.$settings['images_url'].'/icons/online.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=who"><b>','Users Online','</b></a><br />';

            $online = ssi_whosOnline('array');
           echo $bullet,'Members',': '.$online['num_users'];
           echo '<br />'.$bullet,'Guests',': '.$online['guests'];
           echo '<br />'.$bullet,'Spiders: ', $online['num_spiders'];
           echo '<br />'.$bullet,'Total',': '.$online['total_users'].'<hr />
<div style="width: 100%; ' , $online['num_users']>14 ? 'height: 23ex;overflow: auto;' : '' ,'">';

      foreach($online['users'] as $user){
echo $bullet2 , $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];
echo '<br />';
echo '</div>';
                }
        echo '</div>';]]></blockdata>

</block-info>

Regards
Eddy

Offline EzPortal

  • Administrator
  • *****
  • Posts: 624
  • Karma: 42
    • View Profile
Re: Stats block
« Reply #4 on: November 12, 2009, 08:08:52 am »
Fixed
Code: [Select]
<?xml version="1.0"?>
<!DOCTYPE block-info SYSTEM "http://www.ezportal.com/xml/block-info">
<block-info xmlns="http://www.ezportal.com/xml/block-info" xmlns:ezportal="http://www.ezportal.com/">
<id>eddymatthews:additionalstats</id>
<title>Additional Stats</title>
<version>1.1</version>
<blocktype>php</blocktype>
<forumversion>SMF 2.0.x</forumversion>
<author>Eddy Matthews</author>
<website>http://www.paddleducks.co.uk</website>
<editable>1</editable>
<can_cache>1</can_cache>


<blockdata><![CDATA[global $context, $boarddir, $settings, $options, $scripturl, $user_info, $modSettings;


require($boarddir.'/SSI.php');

    $bullet = '<img src="'.$settings['images_url'].'/icons/divider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
    $bullet2 = '<img src="'.$settings['images_url'].'/icons/divider2.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
    $bullet3 = '<img src="'.$settings['images_url'].'/icons/divider3.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
    $bullet4 = '<img src="'.$settings['images_url'].'/icons/goto.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
    $bullet5 = '<img src="'.$settings['images_url'].'/icons/module2.gif" alt="" border="0" style="margin:0 2px 0 0;" />';

echo'
<div style="font-family: verdana, arial, sans-serif;">';

   // members stats
            echo '
                 <img src="'.$settings['images_url'].'/icons/members.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=mlist"><b>','Members','</b></a>
                 <br />'.$bullet,'Total Members',': ' , isset($modSettings['memberCount']) ? $modSettings['memberCount'] : $modSettings['totalMembers'] , '
                 <br />'.$bullet,'Latest',': <a href="', $scripturl, '?action=profile;u=', $modSettings['latestMember'], '"><b>', $modSettings['latestRealName'], '</b></a>';

global $smcFunc,$modSettings;
$today = strtotime("24 hours ago");
date('j') == 1 ? $thismonth = $today : $thismonth = strtotime(date('F') . ' 1');
date('l') == 'Sunday' ? $thisweek = $today : $thisweek = strtotime('last Sunday');
date('M') == 'January' ? $thisyear = $thismonth : $thisyear = strtotime('January 1');
$query = $smcFunc['db_query']('',"SELECT
COUNT(dateRegistered > $thisyear OR NULL) as year,
COUNT(dateRegistered > $thismonth OR NULL) as month,
COUNT(dateRegistered > $thisweek OR NULL) as week,
COUNT(dateRegistered > $today OR NULL) as today
FROM {db_prefix}members
WHERE is_activated = 1");
$row = mysql_fetch_assoc($query);

settype($row['today'], "integer");
settype($row['week'], "integer");
settype($row['month'], "integer");

echo '<br />',$bullet,'New This Month: ', $row['month'],'<br />';
echo $bullet,'New This Week: ', $row['week'],'<br />';
echo $bullet,'New Today: ', $row['today'];

   // more stats
            echo '
                  <hr /><img src="'.$settings['images_url'].'/icons/info.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=stats"><b>','Stats','</b></a>
                 <br />'.$bullet,'Total Posts',': '.$modSettings['totalMessages']. '
                                  <br />'.$bullet,'Total Topics',': '.$modSettings['totalTopics']. '
                                  <br />'.$bullet,'Most Online Today',': '.$modSettings['mostOnlineToday'].'
                                  <br />'.$bullet,'Most Online Ever',': '.$modSettings['mostOnline'].'<br />
  ('.timeformat($modSettings['mostDate']).')
  ';

   // add online users
            echo '<hr /><img src="'.$settings['images_url'].'/icons/online.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=who"><b>','Users Online','</b></a><br />';

            $online = ssi_whosOnline('array');
           echo $bullet,'Members',': '.$online['num_users'];
           echo '<br />'.$bullet,'Guests',': '.$online['guests'];
           echo '<br />'.$bullet,'Spiders: ', $online['num_spiders'];
           echo '<br />'.$bullet,'Total',': '.$online['total_users'].'<hr />
<div style="width: 100%; ' , $online['num_users']>14 ? 'height: 23ex;overflow: auto;' : '' ,'">';

      foreach($online['users'] as $user){
echo $bullet2 , $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];
echo '<br />';
echo '</div>';
                }
        echo '</div>';]]></blockdata>

</block-info>

Offline Eddy Matthews

  • Jr. Member
  • **
  • Posts: 50
  • Karma: 1
    • View Profile
Re: Stats block
« Reply #5 on: November 12, 2009, 09:15:07 am »
Thanks vbgamer,

That's got it all working again.... Just one minor tweak needed, the lines that do the COUNT query need to be altered slightly...

For example,

COUNT(dateRegistered > $today OR NULL) as today

Needs to be changed to:

COUNT(date_registered >$today OR NULL) as today

Once that is done to each of the COUNT queries it works fine...

Regards
Eddy

Offline EzPortal

  • Administrator
  • *****
  • Posts: 624
  • Karma: 42
    • View Profile
Re: Stats block
« Reply #6 on: November 12, 2009, 12:43:46 pm »
Glad you got it working.

Offline omar

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
Re: Stats block
« Reply #7 on: November 30, 2009, 09:21:27 pm »
I'm new to ezblock and i was looking for a stats block, i was wondering if i could borrow this code.

Offline Eddy Matthews

  • Jr. Member
  • **
  • Posts: 50
  • Karma: 1
    • View Profile
Re: Stats block
« Reply #8 on: December 01, 2009, 01:11:48 am »
I'm new to ezblock and i was looking for a stats block, i was wondering if i could borrow this code.

Please help yourself and use it if you wish.... If you make any changes, please let us know!

Regards
Eddy

Offline omar

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
Re: Stats block
« Reply #9 on: December 01, 2009, 03:54:55 pm »
thank you, i will let you know if i make any changes.

Offline EzPortal

  • Administrator
  • *****
  • Posts: 624
  • Karma: 42
    • View Profile
Re: Stats block
« Reply #10 on: February 01, 2010, 06:38:26 pm »
Stats block added to ezPortal 0.3.5

Offline DJ Omnimaga

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
    • View Profile
Re: Stats block
« Reply #11 on: February 02, 2010, 03:04:53 am »
Question, I am using a modified version of the stats block above that only shows the following:

Quote
Members: 266
Posts: 20514
Topics: 970

However, I would like it to look like:

Quote
Members: 266
Posts: 20514 (76915
since May 12th 2005)
Topics: 970

As you might guess, I want to display both my current board post count, then in parhentesis I want to display the total including the 56401 posts from an old board we had until we shutted down for a while). However, after doing 2 hours of Google search on PHP variables and the like, I could not figure out how to echo the sum of both (the 56401 being a fixed number). I was wondering if anyone could tell me how I would do it? That might actually help me if I wanted to do something similar in the future on other forums or pages. Here is the code I have right now (not cleaned up yet):

Code: [Select]
global $context, $boarddir, $settings, $options, $scripturl, $user_info, $modSettings;


require($boarddir.'/SSI.php');

echo'
<div style="font-family: verdana, arial, sans-serif;">';

   // more stats
            echo '<b>Members</b>',': ' , isset($modSettings['memberCount']) ?

$modSettings['memberCount'] : $modSettings['totalMembers'] , '

<br /><b>Posts</b>',': '.$modSettings['totalMessages']. '
                                  <br /><b>Topics</b>',': '.$modSettings['totalTopics']. '';

Thanks in advance!

 

Powered by EzPortal