Location: PHPKode > projects > Advanced Reporting Portal > kernel.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";
require "./content.".$language.".php";

$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 !");}
}


$timeout=180;
$max_msg_displayed=35;
$correction=3;

$COLOR=$_POST['COLOR'];
$refi=$_POST['refi'];
$MSG=$_POST['MSG'];
$MSG=addslashes($MSG);
 
$id=$_POST['id'];
if ($_GET['id']) {$id=$_GET['id'];}


$sql_17="SELECT color,connected,login_name,refresh_time,pilier,channel,msg_display,news_id,news_speed,last_msg_id from ae_users where id='$id'";
$sql_h_17 = mysql_query($sql_17) or die ("Could not execute request ! err code : $sql_17");
while(list($t_color,$t_connected,$t_login_name,$t_refresh_time,$t_pilier,$t_channel,$t_msg_display,$t_news_id,$t_news_speed,$t_last_msg_id) = mysql_fetch_row($sql_h_17)) {
   if ($t_connected == 0) {
        $url="./index.php?login_name=$login_name&id=$id&FROM=disconnect";
        print "<A HREF=$url target=_top>$t_01</A><BR>";
        die ("Déconnection ...");
        }
   $login_name=$t_login_name;
   $connected=$t_connected;
   $color=$t_color;
   $derns=$t_last_msg_id;
   $refresh_time=$t_refresh_time;
   $refresh_pilier=$t_refresh_time;
   $pilier=$t_pilier;
   $channel=$t_channel;
   $oldchannel=$t_channel;
   $msg_display =35;
   $news_id=$t_news_id;
   $news_speed=$t_news_speed;
   }
if ($refi) {$refresh_time=$refi;}
if ($COLOR) {$color=$COLOR;}

if ($MSG and ($connected==2) and $MSG<>"&back") {
        msg_dw ("<small>$login_name $t_02</small>",$channel);
        }

