runnerjp Posted November 5, 2008 Share Posted November 5, 2008 ok when storing the page the users are on it could look like this index.php?page=message&forum=general&id=278&pagenum=last or index.php?page=message&forum=general&id=278 how could i display it so it could fin either in the query... would it be 'http://www.runningprofiles.com/members/index.php?page=message&forum=general&id=$forumpostid%' Link to comment https://forums.phpfreaks.com/topic/131531-solved-showing-users-on-my-page/ Share on other sites More sharing options...
runnerjp Posted November 6, 2008 Author Share Posted November 6, 2008 my whole code is.. getitng the users stuff <?php $timestamp = time(); $timeout = $timestamp - 180; $MyURL = selfURL(0); function selfURL() { $protocol = ($_SERVER["HTTPS"] == "on") ? 'https' : 'http'; $port = (($_SERVER["SERVER_PORT"] == "80") || ($_SERVER["SERVER_PORT"] == "443")) ? '' : ':' . $_SERVER["SERVER_PORT"]; return $protocol . '://' . $_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI']; } $filename = (selfURL()); //Insert User $insert = mysql_query("REPLACE INTO `useronline` SET `timestamp`='$timestamp', `ip`='".$_SERVER['REMOTE_ADDR']."', `file`='$filename',`user`='$username',`user_id`='".$_SESSION['user_id']."'") or die(mysql_error()); ?> and trying to show users on the page <?php $getusersonline="SELECT user_id,user FROM useronline WHERE file = 'http://www.runningprofiles.com/members/index.php?page=message&forum=$forum&id=$forumpostid%' AND timestamp > " . (time() - 900) ; //grab from sql users on in last 15 minutes $getusersonline2=mysql_query($getusersonline) or die("Could not get users"); $num=mysql_num_rows($getusersonline2); echo "$forumpostid <b>There " . ($num != 1 ? "are" : "is") . " $num user" . ($num != 1 ? "s" : "") . " currently viewing the $forum board: </B>"; $tmp = array(); while($getusersonline3=mysql_fetch_array($getusersonline2)) { $tmp[] = "<A href='$getusersonline3[user]'>$getusersonline3[user]</a>"; } echo implode(',',$tmp); ?> Link to comment https://forums.phpfreaks.com/topic/131531-solved-showing-users-on-my-page/#findComment-683600 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.