function read_state() { global $cache_file; global $default_group; global $max_filename_len; $this->info = array(); $this->support_groups = 0; $this->total['packs'] = 0; $this->total['size'] = 0; $this->total['downl'] = 0; $this->total['xx_gets'] = 0; $this->total['trans'] = 0; $this->total['uptime'] = 0; $this->total['daily'] = 0; $this->total['weekly'] = 0; $this->total['monthly'] = 0; $this->gruppen['*']['packs'] = 0; $this->gruppen['*']['size'] = 0; $this->gruppen['*']['xx_gets'] = 0; $this->gruppen['*']['trans'] = 0; $packs = 0; $fpacks = 0; $fsize = 0; $newfile = 0; $nogroup = 0; $fname = ''; read_sizecache($cache_file); # Read information from the bots textfile # Status aller Bots lesen # Lecture des informations du bot foreach ($this->filenames as $key => $filename) { $this->read_removed($filename); $this->read_status($filename); $filebytes = 0; $filedata = ''; $fp = fopen($filename, 'r'); if ($fp) { $filebytes = filesize($filename); $filedata = fread($fp, $filebytes); fclose($fp); } $filebytes -= 16; # MD% for ($i = 8; $i < $filebytes;) { $tag = get_long(substr($filedata, $i, 4)); $len = get_long(substr($filedata, $i + 4, 4)); if ($len <= 8) { printf(':tag=%d<br>', $tag); printf(":len=%d<br>", $len); print 'Warning: parsing statfile aborted<br>'; $i = $filebytes; break; } switch ($tag) { case 256: # IROFFER_VERSION if (isset($this->total['version'])) { break; } $text = substr($filedata, $i + 8, $len - 8); $tver = clean_names($text); $tver = preg_replace('/,.*$/', '', $tver); $tver = preg_replace('/\\[.*\\]/', '', $tver); $this->total['version'] = $tver; break; case 257: # TIMESTAMP $text = get_long(substr($filedata, $i + 8, 4)); if (isset($this->total['time'])) { if ($this->total['time'] > $text) { break; } } $this->total['time'] = $text; break; case 514: # TOTAL_SENT / Envoi total $text = substr($filedata, $i + 8, $len - 8); $itotal = get_xlong($text); $this->total['downl'] += $itotal; $packs = 0; break; case 515: # TOTAL_UPTIME / Temps total de connexion du Bot $text = substr($filedata, $i + 8, $len - 8); $itotal = get_long($text); $this->total['uptime'] += $itotal; break; case 3072: # XDCCS $chunkdata = substr($filedata, $i, $len); for ($j = 8; $j < $len;) { $jtag = get_long(substr($chunkdata, $j, 4)); $jlen = get_long(substr($chunkdata, $j + 4, 4)); if ($jlen <= 8) { printf(':xtag=%d<br>', $jtag); printf(':xlen=%d<br>', $jlen); print 'Warning: parsing statfile failed<br>'; $jlen = 4; } switch ($jtag) { case 3073: # FILE / Fichier if ($nogroup != 0) { $this->update_group($default_group, $fpacks, $newfile, $tgets, $fsize, $fname); } $nogroup = 1; $newfile = 0; $fsize = 0; $packs++; $text = get_text(substr($chunkdata, $j + 8, $jlen - 8)); $fname = $text; if (!isset($this->seen[$fname])) { $newfile = 1; $this->seen[$fname] = $packs; $this->total['packs']++; $this->gruppen['*']['packs']++; } $fpacks = $this->seen[$fname]; $this->info[$fpacks]['pack'] = $fpacks; if (!isset($this->info[$fpacks]['xx_gets'])) { $this->info[$fpacks]['xx_gets'] = 0; $this->info[$fpacks]['trans'] = 0; } if (isset($this->info[$fpacks]['xx_desc'])) { break; } $text = preg_replace('/^.*[\\/]/', '', $fname); $text = clean_names($text); if ($max_filename_len > 0) { $text = max_name_len($text, $max_filename_len); } $this->info[$fpacks]['xx_desc'] = $text; break; case 3074: # DESCRIPTION $text = get_text(substr($chunkdata, $j + 8, $jlen - 8)); $text = clean_names($text); if ($max_filename_len > 0) { $text = max_name_len($text, $max_filename_len); } $this->info[$fpacks]['xx_desc'] = $text; break; case 3075: # NOTE if (isset($this->info[$fpacks]['xx_note'])) { break; } $text = substr($chunkdata, $j + 8, $jlen - 8); $tnote = clean_names($text); if ($tnote == "") { break; } $this->info[$fpacks]['xx_note'] = $tnote; break; case 3076: # GETS / Envoi $text = substr($chunkdata, $j + 8, $jlen - 8); $tgets = get_long($text); break; case 3079: # MD5SUM_INFO $tmp6 = get_xlong(substr($chunkdata, $j + 8, 8)); if ($tmp6 > 0) { $fsize = $tmp6; } $startmds5 = $j + 36; if ($jlen == 56) { $startmds5 += 4; } $tmd5a = get_long(substr($chunkdata, $startmds5, 4)); $tmd5b = get_long(substr($chunkdata, $startmds5 + 4, 4)); $tmd5c = get_long(substr($chunkdata, $startmds5 + 8, 4)); $tmd5d = get_long(substr($chunkdata, $startmds5 + 12, 4)); $tmd5 = sprintf('%08lx%08lx%08lx%08lx', $tmd5a, $tmd5b, $tmd5c, $tmd5d); $this->info[$fpacks]['xx_md5'] = $tmd5; break; case 3080: # GROUP NAME / Nom du Groupe $nogroup = 0; $this->support_groups = 1; $text = get_text(substr($chunkdata, $j + 8, $jlen - 8)); $gr = $text; $this->update_group($gr, $fpacks, $newfile, $tgets, $fsize, $fname); break; case 3081: # GROUP DESCRIPTION / Description du Groupe if (isset($this->gruppen[$gr]['xx_trno'])) { break; } $text = substr($chunkdata, $j + 8, $jlen - 8); $this->gruppen[$gr]['xx_trno'] = clean_names($text); break; case 3082: # LOCK / Pack Bloqués $this->info[$fpacks]['xx_lock'] = 1; break; case 3086: # CRC32 $text = substr($chunkdata, $j + 8, $jlen - 8); $tcrc = get_long($text); $this->info[$fpacks]['xx_crc'] = sprintf('%08lX', $tcrc); break; } $j += $jlen; $r = $jlen % 4; if ($r > 0) { $j += 4 - $r; } } break; case 3328: # TLIMIT_DAILY_USED $text = substr($filedata, $i + 8, $len - 8); $traffic = get_xlong($text); $this->total['daily'] += $traffic; break; case 3330: # TLIMIT_WEEKLY_USED $text = substr($filedata, $i + 8, $len - 8); $traffic = get_xlong($text); $this->total['weekly'] += $traffic; break; case 3332: # TLIMIT_MONTHLY_USED $text = substr($filedata, $i + 8, $len - 8); $traffic = get_xlong($text); $this->total['monthly'] += $traffic; break; } $i += $len; $r = $len % 4; if ($r > 0) { $i += 4 - $r; } } } if ($nogroup != 0) { $this->update_group($default_group, $fpacks, $newfile, $tgets, $fsize, $fname); } write_sizecache($cache_file); }
} $link .= 'volumen=' . $_GET['volumen']; $par++; } if (isset($_GET['order'])) { if ($par == 0) { $link .= '?'; } else { $link .= '&'; } $link .= 'order=' . $_GET['order']; $par++; } return $link; } read_sizecache($cache_file); $read = ''; # Status aller Bots lesen foreach ($filenames as $key => $filename) { $fp = fopen($filename, 'r'); if ($fp) { $read .= fread($fp, filesize($filename)); fclose($fp); } } $nick2 = ereg_replace('[^A-Za-z_0-9]', '', $nick); $packs = 0; $fpacks = 0; $total['packs'] = 0; $total['size'] = 0; $total['downl'] = 0;