if ($MSG and ($connected<>0)) {
if ($connected==1 or ($MSG=="&back" and $connected==2) or ($connected==3 and strstr ($MSG, "msg"))) {
        $MSG=strip_tags($MSG);
        

	
        if (strstr ($MSG, "http") and !strstr ($MSG, "img")) {
        $web=explode("http",$MSG);
        $web2=explode(" ",$web[1]);
        $web[1]=ereg_replace ($web2[0],"",$web[1]);
        $MSG=$web[0]."<A HREF=http".$web2[0]." target=new>http".$web2[0]."<\/A>";
                sound_dw ("lien",$channel);
        }


        if (!strstr ($MSG, "http") and !strstr ($MSG, "img")) {
        $MSG=ereg_replace ("&h1", "<b><big><big><big><big><big>", $MSG);
        $MSG=ereg_replace ("&z1h_end", "</b></big></big></big></big></big>", $MSG);
        $MSG=ereg_replace ("&h2", "<b><big><big><big><big>", $MSG);
        $MSG=ereg_replace ("&z2h_end", "</b></big></big></big></big>", $MSG);
        $MSG=ereg_replace ("&h3", "<b><big><big><big>", $MSG);
        $MSG=ereg_replace ("&z3h_end", "</b></big></big></big>", $MSG);
        $MSG=ereg_replace ("&h4", "<b><big><big>", $MSG);
        $MSG=ereg_replace ("&z4h_end", "</b></big></big>", $MSG);
        $MSG=ereg_replace ("&h5", "<b><big>", $MSG);
        $MSG=ereg_replace ("&z5h_end", "</b></big>", $MSG);
        $MSG=ereg_replace ("&h6", "<B><FONT size=-2>", $MSG);
        $MSG=ereg_replace ("&z6h_end", "</b></FONT>", $MSG);
        $MSG=ereg_replace ("&h7", "<FONT size=-2>", $MSG);
        $MSG=ereg_replace ("&z7h_end", "</FONT>", $MSG);
        $MSG=ereg_replace ("&zu", "</u>", $MSG);
        $MSG=ereg_replace ("&u", "<u>", $MSG);
        $MSG=ereg_replace ("&zgras", "</b>", $MSG);
        $MSG=ereg_replace ("&gras", "<b>", $MSG);
        $MSG=ereg_replace ("&zi", "</i>", $MSG);
        $MSG=ereg_replace ("&i", "<i>", $MSG);
        $MSG=ereg_replace ("&blink", "<blink>", $MSG);
        $MSG=ereg_replace ("&center", "<div align=center>", $MSG);
        $MSG=ereg_replace ("&right", "<div align=right>", $MSG);
        $MSG=ereg_replace ("&quote", "<FONT size=-1><a style=\'background-color=#606060;color=#FFFFFF;\'>", $MSG);
        $MSG=ereg_replace ("&middle_quote", "</a><a style=\'background-color=#C0C0C0;color=#FFFFFF;\'><i>", $MSG);
        $MSG=ereg_replace ("&end_quote", "</i></a>", $MSG);
        $MSG=ereg_replace ("&stabilo", "<a style=\'background-color=#FFFF00\'>", $MSG);
        $MSG=ereg_replace ("&end_stabilo", "</a>", $MSG);
        }


        $sql_13 = "SELECT code,link FROM ae_smileys";
        $sql_h_13 = mysql_query($sql_13) or die ("Could not execute request ! err code : $sql_13");
        while(list($t_code,$t_link) = mysql_fetch_row($sql_h_13)) {
                $t_link="<IMG SRC=./images/".$t_link.">";
                $MSG=ereg_replace ($t_code, $t_link, $MSG);
                $MSG=ereg_replace ('>²', ' HEIGHT=60TAG_TERMINATOR', $MSG);
                $MSG=ereg_replace ('>§', ' HEIGHT=60TAG_TERMINATOR', $MSG);
                $MSG=ereg_replace ('TAG_TERMINATOR', '>', $MSG);
                }

        $sql_13 = "SELECT chaine1,chaine2 FROM ae_learn";
        $sql_h_13 = mysql_query($sql_13) or die ("Could not execute request ! err code : $sql_13");
        while(list($t_chaine1,$t_chaine2) = mysql_fetch_row($sql_h_13)) {
                if (strstr(strtoupper ($MSG), $t_chaine1)) {
                    $t_chaine2=addslashes($t_chaine2);
$sql_1=<<<EOT
INSERT INTO $channel (`id`, `msg`, `msg_timestamp`, `msg_time`, `msg_color`,`msg_odd`,`userinfo`)
VALUES ('2', '<B>$t_chaine2</B>', UNIX_TIMESTAMP(), NOW(), '004455','0','tatayet')
EOT;
$sql_h_1 = mysql_query($sql_1) or die ("Could not execute request ! err code : $sql_1");
                 }
                }


        if (strstr($MSG,"&") and !strstr($MSG,"http") or strstr($MSG,"img")) {
            $tablo = explode("&",$MSG);
            $tablo2 = explode(" ",$tablo[1]);
            $code=$tablo2[0];
            $tablo[1]=ereg_replace ("&".$code, '', $MSG);

            $chaine=$tablo[1];
            $v=explode(" ",$tablo[1]);
            $k=strlen($v[1])+1;
            $tablo[1]=substr($tablo[1],$k,100);
            $clef=$v[1];
            $reste=$tablo[1];




                if ($code == "news") {
                $chaine=ereg_replace("[\x27\x22]"," ",$chaine);
                $sql_100="INSERT INTO ae_news (`info`) VALUES ('$chaine')";
                $sql_h_100 = mysql_query($sql_100) or die ("Could not execute request ! err code : $sql_100");
                $sql_793 = "UPDATE `ae_users` SET `news_id` = '0' WHERE `login_name` = '$login_name'";
                $sql_h_793 = mysql_query($sql_793) or die ("Could not execute request ! err code : $sql_793");
                $sql_17="SELECT max(id) from ae_news";
                $sql_h_17 = mysql_query($sql_17) or die ("Could not execute request ! err code : $sql_17");
                while(list($t_min_id) = mysql_fetch_row($sql_h_17)) {$min_id=$t_min_id;$min_id=$min_id-20;}
                $sql_4="delete from ae_news where (id<$min_id)";
                $sql_h_4 = mysql_query($sql_4) or die ("Could not execute request ! err code : $sql_4");
                msg_dw ($t_03,$channel);
                $MSG="";
                $lapin=1;
                }


                if ($code == "gt;") {
                        $lapin=1;
                            }


                if ($code == "dwn") {
                $sql_793 = "UPDATE `ae_users` SET `news_id` = '0' WHERE `login_name` = '$login_name'";
                $sql_h_793 = mysql_query($sql_793) or die ("Could not execute request ! err code : $sql_793");
                $MSG="";
                $lapin=1;
                }


                if ($code == "speed") {
                $sql_793 = "UPDATE `ae_users` SET `news_speed` = '$clef' WHERE `login_name` = '$login_name'";
                $sql_h_793 = mysql_query($sql_793) or die ("Could not execute request ! err code : $sql_793");
                $sql_793 = "UPDATE `ae_users` SET `news_id` = '0' WHERE `login_name` = '$login_name'";
                $sql_h_793 = mysql_query($sql_793) or die ("Could not execute request ! err code : $sql_793");
                msg_dw ("$login_name $t_04",$channel);
                $MSG="";
                $lapin=1;
                }


                if ($code == "join") {
                	$new_channel=$clef;
                	$clef="ae_".$clef;
                $sql_179="SELECT id from $clef";
                $sql_h_179 = mysql_query($sql_179);
                if (($clef<>"learn") and ($clef<>"news") and ($clef<>"smileys") and ($clef<>"users") and ($clef<>"ban") and ($clef<>"variables")) {


                if ($sql_h_179) {
                   $sql_774 = "UPDATE `ae_users` SET `channel` = '$clef',`last_msg_id` = 0  WHERE `login_name` = '$login_name'";
                   $sql_h_774 = mysql_query($sql_774) or msg_dw ("Coin");
                   $show_channel=explode("ae_",$oldchannel);
        	   $old_channel_2=$show_channel[1];
                   msg_dw ("$login_name $t_05 $new_channel $t_06","$oldchannel");
                   $channel=$clef;
                   msg_dw ("$login_name $t_07 $old_channel_2 $t_06","$clef");
                   sound_dw ("welcome",$clef);
                   sound_dw ("logout",$oldchannel);
                   }
                else {
                     msg_dw ("$login_name, $clef $t_08","$oldchannel");
                     }
                        }
                    $MSG="";
                $lapin=1;
            }

		if ($code == "create" and $login_name=="Admin") {
		$sql_1="
CREATE TABLE `ae_$clef` (
  id int(10) unsigned NOT NULL default '0',
  msg text NOT NULL,
  msg_timestamp int(14) default NULL,
  msg_time time NOT NULL default '00:00:00',
  msg_color varchar(6) NOT NULL default '',
  msg_odd int(1) NOT NULL default '0',
  userinfo varchar(12) NOT NULL default '',
  msg_id int(11) NOT NULL auto_increment,
  PRIMARY KEY  (msg_id),
  KEY msg_id (msg_id)
) TYPE=MyISAM COMMENT='Franki''s spot !'
";
$sql_h_1 = mysql_query($sql_1) or die ("Could not execute request ! err code : $sql_1");	
			
$sql_9b="
INSERT INTO `ae_variables` ( `nom` , `title` ) 
VALUES (
'ae_$clef', '$t_09'
)
";
$sql_h_9b = mysql_query($sql_9b) or die ("Could not execute request ! err code : $sql_9b");	

                    $MSG="$t_10";
                $lapin=1;
			
		}

		if ($code == "drop" and $login_name=="Admin" and $clef!="la_plage" and $clef!="learn" and $clef!="news" and $clef!="smileys" and $clef!="users" and $clef!="variables" and $clef!="ban") {
$sql_9c="drop table `ae_$clef`";
$sql_h_9c = mysql_query($sql_9c) or die ("Could not execute request ! err code : $sql_9c");	
$sql_9c="delete from `ae_variables` where `nom`='$clef'";
$sql_h_9c = mysql_query($sql_9c) or die ("Could not execute request ! err code : $sql_9c");
                    $MSG="$clef $t_11";
                $lapin=1;
		
		}




           if ($code == "show") {
                    $sql_79 = "SHOW TABLES";
                    $sql_h_79 = mysql_query($sql_79);
                          while(list($t_channel) = mysql_fetch_row($sql_h_79)) {
                                if (($t_channel<>"ae_news") and ($t_channel<>"ae_learn") and ($t_channel<>"ae_smileys") and ($t_channel<>"ae_users") and ($t_channel<>"ae_variables") and ($t_channel<>"ae_ban")) {
                                        $show_channel=explode("ae_",$t_channel);
        				$t_channel=$show_channel[1];
                                        $list=$list." --- ".$t_channel.": ";
                                        $sql_797 = "select login_name from ae_users where channel='ae_$t_channel' and connected<>0";
                                    $sql_h_797 = mysql_query($sql_797);
                                        $login_name_list="";
                                          while(list($t_login_name) = mysql_fetch_row($sql_h_797)) {
                                                $login_name_list=$login_name_list." $t_login_name";
                                                }
                                       
                                        $list=$list."$login_name_list <br>";

                                        }
                                }
                          msg_dw ("$list",$channel);
                          $MSG="";
                          $lapin=1;
                }


           if ($code == "learn") {
                $tablo=explode("=",$chaine);
                $tablo[0]=substr($tablo[0],1);
                $tablo[0]=strtoupper (addslashes($tablo[0]));
                if (strlen($tablo[0])>5 and $tablo[1]) {
                    $sql_79 = "INSERT INTO `ae_learn` (`chaine1`, `chaine2`) VALUES ('$tablo[0]', '$tablo[1]')";
                    $sql_h_79 = mysql_query($sql_79) or msg_dw ("$t_12");
                    msg_dw ("$login_name $t_13",$channel);
                    } else {
                    msg_dw ("$login_name, $t_14",$channel);
                    }
                $MSG="";
                sound_dw ("aha",$channel);
                $lapin=1;
                 }


           if ($code == "forget") {
                $forget=substr($chaine,1);
                $forget=strtoupper (addslashes($forget));
                $sql_79 = "DELETE from `ae_learn` where chaine1='$forget'";
                $sql_h_79 = mysql_query($sql_79) or die ("Could not execute request ! err code : $sql_79");
                msg_dw ("$t_15 $forget...",$channel);
                $MSG="";
                sound_dw ("aha",$channel);
                $lapin=1;
                }


          

          if (($code == "flush") and $login_name=='Admin') {
                 $sql_77 = "UPDATE `ae_users` SET `connected` = 0 WHERE `login_name` = '$clef'";
                 $sql_h_77 = mysql_query($sql_77) or die ("Could not execute request ! err code : $sql_77");
                 msg_dw ("$login_name $t_16 $clef !",$channel);
                 $MSG="";
                sound_dw ("ciao",$channel);
                $lapin=1;
                 }


	if (($code == "silencieux") and $login_name=='Admin') {
                 $sql_77 = "UPDATE `ae_users` SET `connected` = 0 WHERE `login_name` = '$clef';";
                 $sql_h_77 = mysql_query($sql_77) or die ("Could not execute request ! err code : $sql_77");
                 $MSG="";
                sound_dw ("");
                 $lapin=1;
                 }


	if (($code == "suprem") and $login_name=='Admin') {
                 $sql_77 = "DELETE FROM `ae_users` WHERE `login_name` = '$clef';";
                 $sql_h_77 = mysql_query($sql_77) or die ("Could not execute request ! err code : $sql_77");
                 $MSG="";
                sound_dw ("ciao");
                $lapin=1;
                 }



           if ($code == "ttk") {
           $list="";
              $sql_797 = "select chaine1 from ae_learn where chaine2 like '%$clef%'";
              $sql_h_797 = mysql_query($sql_797);
              while(list($t_chaine1) = mysql_fetch_row($sql_h_797)) {
                $list=$list." ".$t_chaine1;
                }
                if ($clef) {
                msg_dw ("$t_17 $list",$channel);
                }
                $MSG="";
                $lapin=1;
                }


           if ($code == "tatayet") {
                $MSG_TATAYER=$chaine;
                $sql_100="INSERT INTO $channel (`id`, `msg`, `msg_timestamp`, `msg_time`, `msg_color`,`userinfo`) VALUES ('2', '$MSG_TATAYER', UNIX_TIMESTAMP(), NOW(),'004455','tatayet')";
                $sql_h_100 = mysql_query($sql_100) or die ("Could not execute request ! err code : $sql_100");
                $MSG="";
                $lapin=1;
                }





           if ($code == "gom") {
                $sql_79 = "UPDATE $channel SET `msg` = '',`userinfo`='Erasor',`msg_time`=NOW()";
                $sql_h_79 = mysql_query($sql_79);
                $MSG="";
                sound_dw ("gom",$channel);
                $lapin=1;
                }


           if ($code == "help") {
                 msg_dw ("$t_18",$channel);
                 $MSG="";
                 sound_dw ("aha",$channel);
                $lapin=1;
                 }




         if ($code == "jail")   {
                 $sql_79 = "UPDATE `ae_users` SET `connected` = 3 WHERE (`connected` = 1 and `login_name` = '$clef' and `channel`='$channel')";
                 
                 if ($clef == "Admin" )  {
                 $sql_79 = "UPDATE `ae_users` SET `connected` = 1 WHERE (`connected` = 3 and `login_name` = '$clef' and `channel`='$channel')";
                 $sql_h_79 = mysql_query($sql_79) or die ("Could not execute request ! err code : $sql_79");
                 msg_dw ("$t_19",$channel);
                 $MSG="";
                 sound_dw ("jail",$channel);
                 $lapin=1; 
                 }
                                  
                 $sql_h_79 = mysql_query($sql_79) or die ("Could not execute request ! err code : $sql_79");
                 msg_dw ("$login_name $t_20 $clef $t_21",$channel);
                 $MSG="";
                sound_dw ("jail",$channel);
                $lapin=1; 
                 }
                 
            
         


         if ($code == "free") {
                 $sql_79 = "UPDATE `ae_users` SET `connected` = 1 WHERE (`connected` = 3 and `login_name` = '$clef')";
                 $sql_h_79 = mysql_query($sql_79) or die ("Could not execute request ! err code : $sql_79");
                 msg_dw ("$clef $t_22",$channel);
                   $MSG="";

                sound_dw ("welcome",$channel);
                $lapin=1;
                 }






         if ($code == "cafe") {
                 $sql_79 = "UPDATE `ae_users` SET `connected` = 2 WHERE `login_name` = '$login_name'";
                 $sql_h_79 = mysql_query($sql_79) or die ("Could not execute request ! err code : $sql_79");
                 msg_dw ("$login_name $t_23",$channel);
                   $MSG="";
                sound_dw ("pause",$channel);
                $lapin=1;
                 }


         if ($code == "miam") {
                 $sql_79 = "UPDATE `ae_users` SET `connected` = 2 WHERE `login_name` = '$login_name'";
                 $sql_h_79 = mysql_query($sql_79) or die ("Could not execute request ! err code : $sql_79");
                 msg_dw ("$login_name $t_24",$channel);
                   $MSG="";
                   sound_dw ("pause",$channel);
                $lapin=1;
                 }


         if ($code == "tel") {
                 $sql_799 = "UPDATE `ae_users` SET `connected` = 2 WHERE `login_name` = '$login_name'";
                 $sql_h_799 = mysql_query($sql_799) or die ("Could not execute request ! err code : $sql_799");
                 msg_dw ("$login_name $t_25",$channel);
                   $MSG="";
                sound_dw ("pause",$channel);
                $lapin=1;
                 }


         if ($code == "pause") {
                 $sql_79 = "UPDATE `ae_users` SET `connected` = 2 WHERE `login_name` = '$login_name'";
                 $sql_h_79 = mysql_query($sql_79) or die ("Could not execute request ! err code : $sql_79");
                 msg_dw ("$login_name $t_26",$channel);
                 $MSG="";
                sound_dw ("pause",$channel);
                $lapin=1;
                 }


         if ($code == "back") {
                 $sql_79 = "UPDATE `ae_users` SET `connected` = 1 WHERE (`connected` = 2 and `login_name` = '$login_name')";
                 $sql_h_79 = mysql_query($sql_79) or die ("Could not execute request ! err code : $sql_79");
                 msg_dw ("$login_name $t_27",$channel);
                   $MSG="";
                sound_dw ("welcome",$channel);
                $lapin=1;
                 }


         if ($code == "medor" and $login_name=='Admin') {
                 $sql_7900 = "SELECT ip,browser FROM `ae_users` WHERE login_name='$clef'";
                 $sql_h_7900 = mysql_query($sql_7900) or die ("Could not execute request ! err code : $sql_7900");
                 while(list($t_ip,$t_browser) = mysql_fetch_row($sql_h_7900)) {
                 	$identifier=$t_ip;
                 	$tablox=explode("#",$t_ip);
                 	$ip=$tablox[0];
                 	$ip_forwarded=$tablox[1];
                 	$browser=$t_browser;
                 	}
                 $sql_7900 = "SELECT login_name FROM `ae_users` WHERE ip = '$identifier'";
                 $sql_h_7900 = mysql_query($sql_7900) or die ("Could not execute request ! err code : $sql_7900");
                 while(list($t_occ) = mysql_fetch_row($sql_h_7900)) {
                        if ($t_occ <> $clef) {$list=$list." ".$t_occ;}
                        }
                        
                 $sql_7900 = "SELECT login_name FROM `ae_users` WHERE ip like '%$ip%'";
                 $sql_h_7900 = mysql_query($sql_7900) or die ("Could not execute request ! err code : $sql_7900");
                 while(list($t_occ) = mysql_fetch_row($sql_h_7900)) {
                        if ($t_occ <> $clef) {$list2=$list2." ".$t_occ;}
                        }
                        
                        $host = gethostbyaddr($ip);
                 $new_msg="Hôte: $host<br>Browser: $browser<br>Local ip:$ip_forwarded<br>Public ip:$ip<br><br>$clef is also $list<br>$clef has the same provider as $list2<br><br><a target=medor HREF=http://www.ripe.net/perl/whois?form_type=advanced&full_query_string=&searchtext=$REMOTE_ADDR&inverse_attributes=None&ip_search_lvl=Default&alt_database=ALL&object_type=All&Simple+search=Simple+search>RIPE it!</a><br><a href=http://visualroute.brd.net.au/>Visualroute !</a>";
                 $sql_80 = "UPDATE `ae_users` SET `private_msg` = '$new_msg' WHERE `login_name` = '$login_name'";
                 $sql_h_80 = mysql_query($sql_80) or die ("Could not execute request ! err code : $sql_80");
                $MSG="";
                sound_dw ("medor",$channel);
                $lapin=1;
                 }


         if ($code == "medor_ip" and $login_name=='Admin') {
                 $sql_7900 = "SELECT login_name FROM `ae_users` WHERE ip like '%$clef%'";
                 $sql_h_7900 = mysql_query($sql_7900) or die ("Could not execute request ! err code : $sql_7900");
                 while(list($t_occ) = mysql_fetch_row($sql_h_7900)) {
                        if ($t_occ <> $clef) {$list2=$list2." ".$t_occ;}
                        }
                        
                        $host = gethostbyaddr($ip);
                 $new_msg="Hôte: $host<br>$clef has the same provider as $list2<br><br><a target=medor HREF=http://www.ripe.net/perl/whois?form_type=advanced&full_query_string=&searchtext=$REMOTE_ADDR&inverse_attributes=None&ip_search_lvl=Default&alt_database=ALL&object_type=All&Simple+search=Simple+search>RIPE it!</a><br><a href=http://visualroute.brd.net.au/>Visualroute !</a>";
                 $sql_80 = "UPDATE `ae_users` SET `private_msg` = '$new_msg' WHERE `login_name` = '$login_name'";
                 $sql_h_80 = mysql_query($sql_80) or die ("Could not execute request ! err code : $sql_80");
                $MSG="";
                sound_dw ("medor",$channel);
                $lapin=1;
                 }


         if ($code == "ban" and $login_name=='Admin') {
         	 $sql_77 = "UPDATE `ae_users` SET `connected` = 0 WHERE `login_name` = '$clef'";
                 $sql_h_77 = mysql_query($sql_77) or die ("Could not execute request ! err code : $sql_77");
         	
         	
         	 $sql_7900 = "SELECT ip FROM `ae_users` WHERE login_name='$clef'";
                 $sql_h_7900 = mysql_query($sql_7900) or die ("Could not execute request ! err code : $sql_7900");
                 while(list($t_ip) = mysql_fetch_row($sql_h_7900)) {
                 	$tablox=explode("#",$t_ip);
                 	$ip=$tablox[0];
                 	}
         	
         	
         	
		$sql_80 = "INSERT INTO `ae_ban` (`ip`) VALUES ('$ip')";
                $sql_h_80 = mysql_query($sql_80) or die ("Could not execute request ! err code : $sql_80");
                $host = gethostbyaddr($ip);
                $MSG="";
                sound_dw ("alarm",$channel);
                $lapin=1;         	
                msg_dw ("$clef/$host $t_28<br>$host \'s domain is banned.","$channel");       	
        	}


         if ($code == "ban_ip" and $login_name=='Admin') {
         	$sql_77 = "UPDATE `ae_users` SET `connected` = 0 WHERE `ip` like '%$clef%'";
                $sql_h_77 = mysql_query($sql_77) or die ("Could not execute request ! err code : $sql_77");
		$sql_80 = "INSERT INTO `ae_ban` (`ip`) VALUES ('$clef')";
                $sql_h_80 = mysql_query($sql_80) or die ("Could not execute request ! err code : $sql_80");
                $host = gethostbyaddr($clef);
                $MSG="";
                sound_dw ("alarm",$channel);
                $lapin=1;         	
                msg_dw ("$clef/$host $t_28","$channel");       	
        	}



         if ($code == "noban" and $login_name=='Admin') {
         	 $sql_7900 = "SELECT ip FROM `ae_users` WHERE login_name='$clef'";
                 $sql_h_7900 = mysql_query($sql_7900) or die ("Could not execute request ! err code : $sql_7900");
                 while(list($t_ip) = mysql_fetch_row($sql_h_7900)) {
                 	$tablox=explode("#",$t_ip);
                 	$ip=$tablox[0];
                 	}
		$sql_80 = "DELETE FROM `ae_ban` where (ip='$ip')";
                $sql_h_80 = mysql_query($sql_80) or die ("Could not execute request ! err code : $sql_80");
                $MSG="";
                sound_dw ("alarm",$channel);
                $lapin=1;         	
                msg_dw ("$clef $t_29","$channel");   
		}

         if ($code == "noban_ip" and $login_name=='Admin') {
		$sql_80 = "DELETE FROM `ae_ban` where (ip='$clef')";
                $sql_h_80 = mysql_query($sql_80) or die ("Could not execute request ! err code : $sql_80");
                $MSG="";
                sound_dw ("alarm",$channel);
                $lapin=1;         	
                msg_dw ("$clef $t_29","$channel");   
		}


         if ($code == "ban_list") {
                $sql_9897 = "SELECT ip FROM ae_ban";
                $sql_h_9897 = mysql_query($sql_9897) or die ("Could not execute request ! err code : $sql_9897");
                while(list($t_ip) = mysql_fetch_row($sql_h_9897)) {
                	$host = gethostbyaddr($t_ip);
                        $list=$list."   [$t_ip - $host]";
                         }         	
         	
                $MSG="";
                sound_dw ("alarm",$channel);
                $lapin=1;         	
                msg_dw ("list : $list","$channel");   
		}





         if ($code == "msg") {
                $new_msg="[$login_name]".$reste;
                $sql_9897 = "SELECT private_msg FROM ae_users where `login_name`='$clef'";
                $sql_h_9897 = mysql_query($sql_9897) or die ("Could not execute request ! err code : $sql_9897");
                while(list($t_private_msg) = mysql_fetch_row($sql_h_9897)) {
                         $old_msg=$t_private_msg;
                         }
                if ($old_msg) {$new_msg="$new_msg<BR>$old_msg";}
                //$new_msg=addslashes($new_msg);
                 $sql_80 = "UPDATE `ae_users` SET `private_msg` = '$new_msg' WHERE `login_name` = '$clef'";
                 $sql_h_80 = mysql_query($sql_80) or die ("Could not execute request ! err code : $sql_80");
                 $MSG="";
                sound_dw ("alarm",$channel);
                $lapin=1;
         }

         if ($code == "clean") {
                        $sql_80 = "UPDATE `ae_users` SET `private_msg` = 'clean' WHERE `login_name` = '$login_name'";
                 $sql_h_80 = mysql_query($sql_80) or die ("Could not execute request ! err code : $sql_80");
                 $MSG="";
                 sound_dw ("ponk",$channel);
                        $lapin=1;
                        }


         if ($code == "img") {
                   $MSG="<IMG SRC=$chaine>";
                   sound_dw ("image",$channel);
                $lapin=1;
                   }


         if ($code == "title") {
                 $chaine=substr($chaine,1,80);
                 //$chaine=addslashes($chaine);
                 $sql_79 = "UPDATE `ae_variables` SET `title` = '$chaine' where `nom`='$channel'";
                 $sql_h_79 = mysql_query($sql_79) or die ("Could not execute request ! err code : $sql_79");
                 msg_dw ("$login_name $t_30","$channel");
                   $MSG="";
                sound_dw ("title",$channel);
                $lapin=1;
                 }


         if ($code == "sound") {
                 $sql_7977 = "UPDATE `ae_users` SET `sound` = '$clef' WHERE `id` = '$id'";
                 $sql_h_7977 = mysql_query($sql_7977) or die ("Could not execute request ! err code : $sql_7977");
                   if ($clef=="on" or $clef=="mp3") {msg_dw ("$login_name $t_31 $clef !","$channel");} else {msg_dw ("$login_name turned off the sound.");}
                   $MSG="";
                   sound_dw ("alarm",$channel);
                $lapin=1;
                 }


         if ($code == "hello") {
                 $MSG="";
                 $sql_99="SELECT login_name from ae_users where (connected='1' or connected='2') group by login_name";
                 $sql_h_99 = mysql_query($sql_99) or die ("Could not execute request ! err code : $sql_99");
                 while(list($t_login_name) = mysql_fetch_row($sql_h_99)) {
                               $MSG=$MSG.", ".$t_login_name;
                               }
                 $MSG=ereg_replace (", ".$login_name, "", $MSG);
                 $MSG="$t_32".$MSG." ! ".$chaine;
                sound_dw ("hello",$channel);
                $lapin=1;
                 }


         if ($code == "eq") {
                  $sql_199="UPDATE ae_users set eq='1' where (connected='1' or connected='2')";
                 $sql_h_199 = mysql_query($sql_199) or die ("Could not execute request ! err code : $sql_199");
                 $MSG="";
                sound_dw ("eq",$channel);
                     msg_dw ("<BIG><BIG>$chaine</BIG></BIG>",$channel);
                  $lapin=1;
                 }


         if ($code == "hook") {
                  $sql_199="UPDATE ae_users set eq='2' where (connected='1' or connected='2')";
                 $sql_h_199 = mysql_query($sql_199) or die ("Could not execute request ! err code : $sql_199");
                 $MSG="";
                sound_dw ("eq",$channel);
                     msg_dw ("<BIG><BIG>$chaine</BIG></BIG>",$channel);
                  $lapin=1;
                 }


                if ($code == "bzh") {
                 $sql_79 = "UPDATE `ae_users` SET `filter` = 'Alpha(opacity=200, finishopacity=5, style=2)'";
                 $sql_h_79 = mysql_query($sql_79) or die ("Could not execute request ! err code : $sql_79");
                $lapin=1;
                sound_dw ("ms",$channel);
                msg_dw("$t_33",$channel);
                $MSG=$chaine;
                }


                if ($code == "netb") {
                 $sql_79 = "UPDATE `ae_users` SET `filter` = 'Gray()'";
                 $sql_h_79 = mysql_query($sql_79) or die ("Could not execute request ! err code : $sql_79");
                $lapin=1;
                sound_dw ("ms",$channel);
                msg_dw("$t_34",$channel);
                $MSG=$chaine;
                }


                if ($code == "alize") {
                 $sql_79 = "UPDATE `ae_users` SET `filter` = 'Blur(strength=80)'";
                 $sql_h_79 = mysql_query($sql_79) or die ("Could not execute request ! err code : $sql_79");
                $lapin=1;
                sound_dw ("ms",$channel);
                msg_dw("$t_35",$channel);
                $MSG=$chaine;
                }


                if ($code == "acontre") {
                 $sql_79 = "UPDATE `ae_users` SET `filter` = 'fliph()'";
                 $sql_h_79 = mysql_query($sql_79) or die ("Could not execute request ! err code : $sql_79");
                $lapin=1;
                sound_dw ("ms",$channel);
                msg_dw("$t_36",$channel);
                $MSG=$chaine;
                }


                if ($code == "pushloop") {
                 $sql_79 = "UPDATE `ae_users` SET `filter` = 'flipv()'";
                 $sql_h_79 = mysql_query($sql_79) or die ("Could not execute request ! err code : $sql_79");
                $lapin=1;
                sound_dw ("ms",$channel);
                msg_dw("$t_37",$channel);
                $MSG=$chaine;
                }


                 if ($code == "reset") {
                 $sql_79 = "UPDATE `ae_users` SET `filter`=''";
                 $sql_h_79 = mysql_query($sql_79) or die ("Could not execute request ! err code : $sql_79");
                $lapin=1;
                sound_dw ("reset",$channel);
                msg_dw("Reset.",$channel);
                $MSG="";
                }


        if (!$lapin) {
                msg_dw ("$login_name, $t_38 $code","$channel");$MSG="";
                }
        }
        
        
        }


        if ($MSG and ($connected==1)) {
        	//$MSG=addslashes($MSG);
        $sql_1="INSERT INTO $channel (`id`, `msg`, `msg_timestamp`, `msg_time`, `msg_color`,`userinfo`) VALUES
        ('$id','$MSG', UNIX_TIMESTAMP(), NOW(), '$COLOR','$login_name')";
        $sql_h_1 = mysql_query($sql_1) or die ("Could not execute request ! err code : $sql_1");
        $sql_4="delete from $channel where (msg_id <(LAST_INSERT_ID()-$max_msg_displayed))";
        $sql_h_4 = mysql_query($sql_4) or die ("Could not execute request ! err code : $sql_4");
        }

}

