Jump to content


- - - - -

Need Member Count Script


  • Please log in to reply
15 replies to this topic

#1 cwindham

cwindham

    Member

  • IM Supporters
  • PipPipPip
  • 49 posts
  • Location:North Carolina
  • IPB Version:v3.0.x

Posted 29 October 2008 - 12:13 AM

Hey Guys,

I am looking for a simple script that I can use to put on the main page of my website. All I need to display from my IPB board is the total number of members we have registered.

If someone can help me out with that, I would appreciate it.

Thanks!

#2 Adriano Faria

Adriano Faria

    ...a curious guy...

  • Modders
  • PipPipPipPipPipPipPipPipPipPip
  • 3,268 posts
  • Location:Brazil
  • Real Name:Adriano
  • IPB Version:v3.3.x
Contributor

Posted 29 October 2008 - 12:17 AM

You can use SSI or a php script like:

sql = "select count(id) as cnt from ibf_members


#3 cwindham

cwindham

    Member

  • IM Supporters
  • PipPipPip
  • 49 posts
  • Location:North Carolina
  • IPB Version:v3.0.x

Posted 29 October 2008 - 12:23 AM

I dont know too much about coding. I am just good with installing them ;) If you can provide more details I would appreciate it.

Thanks!

#4 Sean

Sean

    The One Man Show - IB.Bored

  • IM Supporters
  • PipPipPipPipPipPipPipPipPipPip
  • 3,857 posts
  • Location:England, UK
  • Real Name:Sean Ellis
  • IPB Version:v2.3.x
Contributor

Posted 29 October 2008 - 12:30 AM

It's at the bottom in that board stats...

"We have n registered members"

Posted Image

My Free Modifications | For Sale Modifications | Photos of Moi | Services System

My computer is messed up. I can't develop anything until I get my grubby paws a new computer.

I do not offer support via PM or any other messenger service. Please use the forums.


#5 cwindham

cwindham

    Member

  • IM Supporters
  • PipPipPip
  • 49 posts
  • Location:North Carolina
  • IPB Version:v3.0.x

Posted 29 October 2008 - 12:33 AM

Correct, I just dont know the code I would use to generate it on the main page of my website. I currently have a news script I got and I use php include code to display it. Im just a noob as you can see with the actual code to pull that data from the boards to the website.

#6 Sean

Sean

    The One Man Show - IB.Bored

  • IM Supporters
  • PipPipPipPipPipPipPipPipPipPip
  • 3,857 posts
  • Location:England, UK
  • Real Name:Sean Ellis
  • IPB Version:v2.3.x
Contributor

Posted 29 October 2008 - 01:08 AM

Ohhh...

Something like this could be of interest to you ;)

Posted Image

My Free Modifications | For Sale Modifications | Photos of Moi | Services System

My computer is messed up. I can't develop anything until I get my grubby paws a new computer.

I do not offer support via PM or any other messenger service. Please use the forums.


#7 cwindham

cwindham

    Member

  • IM Supporters
  • PipPipPip
  • 49 posts
  • Location:North Carolina
  • IPB Version:v3.0.x

Posted 29 October 2008 - 01:13 AM

Thanks!! I believe this will do the trick. I will post again if something goes wrong ;)

Thanks again!

#8 Sean

Sean

    The One Man Show - IB.Bored

  • IM Supporters
  • PipPipPipPipPipPipPipPipPipPip
  • 3,857 posts
  • Location:England, UK
  • Real Name:Sean Ellis
  • IPB Version:v2.3.x
Contributor

Posted 29 October 2008 - 01:28 AM

If not, use this:

<?php

$host = 'localhost';
$user = 'mysql_username';
$pass = 'mysql_password';
$data = 'database_name';

if( ! ( $db = mysql_connect( $host, $user, $pass ) ) )
{
	die( 'Error: ' . mysql_error() );
}
else if( ! ( mysql_select_db( $data, $db ) ) )
{
	die( 'Error: ' . mysql_error() );
}

$result = mysql_query( "SELECT count(*) as data FROM ibf_members" );

while( $row = mysql_fetch_array( $result ) )
{
	echo "We have {$row['data']} registered members...";
}

?>

That should pull the data you want :)

I havn't tested it but it should work ;)

Posted Image

My Free Modifications | For Sale Modifications | Photos of Moi | Services System

My computer is messed up. I can't develop anything until I get my grubby paws a new computer.

I do not offer support via PM or any other messenger service. Please use the forums.


#9 Martin

Martin

    But but, it's not only only!

  • Management
  • PipPipPipPipPipPipPipPipPipPip
  • 7,081 posts
  • Location:Hammerfest, Norway
  • Real Name:Martin Aronsen
  • IPB Version:v3.2.x
Contributor

Posted 29 October 2008 - 01:58 AM

or
$host = 'localhost';
$user = 'mysql_username';
$pass = 'mysql_password';
$data = 'database_name';
if( ! ( $db = mysql_connect( $host, $user, $pass ) ) )
{
	die( 'Error: ' . mysql_error() );
}
else if( ! ( mysql_select_db( $data, $db ) ) )
{
	die( 'Error: ' . mysql_error() );
}

