我正在尝试显示当前用户,如果他们没有注销,我希望它在关闭浏览器后20秒超时。
登录代码:
<?
$username = $_SESSION['membersusername'];
if(isset($username)){
mysql_query("UPDATE users SET seen=NOW() WHERE username='$username'");
}
?>
显示在线用户:
<?
$check_query_all = mysql_query("SELECT * FROM users WHERE hiddenauth='no' AND seen='Y-m-d H:i:s' ORDER BY id DESC");
while ($display = mysql_fetch_array($check_query_all)) {
$allmembers = $display['name'];
$allusername = $display['username'];
$allbio = $display['bio'];
$allage = $display['age'];
$allseen = $display['seen'];
// get more stuff above if u need
$check_query_all2 = mysql_query("SELECT * FROM profiles WHERE username='$allusername'");
while ($display = mysql_fetch_array($check_query_all2)) {
$allimage = $display['image'];
$alllocation = $display['location'];
// Check Album Photo's
$check_amount = mysql_query("SELECT * FROM users WHERE hiddenauth='no' AND seen='Y-m-d H:i:s'");
$num_djs_total = mysql_num_rows($check_amount);
// CHECK IF IMAGE OR NOT
if ($allimage == "") {
$allcheckedimage = "nopic.gif"; }
// CHECK IF IMAGE OR NOT
if ($allimage != "") {
$allcheckedimage = "$allusername/$allimage"; }
// CHECK IF location OR NOT
if ($alllocation == "") {
$allcheckedlocation = "No Idea"; }
// CHECK IF location OR NOT
if ($alllocation != "") {
$allcheckedlocation = "$alllocation"; }
// CHECK IF mini bio OR NOT
if ($allbio == "") {
$allcheckedbio = "Something about your show."; }
// CHECK IF mini bio OR NOT
if ($allbio != "") {
$allcheckedbio = "$allbio"; }
$listalldjs2 .= "<table class='inlineTable' width='170' height='140' border='0'>
<tr>
<td width='20%' align='center'><a href='$domain/$allusername' /><img src='$domain/profile/$allcheckedimage' width='160' height='120' title='$allusername' /></a> </td>
</tr>
</table> ";
}}
?>
<h2>Online Users</h2>
<? echo $listalldjs2 ?>
退出代码:
<?
$username = $_SESSION['membersusername'];
if(isset($username)){
mysql_query("UPDATE users SET seen='' WHERE username='$username'");
}
?>
我没有iSQL或PDO,因为人们不会更新它的服务器,任何人都可以帮助我吗?