$sql_989 = "SELECT title FROM ae_variables where nom='$channel'";
$sql_h_989 = mysql_query($sql_989) or die ("Could not execute request ! err code : $sql_989");
while(list($t_title) = mysql_fetch_row($sql_h_989)) {$title=$t_title;$title=addslashes($title);
	//$title=ereg_replace("\'"," ",$t_title);
	}

$sql_989 = "SELECT newsound,sound,private_msg,eq,filter,news_id FROM ae_users where id='$id' and $connected<>'2'";
$sql_h_989 = mysql_query($sql_989) or die ("Could not execute request ! err code : $sql_989");
while(list($t_newsound,$t_sound_chk,$t_private_msg,$t_eq,$t_filter,$t_news_id) = mysql_fetch_row($sql_h_989)) {
        $newsound=$t_newsound;
        $sound_chk=$t_sound_chk;
         $private_msg=addslashes("$t_private_msg");
         $eq=$t_eq;
        $XFILTER=$t_filter;
        $news_id=$t_news_id;
        }
if ($newsound and ($sound_chk=="on" or $sound_chk=="mp3")) {
   if ($sound_chk=="mp3") {$extension="mp3";}
   if ($sound_chk=="on") {$extension="wav";}
       $soundx="$newsound.$extension";
        } else $soundx="none";

