Location: PHPKode > projects > Advanced Reporting Portal > rustik.php
<?php


header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");    // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");  // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");


require "./connect.inc.php";
$timeout=180;

$FROM=$_GET['FROM'];
$id=$_GET['id'];

$sql_101="SELECT ip from ae_ban";
$sql_h_101 = mysql_query($sql_101) or die ("Could not execute request ! err code : $sql_101");
while(list($t_ip) = mysql_fetch_row($sql_h_101)) {
if ($t_ip==$_SERVER['REMOTE_ADDR']) {die ("You are not welcome anymore !");}
}

//########## Contrôle sur les connections actives de tout le monde ##########
//########## Suppression des connections trop anciennes #####################
$sql_101="SELECT UNIX_TIMESTAMP();";
$sql_h_101 = mysql_query($sql_101) or die ("Could not execute request ! err code : $sql_101");
while(list($t_now) = mysql_fetch_row($sql_h_101)) {
$now=$t_now;
}


$sql_10="SELECT id,last_refresh from ae_users where (connected='1' or connected='2') group by login_name;";
        $sql_h_10 = mysql_query($sql_10) or die ("Could not execute request ! err code : $sql_10");
        while(list($t_id,$t_last_refresh) = mysql_fetch_row($sql_h_10)) {
        if (($now - $t_last_refresh) > $timeout) {
                $sql_12="UPDATE `ae_users` SET `connected` = '0' WHERE `id` = '$t_id';";
                $sql_h_12 = mysql_query($sql_12) or die ("SQL[12] Could not execute request ! err code : $sql_12");
                }
        }


if ($FROM == "disconnect") {
$sql_777 = "UPDATE `ae_users` SET `connected` = 0, `last_refresh` = UNIX_TIMESTAMP() WHERE `id` = '$id';";
$sql_h_777 = mysql_query($sql_777) or die ("Could not execute request ! err code : $sql_7");


$sql_111=<<<EOT
INSERT INTO `ae_la_plage` (`id`, `msg`, `msg_timestamp`, `msg_time`, `msg_color`,`msg_odd`,`userinfo`)
VALUES ('1', '<B>$login_name has left away !</B>', UNIX_TIMESTAMP(), NOW(), 'FF0000','0','Admin');
EOT;
$sql_h_111 = mysql_query($sql_111) or die ("Could not execute request ! err code : $sql_111");


$sql_798 = "UPDATE `ae_users` SET `newsound` = 'logout'";
$sql_h_798 = mysql_query($sql_798) or die ("Could not execute request ! err code : $sql_798");
}


//########## Affichage des utilisateurs connectés (avec connected=1)##########
$sql_9="SELECT count(*) from ae_users where (connected='1' or connected='2');";
        $sql_h_9 = mysql_query($sql_9) or die ("Could not execute request ! err code : $sql_9");
        while(list($t_login_name) = mysql_fetch_row($sql_h_9)) {
        $connected_users=$t_login_name;
        }


print <<<EOT
<HEAD>
<link rel="stylesheet" href="./style.css" type="text/css">
<TITLE>Aerial Chat</TITLE>
</HEAD>


<body bgcolor="#6375D6" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" class="menublanc">
<CENTER>
$Registration
<BR>
<TABLE ROWS=2 COLS=1 border="0" cellspacing="0" cellpadding="0" WIDTH=80% >
<TR>
<TD class="menublanc"><CENTER>


<FORM ACTION="./frame.php" METHOD=POST class="menublanc">
<TABLE COLS=2 WIDTH=50% >
<TR><TD></TD></TR>
<TR><TD class="menublanc"><CENTER>$connected_users connection(s)</CENTER></TD></TR>
</TABLE>

<BR><BR>Login/Password<BR>
<INPUT TYPE=TEXT NAME=LOGIN SIZE=12 class=menubottom>
<INPUT TYPE=PASSWORD NAME=PASSWORD SIZE=12 class=menubottom>
<BR><BR>
<INPUT TYPE=SUBMIT VALUE="Connect !" class=menubottom>
</FORM>
<BR>
</CENTER></TD>
</TR>



</TABLE>
<br><br>
<A href=./xindex.php><DIV class=menujaune>Back.<DIV></A>
</CENTER>
EOT;
$link=mysql_close($link) or die("Could not disconnect");
?>
Return current item: Advanced Reporting Portal