filemtime() doesnt work...

Status
Not open for further replies.

alojzjakob

New Member
Messages
13
Reaction score
0
Points
0
as the title says...

i use this function on my little social network to determine if someone is online or not.. but after server migration this doesnt work...

i tried both absolute and relative paths as parameters of function, but no result...

im on stoli, site is jakob.x10hosting.com/forum

Btw, you did great job after migration, everything is faster and better, congrats and thanx for that ;)

thanks in advance,

Alojz
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
Could you post some code?
I just tested it on a friend's account on Boru and it works fine.

Are you getting error messages or wrong values?

Here is the code I used to test the function:

PHP:
<?php

$m = date ("F d Y H:i:s.", filemtime( 'error_log' )); 

echo $m ;
 ?>
 

alojzjakob

New Member
Messages
13
Reaction score
0
Points
0
hmmm...

works like this you wrote, but i use just

$time_elapsed = date(U) - filemtime($pathtofile);

this gives me the value in seconds

and check if it is less than 600 (10 minutes)

it worked before server move...

here is my code

PHP:
$wd=getcwd();
$wd1=$wd."/users/".$fr[$i]."_onoffstatus";
if ((date(U) - filemtime($wd1))<600){print "<img src=\"skin/friendon.png\">";}
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
For some reason it seems that the PHP clock and the filesystem clock do not agree. On Boru, they are about 3650 seconds apart. I manually edited error_log and then saved and then immediately ran:

PHP:
<?php
$fm = filemtime( 'error_log' );
$m = date ("F d Y H:i:s.", $fm ); 

$u = date( U ) - $fm  ;
$now = date ("F d Y H:i:s." );
echo "File m time: $m <br />Diff: $u<br />Now: $now " ;
 ?>


I will leave a note for Corey/Bryon to check on it.
 

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
The time difference between Boru and its webservers has been corrected.
 

Corey

I Break Things
Staff member
Messages
34,551
Reaction score
204
Points
63
If further assistance is required please re-open this thread or create a new one. You can re-open this thread by clicking on the "Administrative" text at the top of the original post.
 
Status
Not open for further replies.
Top