$sql_9899 = "SELECT info,id FROM ae_news order by id asc";
$sql_h_9899 = mysql_query($sql_9899) or die ("Could not execute request ! err code : $sql_9899");
while(list($t_info,$t_info_id) = mysql_fetch_row($sql_h_9899)) {
      $info="$t_info"." ### ".$info;
      $info_id=$t_info_id;
      }
if ($info_id==$news_id) {$info="";}


$sql_937="SELECT login_name,connected,email,browser,refresh_time,last_refresh,UNIX_TIMESTAMP() from ae_users where (connected='1' or connected='2' or connected='3') and (channel='$channel') order by login_name";
$sql_h_937 = mysql_query($sql_937) or die ("Could not execute request ! err code : $sql_937");
$nb_cx=0;
while(list($t_login_name,$t_connected,$t_email,$t_browser,$t_refresh_time,$t_last_refresh,$now) = mysql_fetch_row($sql_h_937)) {
        $cx=$cx+1;
        $cx_refresh=$cx_refresh+$t_refresh_time;
        if (strstr($t_browser,"X|")) {$version_color="FFFF00";} else {$version_color="C0C0C0";}
        if (strstr($t_login_name,"MATEUR")) {$version_color="33CC99";}
        if ($t_connected == "2") {$away="[pause]";} else {$away="";}
        if ($t_connected == "3") {$away="<FONT COLOR=FF0000>[prison!]</FONT>";}
        $connexion= <<<EOT
<A href=javascript:onClick=userclick2("$t_login_name"); class=menujaune><FONT COLOR=#$version_color>&nbsp;$t_login_name</FONT></A>&nbsp;<A class=menuinfo HREF=javascript:onClick=msgclick("$t_login_name");>msg</A>&nbsp;<A class=menuinfo HREF=MAILTO:$t_email>mail</A>&nbsp;<A class=petit>$away</A><BR>
EOT;
        $connexions="<DIV>".$connexions.$connexion."</DIV>";
        if (($now - $t_last_refresh) > $timeout) {
              $sql_12="UPDATE `ae_users` SET `connected` = '0' WHERE `login_name` = '$t_login_name'";
              $sql_h_12 = mysql_query($sql_12) or die ("SQL[12] Could not execute request ! err code : $sql_12");
              msg_dw("<B>$t_39 $t_login_name [$login_name $t_40]</B>");
              }
        }


