 |
 |
 |
 |
#224311 - 09/09/02 02:54 AM
Re: Who's Online location question.
[Re: neuron]
|
I type Like navaho
Registered: 11/29/01
Posts: 11330
Loc: Charlotte, NC
|
funny you should ask.... I've been playing with this for hours. <img src="/forum/images/icons/crazy.gif" alt="" /><br /><br />There was a hack posted at the photo post site... which I haven't quite got working yet... but it said to add this into all your pages.... change the name of the O_What write for each page... and then add those words to your online.php language file.<br /><br />Here's the code:<br /><br /><pre><font class="small">code:</font><hr><br />$link = mysql_connect("localhost", "dbuser", "password") or die ('I cannot open the UBBThreads database.'); <br />mysql_select_db ("threadsdb",$link)or die("Could not connect to UBBThreads database"); <br /><br />if ( IsSet($w3t_myname) ) $username = $w3t_myname; <br /><br />if ( IsSet($w3t_myid) ) { <br />$query = "SELECT U_Username FROM w3t_Users WHERE U_Number=$w3t_myid"; <br />$queryv = mysql_query($query,$link); <br />$results = mysql_fetch_array($queryv); <br />$username = $results[0]; <br />} <br /><br />if ( $username == "" ) { <br />$IP = $HTTP_SERVER_VARS{'REMOTE_ADDR'}; <br />$username = "-ANON-$IP"; <br />$status="a"; <br />} <br />else $status="r"; <br /><br />$last = time(); <br />$query = "REPLACE INTO w3t_Online <br />(O_Username,O_Last,O_What,O_Extra,O_Read,O_Type) <br />VALUES ('$username','$last','photopost','','','$status')"; <br /><br />$queryv = mysql_query($query,$link); <br />mysql_close( $link );</pre><hr><br /><br />You have to substitue in database name, username and password. Then towards the bottom where it says 'photopost' you put whatever you want there, then add into your language file.<br /><br />BUT... what isn't working for me is the $last<br />I don't get an entry into the table. But if I manually put a number there (within 10 minutes) then it works.... so I don't know if the time(); is what Threads is looking for.<br /><br />When I look at the O_Last field with myphpadmin the time is a big long number which I don't quite understand. <img src="/forum/images/icons/tongue.gif" alt="" /><br /><br />If anyone knows how to tweak this to make it work... you could use it in any PHP page. Even if you aren't sending the threads headers. <img src="/forum/images/icons/smile.gif" alt="" />
|
|
Top
|
|
|
|
 |
 |
 |
 |
 |
 |
 |
 |
#224320 - 09/10/02 02:04 PM
Re: Who's Online location question.
[Re: neuron]
|
I type Like navaho
Registered: 11/29/01
Posts: 11330
Loc: Charlotte, NC
|
I've tried putting it at the bottom. And it works fine if I manually put a number in for the $last value. For some reason it just doesnt' get the time function correct and thus the table must dump it. <br /> <br />I feel I'm close. <br /> <br />This is what I'm trying: <pre><font class="small">code:</font><hr> <br />require("/home/measurection/htdocs/forums/main.inc.php"); <br /> $userob = new user; <br /> $user = $userob -> authenticate(); <br /> $Username = $user['U_Username']; <br /> <br />$link = mysql_connect("localhost", "dbuser", "dbpass") <br /> or die ('I cannot open the UBBThreads database.'); <br />mysql_select_db ("dbname",$link)or die("Could not connect to UBBThreads database"); <br /> <br />if ( $Username == "" ) { <br />$IP = $HTTP_SERVER_VARS{'REMOTE_ADDR'}; <br />$user = "-ANON-$IP"; <br />$status="a"; <br />} <br />else { <br />$status="r"; <br />} <br /> <br />$last = time(); <br />$query = "REPLACE INTO w3t_Online (O_Username,O_Last,O_What,O_Extra,O_Read,O_Type) <br />VALUES ('$Username','$last','photopostindex','','','$status')"; <br /> <br />$queryv = mysql_query($query,$link); <br />mysql_close( $link ); <br /></pre><hr> <br /> <br />Anyone have any idea of how to get the time function to properly call? ubbt.inc.php uses $Last, but that doesn't seem to work either. <img src="/forum/images/icons/confused.gif" alt="" /> <br /> <br />
Edited by JoshPet (09/10/02 02:05 PM)
|
|
Top
|
|
|
|
 |
 |
 |
 |
|
|