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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.