1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
<?php
include_once ("conf/connexion.php");
$time=date("Y-m-d H:i:s");
if(isset($_SESSION['login']))
{
$login=$_SESSION['login'];
$requete=mysql_query("select * from connectes where login='".$login."' " );
$resultat=mysql_fetch_row($requete);
if($resultat==0)
{
mysql_query("insert into connectes(login,temps,statut)
values('".$login."','".$time."','1')
");
}
else
{
mysql_query("update connectes SET
temps='".$time."',
statut='1'
where login ='".$_SESSION['login']."' ");
}
$date=$resultat['temps'];
$dates=strtotime($date);
$timestamp_5min = time() - (60 * 5);
mysql_query("update connectes SET
temps='".$time."',
statut='0'
where $dates <'".$timestamp_5min."' ");
}
?> |
Partager