Jump to content

active user issues


Jayden_Blade

Recommended Posts

Hey everyone.

I am trying to show currently active users. It worked on my server but it will not show up on my live server.

 

navigate.php

<?php
error_reporting(E_ALL);
include "/home/jayden1/database_access/dblogincheck.php";

if(isset($_SESSION['username'])){
	$user = $_SESSION['username'];
	$date = date('c');
	mysql_query("replace into navigate ( username, time ) values('$user','$date')");
}


?>

showing the list

<?php 
	error_reporting(E_ALL);
	include ("/home/jayden1/database_access/dblogincheck.php");
        include ("navigate.php");
        $d=date('c',time()-5*60);//last 5 minutes
        $q=mysql_query("SELECT `username` FROM `navigate` WHERE time>'$d'") or die ("query failed to find".mysql_error());
        if(mysql_affected_rows()>0){
	print "<ul>";
	while($users=mysql_fetch_array($q)){
	print "<li>{$users[0]}</li>";
	}
	print "</ul>";
        }
	?>

I just seen that it isn't posting it into the db. Anyone know what I am doing wrong?

Link to comment
https://forums.phpfreaks.com/topic/284221-active-user-issues/
Share on other sites

Hey everyone.

I am trying to show currently active users. It worked on my server but it will not show up on my live server.

 

navigate.php

<?php
error_reporting(E_ALL);
include "/home/jayden1/database_access/dblogincheck.php";

if(isset($_SESSION['username'])){
	$user = $_SESSION['username'];
	$date = date('c');
	mysql_query("replace into navigate ( username, time ) values('$user','$date')");
}


?>

showing the list

<?php 
	error_reporting(E_ALL);
	include ("/home/jayden1/database_access/dblogincheck.php");
        include ("navigate.php");
        $d=date('c',time()-5*60);//last 5 minutes
        $q=mysql_query("SELECT `username` FROM `navigate` WHERE time<>'$d'") or die ("query failed to find".mysql_error());
        if(mysql_num_rows($d)>0){
	print "<ul>";
	while($users=mysql_fetch_array($q)){
	print "<li>{$users[0]}</li>";
	}
	print "</ul>";
        }
	?>

 

 

everything echos fine.

not sure where to go from here.

Link to comment
https://forums.phpfreaks.com/topic/284221-active-user-issues/#findComment-1459896
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.