$result = mysql_query( "SELECT cs_value FROM ibf_cache_store WHERE cs_key='stats'" );
list( $stats ) = mysql_fetch_row( $result );
$stats = unserialize( stripslashes( $stats ) );

// There's the total memers. 
$mem_count = $stats['mem_count'];


// And here are some more info :)
echo "Members: {$mem_count}<br />\n\r
Replies: {$stats['total_replies']}<br />\n\r
Topics: {$stats['total_topics']}<br />\n\r
Last Member: <a href='http://boardaddress.com/index.php?showuser={$stats['last_mem_id']}'>{$stats['last_mem_name']}</a><br />\n\r
Most members online: {$stats['most_count']} @ " . date( 'jS F Y g:iA', $stats['most_date'] );


#10 cwindham

cwindham

    Member

  • IM Supporters
  • PipPipPip
  • 49 posts
  • Location:North Carolina
  • IPB Version:v3.0.x

Posted 29 October 2008 - 02:36 AM

Nevermind, I figured it out.

Edited by cwindham, 29 October 2008 - 02:39 AM.


#11 cwindham

cwindham

    Member

  • IM Supporters
  • PipPipPip
  • 49 posts
  • Location:North Carolina
  • IPB Version:v3.0.x

Posted 29 October 2008 - 02:45 AM

View PostSean, on Oct 28 2008, 09:08 PM, said:

Ohhh...

Something like this could be of interest to you ;)


The forums that support this mod is empty so I thought I would see if you guys knew what was wrong (just let me know if you dont want to help on this). BTW, I tried the code you guys gave me, it works great!! Back to topic...

I get the following error when I go visit the "example" pages

Warning: require_once() [function.require-once]: Unable to access ../ipbwi/ipbsdk_class.inc.php in /home/gwa4life/public_html/ipbwi/examples/member.php on line 18

Warning: require_once(../ipbwi/ipbsdk_class.inc.php) [function.require-once]: failed to open stream: No such file or directory in /home/gwa4life/public_html/ipbwi/examples/member.php on line 18

Fatal error: require_once() [function.require]: Failed opening required '../ipbwi/ipbsdk_class.inc.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/gwa4life/public_html/ipbwi/examples/member.php on line 18

According to some of there post, it says that my forums directory for ipbsdk_conf.inc.php is incorrect, but I have tried everything and I still get those results. Maybe you had an idea of what is wrong.

The ipbsdk_conf.inc.php

<?php
/**
 * Default Configuration File.
 *
 * This should be edited to provide the default settings for your
 * SDK installation. These can be changed at runtime.
 *
 * Designed for Invision Power Board Version 2.2.x and newer
 * This modification is NOT compatible with IPB version 1.*
 *
 * Code (c) since 2007 IPBWI Development Team (attended by Matthias Reuter)
 * Code (c) 2003-2006 IPB SDK Development Team (attended by Cowweb and Pita)
 *
 * http://ipbwi.com
 *
 * @package IPBWI
 * @author IPBWI Development Team
 *
 */

/**
 * The full qualified filesystem path to the folder of your IPB installation.
 * You must add a trailing slash.
 *
 * <b>Default path:</b> $_SERVER['DOCUMENT_ROOT'] . "/forum/"<br>
 * <b>Example path:</b> "/home/public_html/community/forums/"
 *
 * @global string
 * @see DOCUMENT_ROOT
 */
$root_path = '/home/myaccount/public_html/forums/';

/**
 * The full qualified URL to your board without '/index.php'.
 * You must not add a trailing slash.
 *
 * <b>Default URL:</b> 'http://' . $_SERVER['HTTP_HOST'] . '/forum';
 * <b>Example URL:</b> "http://www.mydomain.com/community/forums";
 *
 * @global string
 */
$board_url = 'http://www.mywebsite/forums';

/**
 * The Default SDK Language Pack.
 *
 * Language packs should be named lang_ipbsdk_XX.php where 'XX' is the
 * language and be situated in the lib/ folder.
 * By default, this uses the "en" (English) language pack.
 *
 * @global string
 * @see IPBSDK::set_language()
 */
$sdklang = 'en';

/**
 * Enable Caching of SQL Queries.
 *
 * It is strongly recommended you keep this on unless you want to use alot of SQL Queries :)
 *
 * @global string
 */
$allow_caching = '1';

/**
 * Make login possible on a different domain as the domain where the board is installed.
 *
 * If not set, the board's cookie domain will be used.
 * Do not touch this setting, if you don't know how to use it.
 * 
 * Please insert a dot before the domain.
 * Example: .domain.com
 * Example for subdomain: .site.domain.com
 *
 * @global string
 */
 
$override_cookie_domain = '';

?>

Just let me know if you want a crack at it. Its cool if you dont since you dont support this mod. Thanks again guys!

#12 Sean