$sql_2 = "SELECT MAX(msg_id) FROM $channel";
$sql_h_2 = mysql_query($sql_2) or die ("Could not execute request ! err code : $sql_2");
while(list($t_msg_id) = mysql_fetch_row($sql_h_2)) {
      $last_msg_id=$t_msg_id;
      }
$derns=$derns-$correction;

$sql_2 = "SELECT msg,msg_time,msg_color,userinfo,msg_id,msg_timestamp FROM $channel where (msg_id > ('$derns')) order by msg_timestamp asc";
$sql_h_2 = mysql_query($sql_2) or die ("Could not execute request ! err code : $sql_2");
while(list($t_msg,$t_msg_time,$t_msg_color,$t_userinfo,$t_msg_id,$t_msg_timestamp) = mysql_fetch_row($sql_h_2)) {
        $t_msg=addslashes($t_msg);
print <<<EOT
<SCRIPT>window.parent.TraiteBoard('$t_msg_time','$t_userinfo','$t_msg','$msg_display','$t_msg_color');</SCRIPT>
EOT;
        }

$pilier=$refresh_pilier+$pilier;
$sql_7 = "UPDATE `ae_users` SET `last_msg_id`='$last_msg_id',`news_id`='$info_id',`refresh_time` = '$refresh_time',`newsound` = '',`private_msg` = '',`eq`='',`last_refresh` = UNIX_TIMESTAMP(),`color` = '$color',`pilier`='$pilier'  WHERE `id` = '$id'";
$sql_h_7 = mysql_query($sql_7) or die ("Could not execute request ! err code : $sql_7");
$show_channel=explode("ae_",$channel);
$channel_trunk=$show_channel[1];

