sub7av Posted February 25, 2008 Share Posted February 25, 2008 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 https://forums.phpfreaks.com/topic/92826-displaying-members-with-php/ Share on other sites More sharing options...
cunoodle2 Posted February 25, 2008 Share Posted February 25, 2008 Its not gonna be a simple echo but you could use php curl to read your own page. Remove all unwanted data and then echo it to your own page. Link to comment https://forums.phpfreaks.com/topic/92826-displaying-members-with-php/#findComment-475606 Share on other sites More sharing options...
sub7av Posted February 25, 2008 Author Share Posted February 25, 2008 how would i go about doing that? thanks for answering Link to comment https://forums.phpfreaks.com/topic/92826-displaying-members-with-php/#findComment-475689 Share on other sites More sharing options...
sub7av Posted February 25, 2008 Author Share Posted February 25, 2008 bump.. Link to comment https://forums.phpfreaks.com/topic/92826-displaying-members-with-php/#findComment-476358 Share on other sites More sharing options...
Bauer418 Posted February 25, 2008 Share Posted February 25, 2008 Why use curl on your own page when you could just include the vBulletin core scripts, connect to your vB database, and run the query yourself. Far less server load. Link to comment https://forums.phpfreaks.com/topic/92826-displaying-members-with-php/#findComment-476366 Share on other sites More sharing options...
sub7av Posted February 25, 2008 Author Share Posted February 25, 2008 nice! never thought about that mate, how would I do that I have been trying for nearly 2 weeks lol Link to comment https://forums.phpfreaks.com/topic/92826-displaying-members-with-php/#findComment-476375 Share on other sites More sharing options...
Bauer418 Posted February 25, 2008 Share Posted February 25, 2008 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 https://forums.phpfreaks.com/topic/92826-displaying-members-with-php/#findComment-476379 Share on other sites More sharing options...
sub7av Posted February 25, 2008 Author Share Posted February 25, 2008 http://www.toyota-4runner.org/ is the site, which part of the index page would I need friend, thanks for helping me by the way I REALLY am greatfull to get this sorted Link to comment https://forums.phpfreaks.com/topic/92826-displaying-members-with-php/#findComment-476397 Share on other sites More sharing options...
freenity Posted February 26, 2008 Share Posted February 26, 2008 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 https://forums.phpfreaks.com/topic/92826-displaying-members-with-php/#findComment-476410 Share on other sites More sharing options...
sub7av Posted February 26, 2008 Author Share Posted February 26, 2008 yeh I think its a users online in last 10 mins or so... I will try what u say now, thanks.. Link to comment https://forums.phpfreaks.com/topic/92826-displaying-members-with-php/#findComment-476412 Share on other sites More sharing options...
sub7av Posted February 26, 2008 Author Share Posted February 26, 2008 actually I dont have a clue about SQL i think i will try and copy and paste some stats from the .index, thaks for heping just I am not near your level lol. Link to comment https://forums.phpfreaks.com/topic/92826-displaying-members-with-php/#findComment-476416 Share on other sites More sharing options...
sub7av Posted February 26, 2008 Author Share Posted February 26, 2008 Bauer418 u here dude ? u can help me?? Link to comment https://forums.phpfreaks.com/topic/92826-displaying-members-with-php/#findComment-476445 Share on other sites More sharing options...
Bauer418 Posted February 26, 2008 Share Posted February 26, 2008 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 https://forums.phpfreaks.com/topic/92826-displaying-members-with-php/#findComment-476479 Share on other sites More sharing options...
sub7av Posted February 26, 2008 Author Share Posted February 26, 2008 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 https://forums.phpfreaks.com/topic/92826-displaying-members-with-php/#findComment-476523 Share on other sites More sharing options...
freenity Posted February 26, 2008 Share Posted February 26, 2008 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 https://forums.phpfreaks.com/topic/92826-displaying-members-with-php/#findComment-476525 Share on other sites More sharing options...
sub7av Posted February 26, 2008 Author Share Posted February 26, 2008 okay I have went into the database and your right, there was a field called "usersonline" here is a screenshot: how do I get my members to be shown on my website with this info? I am a noob at this.. Link to comment https://forums.phpfreaks.com/topic/92826-displaying-members-with-php/#findComment-477005 Share on other sites More sharing options...
sub7av Posted February 26, 2008 Author Share Posted February 26, 2008 also uder a section called "users" there is a field that looks like this? i see one for lastvisit and also last activity: Link to comment https://forums.phpfreaks.com/topic/92826-displaying-members-with-php/#findComment-477011 Share on other sites More sharing options...
freenity Posted February 26, 2008 Share Posted February 26, 2008 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 https://forums.phpfreaks.com/topic/92826-displaying-members-with-php/#findComment-477014 Share on other sites More sharing options...
sub7av Posted February 26, 2008 Author Share Posted February 26, 2008 forgive me if I come across as stupid, but where do I put this code? Link to comment https://forums.phpfreaks.com/topic/92826-displaying-members-with-php/#findComment-477021 Share on other sites More sharing options...
freenity Posted February 26, 2008 Share Posted February 26, 2008 you put it just where you want the users to be shown. But before that you must connect to the mysql server $con = mysql_connect('host', 'user', 'pass'); mysql_select_db('dbname',$con) You have to select the database where your forum is installed. Link to comment https://forums.phpfreaks.com/topic/92826-displaying-members-with-php/#findComment-477022 Share on other sites More sharing options...
sub7av Posted February 26, 2008 Author Share Posted February 26, 2008 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 https://forums.phpfreaks.com/topic/92826-displaying-members-with-php/#findComment-477028 Share on other sites More sharing options...
freenity Posted February 26, 2008 Share Posted February 26, 2008 yes, but the username and pass is NOT your vbulleting username and pass, that should be the username, pass vbulleting is using to connect to the database. That's what you had to enter when it was installed. Link to comment https://forums.phpfreaks.com/topic/92826-displaying-members-with-php/#findComment-477052 Share on other sites More sharing options...
sub7av Posted February 26, 2008 Author Share Posted February 26, 2008 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: 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 https://forums.phpfreaks.com/topic/92826-displaying-members-with-php/#findComment-477064 Share on other sites More sharing options...
freenity Posted February 26, 2008 Share Posted February 26, 2008 on line 6 after mysql_select_db() put ; should be mysql_select_db(.....); Link to comment https://forums.phpfreaks.com/topic/92826-displaying-members-with-php/#findComment-477072 Share on other sites More sharing options...
sub7av Posted February 26, 2008 Author Share Posted February 26, 2008 ohhhhhhhhhhh so close! I did that now I got this: Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/theroman/public_html/tttt.php on line 11 online users: Link to comment https://forums.phpfreaks.com/topic/92826-displaying-members-with-php/#findComment-477080 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.