Jump to content

displaying members with php?


sub7av

Recommended Posts

hello, I have a vbulletin forum and it shows at the bottom of my forum all the registered users that have visited my forum in the past 24 hours.

Does anyone have some ideas how I can echo that code onto my page webpage which is http://mydomain.com/index.php  and my forum is  http://www.mydomain.com/community/index.php 

 

I would like to have my webpage (homepage) to show the registered members either who is online now,  or who have visisted in the past 24 hours, also if possible to be able to click there names and view there profiles as you would do on forum << this is not essential but would be good.

 

I am hoping I can use a basic echo code rather than going through the sql.

If the forum can relay the info already I was thinking I could to?

 

 

I guys at vbulletin said it more of a php issue and I came here

Link to comment
Share on other sites

My suggestion is to open the vBulletin index.php file, find out what part of it generates that statistic, and then call that same function/method (or copy and paste the code) into your own script on whatever page you want it to be included on.  Be sure you include any configuration files, database files, all the stuff which should be included somewhere at the top of vBulletin's index.php will most likely need to be included in your page as well.

Link to comment
Share on other sites

You can also connect directly to the database and select the users from there.

Im not sure how the stuff are made in vBulleting but there must be some field like lastlogin or something in the user table.

So you just make a

$t = time() - 600;  // select users who visited forum on last 10 minutes.

SELECT * FROM user WHERE lastlogin < $t

 

Thats it. Remember you can't have real time statistics with php, only show some stats over last x minutes....

Link to comment
Share on other sites

Do you have access to the vBulletin files from the script you want the information to appear on?  While freenity posted the easiest solution, if you want to do everything with respect to your vBulletin settings, I'd recommend essentially copying and pasting the code from the index.php of vBulletin.  I don't have access to a vBulletin installation, however, but I'm sure a quick google search will shed some light.  I can't imagine you're the first person to want to do this same thing.

Link to comment
Share on other sites

i searched google i cant find anything at all.

I have access to vbull no problem.

All I need is a way to get that bloody annoying info on my main site, so i can have at the bottom of my main page something like..

 

 

why not check out our forum, there are currently:  blah blah blah ect..    active now!

 

 

I can send you a nulled version of the latest release if u want to check the code

Link to comment
Share on other sites

i searched google i cant find anything at all.

I have access to vbull no problem.

All I need is a way to get that bloody annoying info on my main site, so i can have at the bottom of my main page something like..

 

 

why not check out our forum, there are currently:  blah blah blah ect..    active now!

 

 

I can send you a nulled version of the latest release if u want to check the code

 

just see the database and look for a table called users or something.... and see if it has some field called lastlogin or lastvisit......

Link to comment
Share on other sites

should be something like this:

 

$t = time() - 600;
$q = mysql_query("select count(*) FROM users WHERE lastactivity > $t");

echo "online users: ".mysql_result($q,0,0);

 

this will show the amount of online users.

 

to show their usernames do:

 

$t = time() - 600;
$q = mysql_query("select username FROM users WHERE lastactivity > $t");

while ($u = mysql_fetch_array($q))
   echo $u['username']." ";

 

Not sure if the field containing usernames is username, it might be name or nick... change it if needed

Link to comment
Share on other sites

ahhh,  okay  so just say my username is bill500  and my pass is mouse and my datebase name is  bill500_cars

 

is this how I would set my code out and paste into a black .php page to test it?

 

 

$con = mysql_connect('localhost', 'bill500', 'mouse');

mysql_select_db('bill500_cars',$con)

 

 

$t = time() - 600;

$q = mysql_query("select username FROM users WHERE lastactivity > $t");

 

while ($u = mysql_fetch_array($q))

  echo $u['username']." ";

 

$t = time() - 600;

$q = mysql_query("select count(*) FROM users WHERE lastactivity > $t");

 

echo "online users: ".mysql_result($q,0,0);

Link to comment
Share on other sites

yea the username and password i enter is the one i use to login to myphp.

 

the problem is when I paste that script into the tttt.php  (test page to see if it works)  i get this error:

 

my code:  test3zl3.gif

 

errow when i run ttt.php in browser:  Parse error: syntax error, unexpected T_VARIABLE in /home/theroman/public_html/tttt.php on line 8

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.