|
|
Joined: Jan 2003
Posts: 250
Member
|
|
Member
Joined: Jan 2003
Posts: 250 |
Hi gang, One of the things I really like about WOL is that it gives a great sense of the expansiveness of a site, so we try to track where users are pretty heavily. Sometimes the default mechanism of loading the name of the PHP file into the online table is not enough. For instance if you use PPPro, the PHP entry point is "index", which to WOL looks like you are at the entrance of your site. So, here is a little snippet of code you can add to your ubbt.inc.php file to set where you are in a single line. Just be sure to add the same string you pass as $Where to your online.php languages file. If you are running JustDave's OnlineInfo mod, use this one: function set_site_loc($Where) { <br /> global $dbh, $Username, $Usernumber, $config; <br /> <br /> $currtime = time (); <br /> $currtime = $currtime+($config['adjusttime']*3600); <br /> <br /> $Username_q = addslashes($Username); <br /> $Where_q = addslashes($Where); <br /> $Usernumber_q = addslashes($Usernumber); <br /> $IP = addslashes(find_environmental ("REMOTE_ADDR")); <br /> $aux = ""; <br /> $readperm = ""; <br /> $query = " <br /> REPLACE INTO {$config['tbprefix']}Online <br /> (O_Username,O_Uid,O_Last,O_What,O_Extra,O_Read,O_Type,O_IPaddy) <br /> VALUES ('$Username_q','$Usernumber_q','$currtime','$Where_q','$aux','$readperm','r','$IP') <br /> "; <br /> echo "Q = $query<p>"; <br /> $dbh -> do_query($query); <br />} If not, use this: function set_site_loc($Where) { <br /> global $dbh, $Username, $Usernumber, $config; <br /> <br /> $currtime = time (); <br /> $currtime = $currtime+($config['adjusttime']*3600); <br /> <br /> $Username_q = addslashes($Username); <br /> $Where_q = addslashes($Where); <br /> $Usernumber_q = addslashes($Usernumber); <br /> $aux = ""; <br /> $readperm = ""; <br /> $query = " <br /> REPLACE INTO {$config['tbprefix']}Online <br /> (O_Username,O_Uid,O_Last,O_What,O_Extra,O_Read,O_Type) <br /> VALUES ('$Username_q','$Usernumber_q','$currtime','$Where_q','$aux','$readperm','r') <br /> "; <br /> echo "Q = $query<p>"; <br /> $dbh -> do_query($query); <br />} Have fun!!!
"Some dream of doing great things, while others stay awake and get on with it." -- Anonymous
|
|
|
|
|
Joined: Jan 2003
Posts: 338
Enthusiast
|
|
Enthusiast
Joined: Jan 2003
Posts: 338 |
I dont undestand - what exactly doing this hack?
|
|
|
|
|
Joined: Jan 2003
Posts: 250
Member
|
|
Member
Joined: Jan 2003
Posts: 250 |
Hi slawekl,
Basically if you have places on your site that are not automatically picked up by threads to show in the WOL screen, then you can call the function:
set_site_loc("I am here");
and it will update the Online table with a the string you pass in. If you add an entry into your languages online.php file with a key of the same string you can have WOL display what you want.
For instance, we have a library on our site that uses an index page, but rather than threads picking up "index" as the location for the Online table, I call:
set_site_loc("library");
Then I have the entry:
$ubbt_lang['library'] = "Perusing the Library";
in my online.php file.
So now when a user is in the Library, he shows up that way in WOL.
Make sense?
"Some dream of doing great things, while others stay awake and get on with it." -- Anonymous
|
|
|
|
|
Joined: Feb 2002
Posts: 1,759
Addict
|
|
Addict
Joined: Feb 2002
Posts: 1,759 |
|
|
|
|
|
Joined: Jan 2003
Posts: 250
Member
|
|
Member
Joined: Jan 2003
Posts: 250 |
Some add-on software, like PPPro do not use the conventional var names for things like $Username and $Usernumber... so here is a slight tweak to allow you to perform this task in those cases. <br />function set_site_loc($Where, $uid="", $uname="") { <br /> global $dbh, $Username, $Usernumber, $config; <br /> <br /> if (!$Username) { $Username = $uname; } <br /> if (!$Usernumber) { $Usernumber = $uid; } <br /> <br /> $currtime = time (); <br /> $currtime = $currtime+($config['adjusttime']*3600); <br /> <br /> $Username_q = addslashes($Username); <br /> $Where_q = addslashes($Where); <br /> $Usernumber_q = addslashes($Usernumber); <br /> $IP = addslashes(find_environmental ("REMOTE_ADDR")); <br /> $aux = ""; <br /> $readperm = ""; <br /> $query = " <br /> REPLACE INTO {$config['tbprefix']}Online <br /> (O_Username,O_Uid,O_Last,O_What,O_Extra,O_Read,O_Type) <br /> VALUES ('$Username_q','$Usernumber_q','$currtime','$Where_q','$aux','$readperm','r') <br /> "; <br /> <br /> $dbh -> do_query($query); <br />} <br /> The set_site_loc presumes the existence and population of $Username and $Usernumber. If your PHP page does not populate these vars, you can call it with the extra params and pass them yourself. Don't forget to add in the IP tracking to the query if you need to. Cheers, Chris
Last edited by Raconteur; 03/31/2003 3:19 PM.
"Some dream of doing great things, while others stay awake and get on with it." -- Anonymous
|
|
|
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
|
|
Posts: 5,834
Joined: January 2000
|
|
|
Forums63
Topics37,583
Posts293,955
Members13,824
| |
Most Online151,614 Nov 14th, 2025
|
|
Currently Online 1731
Topics Created 0
Posts Made 0
Users Online 0
Birthdays 20
|
|
|
|