Sean

    The One Man Show - IB.Bored

  • IM Supporters
  • PipPipPipPipPipPipPipPipPipPip
  • 3,857 posts
  • Location:England, UK
  • Real Name:Sean Ellis
  • IPB Version:v2.3.x
Contributor

Posted 29 October 2008 - 02:56 AM

It looks like it needs to be configured for your site, have you changed any of that info?

Posted Image

My Free Modifications | For Sale Modifications | Photos of Moi | Services System

My computer is messed up. I can't develop anything until I get my grubby paws a new computer.

I do not offer support via PM or any other messenger service. Please use the forums.


#13 cwindham

cwindham

    Member

  • IM Supporters
  • PipPipPip
  • 49 posts
  • Location:North Carolina
  • IPB Version:v3.0.x

Posted 29 October 2008 - 03:03 AM

Ill be honest with you, if you know how I could implement my ipb board login into my website that would eliminate me having to use the script above. I want to be able to have a members login on my website and that login be tied to my ipb board. If that is possible, I would really appreciate it.

#14 Sean

Sean

    The One Man Show - IB.Bored

  • IM Supporters
  • PipPipPipPipPipPipPipPipPipPip
  • 3,857 posts
  • Location:England, UK
  • Real Name:Sean Ellis
  • IPB Version:v2.3.x
Contributor

Posted 29 October 2008 - 03:08 AM

That system should be all you need to pretty much do anything from IPB.

I'll have a look at it properly with you tommorow if you can't get it working. But that file needs to be edited to reflect your site.

These parts:

$root_path = '/home/myaccount/public_html/forums/';
$board_url = 'http://www.mywebsite/forums';

Example, for here I would change them to:

$root_path = '/home/mikes_website/public_html/forums/';
$board_url = 'http://www.invisionmodding.com';

Posted Image

My Free Modifications | For Sale Modifications | Photos of Moi | Services System

My computer is messed up. I can't develop anything until I get my grubby paws a new computer.

I do not offer support via PM or any other messenger service. Please use the forums.


#15 cwindham

cwindham

    Member

  • IM Supporters
  • PipPipPip
  • 49 posts
  • Location:North Carolina
  • IPB Version:v3.0.x

Posted 29 October 2008 - 03:22 AM

I agree.. it has great options.

I have updated it and I still get the results. Here is my actual code for ipbsdk_conf.inc.php

<?php
/**
 * Default Configuration File.
 *
 * This should be edited to provide the default settings for your
 * SDK installation. These can be changed at runtime.
 *
 * Designed for Invision Power Board Version 2.2.x and newer
 * This modification is NOT compatible with IPB version 1.*
 *
 * Code (c) since 2007 IPBWI Development Team (attended by Matthias Reuter)
 * Code (c) 2003-2006 IPB SDK Development Team (attended by Cowweb and Pita)
 *
 * http://ipbwi.com
 *
 * @package IPBWI
 * @author IPBWI Development Team
 *
 */

/**
 * The full qualified filesystem path to the folder of your IPB installation.
 * You must add a trailing slash.
 *
 * <b>Default path:</b> $_SERVER['DOCUMENT_ROOT'] . "/forum/"<br>
 * <b>Example path:</b> "/home/public_html/community/forums/"
 *
 * @global string
 * @see DOCUMENT_ROOT
 */
$root_path = '/home/gwa4life/public_html/forums/';

/**
 * The full qualified URL to your board without '/index.php'.
 * You must not add a trailing slash.
 *
 * <b>Default URL:</b> 'http://' . $_SERVER['HTTP_HOST'] . '/forum';
 * <b>Example URL:</b> "http://www.mydomain.com/community/forums";
 *
 * @global string
 */
$board_url = 'http://www.gwaclan.com/forums';

/**
 * The Default SDK Language Pack.
 *
 * Language packs should be named lang_ipbsdk_XX.php where 'XX' is the
 * language and be situated in the lib/ folder.
 * By default, this uses the "en" (English) language pack.
 *
 * @global string
 * @see IPBSDK::set_language()
 */
$sdklang = 'en';

/**
 * Enable Caching of SQL Queries.
 *
 * It is strongly recommended you keep this on unless you want to use alot of SQL Queries :)
 *
 * @global string
 */
$allow_caching = '1';

/**
 * Make login possible on a different domain as the domain where the board is installed.
 *
 * If not set, the board's cookie domain will be used.
 * Do not touch this setting, if you don't know how to use it.
 * 
 * Please insert a dot before the domain.
 * Example: .domain.com
 * Example for subdomain: .site.domain.com
 *
 * @global string
 */
 
$override_cookie_domain = '';

?>

I have tried it different ways but same results. I know thats my root directory and you cant get the url to forums wrong.

#16 d3vlabs

d3vlabs

    n00b

  • Members
  • Pip
  • 1 posts
  • Real Name:d3vlabs
  • IPB Version:v3.1.x

Posted 30 July 2011 - 09:11 PM

would this work with latest IPB?

Has anyone got it working at all?

Would this be easier today?




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users