$channel="<A class=blanc>$channel_trunk</A>";
$refresh_time="<A class=blanc>$refresh_time</A>";
$cx="$cx users";
$link=mysql_close($link) or die("Could not disconnect");

function msg_dw ($MSG_DW,$channel) {
$sql_1=<<<EOT
INSERT INTO $channel (`id`, `msg`, `msg_timestamp`, `msg_time`, `msg_color`,`msg_odd`,`userinfo`)
VALUES ('1', '<B>$MSG_DW</B>', UNIX_TIMESTAMP(), NOW(), 'FF0000','0','Admin')
EOT;

$sql_h_1 = mysql_query($sql_1) or die ("Could not execute request ! err code : $sql_1");
         }

function sound_dw ($sound,$channel) {
$sql_798 = "UPDATE `ae_users` SET `newsound` = '$sound' where channel='$channel'";
$sql_h_798 = mysql_query($sql_798) or die ("Could not execute request ! err code : $sql_798");
}
?>

<SCRIPT>
window.parent.TraiteReponse('title','<? echo "$title"; ?>');
window.parent.TraiteReponse('channel','<? echo "$channel"?>');
window.parent.TraiteReponse('cx','<?php print "$cx"; ?>');
window.parent.TraiteReponse('connexions','<?php print "$connexions"; ?>');
window.parent.TraiteSon('<? echo "$soundx"; ?>');
window.parent.TraiteFilter('<? echo "$XFILTER"; ?>');
window.parent.TraiteMessage('message','<? echo "$private_msg"?>');
window.parent.eq('<? echo $eq?>');

</SCRIPT>
  
Return current item: Advanced Reporting Portal