Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Who's online code issues
Old 04-29-2008, 11:40 AM Who's online code issues
Skilled Talker

Posts: 63
Name: Holly Simon
Trades: 0
I'm using a who's online script to generate the users online here

http://www.xfilesnews.com/index.php?...tpage&Itemid=1 - the bar at the bottom, with X users.

I'm trying to implement the bar across several sites (and besides weird css issues at the moment) I can't get the who's online script to work for two sites..

http://fiction.xfilesnews.net/index.php

It's not displaying there.

I have both pieces of code with this:

<?php include('/home/thinkey/public_html/network/online.php')

which is the path to the php script..obviously the script is working, just not on several sites (i'm looking for it to display global users online, therefore, shouldn't it be ok to have my own sites pointing to the same script?)

Anyone out there know the answer to this? Thanks.
Thinkey is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-29-2008, 11:44 AM Re: Who's online code issues
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
It's most likely the cookie which the session key is stored is domain based.

Can you show us the code for the file "/home/thinkey/public_html/network/online.php" please?
__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 04-29-2008, 11:49 AM Re: Who's online code issues
Skilled Talker

Posts: 63
Name: Holly Simon
Trades: 0
Code:
<?
/**
 *
 * TG WHO'S ONLINE
 * Copyright 2005 - 2006 (c) TOXIC GOBLIN
 * http://www.toxicgoblin.com
 * 
 */
 
//Optional Database Connection Information
//**Uncomment the following 2 lines and edit the values if you do not already have an active database connection**
//
$db = mysql_connect("localhost", "db_name", "password") or die("Could not connect");
mysql_select_db("db_name");

//Fetch Time
$timestamp = time();
$timeout = $timestamp - 900;

//Insert User
$insert = mysql_query("INSERT INTO TG_whos_online (timestamp, ip, file) VALUES('$timestamp','".$_SERVER['REMOTE_ADDR']."','".$_SERVER['PHP_SELF']."')") or die("Error in who's online insert query!");
//Delete Users
$delete = mysql_query("DELETE FROM TG_whos_online WHERE timestamp<$timeout") or die("Error in who's online delete query!");
//Fetch Users Online
$result = mysql_query("SELECT DISTINCT ip FROM TG_whos_online") or die("Error in who's online result query!");
$users = mysql_num_rows($result);

//Show Who's Online
if($users == 1) {
print("$users User Online\n");
} else {
print("$users Users Online\n");
}
?>
I've changed the user and name of db and user name - i hope that's ok.

Just an FYI, the script would be located at www.driftmedia.ca/network/online.php through url - so xfilesnews.com and fiction.xfilesnews.net would be calling it from the same path in file (i hope that makes sense.

basically the directory structure is:

pub_html/network/
pub_html/xfilesnew/
pub_html/xfnfic/

just for example - they're all at the same level, just both sites are using different domains.
Thinkey is offline
Reply With Quote
View Public Profile
 
Old 04-29-2008, 12:05 PM Re: Who's online code issues
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
From what I can see, I can only assume the page where it's not working is having problem including the file (There is a bit of lag). I recommend checking that you have not missed a ; somewhere.
__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 04-29-2008, 12:10 PM Re: Who's online code issues
Skilled Talker

Posts: 63
Name: Holly Simon
Trades: 0
Quote:
Originally Posted by rogem002 View Post
From what I can see, I can only assume the page where it's not working is having problem including the file (There is a bit of lag). I recommend checking that you have not missed a ; somewhere.
I copied/pasted the block of code...therefore i doubt it.

It's not working on 2 sites i attempted to paste the code on...what would be the odds that its missing a ; on both if i copied the block of code?
Thinkey is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Who's online code issues
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23397 seconds with 12 queries