![]() |
Possible to Select a Random User from Logged on Users?
We're running a contest and would like to select a random user from the users that are logged on at a specific time on our site. Haven't been able to find a way to do this. Any help is appreciated.
|
I don't know much about this sort of thing, but am starting to research it since I need something similar (random user from ones logged in last week/month).
In theory, you should be able to run a query that will query all the users online at a particular time. In fact, this is already being done by the who's online, so it's just a matter of taking all those user numbers putting them into an array and then selecting a random element from that array, which would correspond to a random user. You could probably even make a cron job that will automatically run the script and email you the username. |
Yep. Look in the $users query for the forum.php page to get an idea of how to find out who is online. You can make that query much simpler for your purposes since you only need the userid. Then pick a random user from that array.
|
Thank you for the post Lynne. :) I'm not a programmer and it was really late when I posted that, lol. Good to know my brain still works at night.
|
All times are GMT. The time now is 02:28 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|