Users Online User-defined tag

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
outdoorxtreme1

Users Online User-defined tag

Post by outdoorxtreme1 »

I'm trying to get a {usersonline} tag to work properly. It only shows 1 user online even when there are multiple users online. This script worked properly as an include on a page before I had CMS. Can someone help me. Here is the script. Thanks!


$timestamp=time();                                                                                           
$timeout=$timestamp-$timeoutseconds; 
mysql_connect($server, $db_user, $db_pass) or die ("Useronline Database CONNECT Error");                                                                 
mysql_db_query($database, "INSERT INTO onlyusers VALUES ('$timestamp','$REMOTE_ADDR','$PHP_SELF')") or die("Useronline Database INSERT Error");
mysql_db_query($database, "DELETE FROM onlyusers WHERE timestamp
$online user online";} else {echo "$online users online";}
outdoorxtreme1

Re: Users Online User-defined tag

Post by outdoorxtreme1 »

Could this be because its accessing a different MySQL database than CMS is in?
outdoorxtreme1

Re: Users Online User-defined tag

Post by outdoorxtreme1 »

Do I need to put these database connection variables in a user defined tag? Or will it do it thru CMSMS?

$server = "  ";           
$db_user = "  ";                                 
$db_pass = "  ";                                   
$database = "  ";                 
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: Users Online User-defined tag

Post by Ted »

You need to fill that stuff in.

You CAN use the existing database connection, providing that your tables are in the same database.
outdoorxtreme1

Re: Users Online User-defined tag

Post by outdoorxtreme1 »

Any idea why the IP and the FILE fields are blank in my database? If I use this script on a test.php page it works fine and I can see values in all 3 fields. If I use the script as a user-defined tag in CMSMS only the timestamp field has data in it and the IP and FILE fileds are empty in my SQL database.
outdoorxtreme1

Re: Users Online User-defined tag

Post by outdoorxtreme1 »

Do I need to create a custom module since this script posts to its self?
outdoorxtreme1

Re: Users Online User-defined tag

Post by outdoorxtreme1 »

I am able to get data in all my SQL fields if I use a user-defined tag that has this script in it:

include "http://www.neohoutdoors.com/usersonline.php";

The only problem now is that I get my servers dedicated IP address for everyone that is on my page instead of their own.

Any thoughts?
iNSiPiD

Re: Users Online User-defined tag

Post by iNSiPiD »

Could you paste or attach that script please? PHP files can't be downloaded as raw code from URLs.
Locked

Return to “CMSMS Core”