home *** CD-ROM | disk | FTP | other *** search
- <?php
- setlocale(LC_ALL,"ru_RU.CP1251");
- $VERSION="1.4";
- $DIR="..\\..\\..\\";//─Φ≡σΩ≥ε≡Φ , πΣσ φα⌡εΣ ≥± Γ±σ φ≤µφ√σ ⌠αΘδ√, \NetView\Scripts
- $FLISTNAME_ONLINE=$DIR."Online.Searcher_HTTP_State.FileList.txt";
- $FLISTNAME_ALL=$DIR."All.Searcher_HTTP_State.FileList.txt";
- $FCNTNAME=$DIR."counter.txt";
- $FLOGNAME=$DIR."log.txt";
- $SIZEUNIT=1000000;
- $query=""; $type=""; $mode=""; $minsize=""; $maxsize=""; $hosts="";$online="";
- $minsizestr=""; $maxsizestr=""; $invtitle=""; $modestr="";
- if (isset($_GET['query'])) $query=$_GET['query'];
- if (isset($_GET['type'])) $type=$_GET['type'];
- if (isset($_GET['mode'])) $mode=$_GET['mode'];
- if (isset($_GET['minsize'])) $minsize=$_GET['minsize'];
- if (isset($_GET['maxsize'])) $maxsize=$_GET['maxsize'];
- if (isset($_GET['hosts'])) $hosts=$_GET['hosts'];
- if (isset($_GET['online'])) $online=$_GET['online'];
- $querystr=str_replace("\\\"","\"",$query);
- $types[0]="";$types[1]="";$types[2]="";
- switch ($type){
- case "files": $types[1]="selected"; break;
- case "dirs": $types[2]="selected"; break;
- default: $types[0]="selected"; break;
- }
- $cntstr=file($FCNTNAME);
- $counter=$cntstr[0];
- if ($mode=="invisible"){
- $invtitle=" (±Ω≡√≥√Θ ≡σµΦ∞)";
- $modestr="?mode=invisible";
- }
- else
- if (isset($_GET['query'])) $counter++;
- if ($minsize>0) $minsizestr=$minsize;
- if ($maxsize>0) $maxsizestr=$maxsize;
-
- function num_format($num){
- return number_format($num,0,',',' ');
- }
-
- function query_parse($query){ //╧≡σΣΓα≡Φ≥σδⁿφα εß≡αßε≥Ωα τα∩≡ε±α
- $regexp=preg_quote($query); //╧≡σεß≡ατεΓαφΦσ Ω ≡σπ≤δ ≡φε∞≤ Γ√≡αµσφΦ■
- $regexp=str_replace("\\\\\"","",$regexp);
- $regexp=str_replace("/","",$regexp);
- $regexp=str_replace("\\*",".*",$regexp);
- $regexp=str_replace(" ",".*",$regexp);
- while (substr($regexp,0,2)==".*") //╙ΣαδσφΦσ φστφα≈α∙Φ⌡ * Φ ∩≡εßσδεΓ Γ φα≈αδσ Φ Ωεφ÷σ τα∩≡ε±α
- $regexp=substr($regexp,2);
- while (substr($regexp,strlen($regexp)-2)==".*")
- $regexp=substr($regexp,0,strlen($regexp)-2);
- return "/".$regexp."/i";
- }
-
- function name_highlight($str,$matches){ //┬√ΣσδσφΦσ ÷Γσ≥ε∞ ±εΓ∩αΓ°σΘ ≈α±≥Φ
- $pos=$matches[0][1];
- $matchlen=strlen($matches[0][0]);
- return substr($str,0,$pos)."<font color='green'>".$matches[0][0]."</font>".substr($str,$pos+$matchlen);
- }
- ?>
- <head>
- <title>╧εΦ±ΩεΓα ±Φ±≥σ∞α ╠√φΣσΩ±<?php print $invtitle;?></title>
- <link rel='stylesheet' type='text/css' href='styles.css'>
- </head>
- <html>
-
- <form action='' method='get' align='center'>
- <?php
- if ($mode=="invisible")
- print "<input type=hidden name='mode' value='invisible'>";
- ?>
- <table cellpadding=0 cellspacing=0 align='center'>
- <tr><td width=130 valign='center'><img src='logo.gif'>
-
- <td><table cellpadding=0>
- <tr><td><input type=text name='query' size=40 value='<?php print $querystr;?>'>
- <td><select name='type'>
- <?php
- print "<option value='both' $types[0]>╘αΘδ√ Φ ΣΦ≡σΩ≥ε≡ΦΦ</option>";
- print "<option value='files' $types[1]>╘αΘδ√</option>";
- print "<option value='dirs' $types[2]>─Φ≡σΩ≥ε≡ΦΦ</option>";
- ?>
- </select>
- <input type=submit value='═αΘ≥Φ!'>
- <tr><td><font class='itext'>╨ατ∞σ≡:</font>
- ε≥ <input type=text name='minsize' size=5 value='<?php print $minsizestr;?>'>
- Σε <input type=text name='maxsize' size=5 value='<?php print $maxsizestr;?>'> ╠┴
- <td>
-
- <p style="text-indent: 0; word-spacing: 0; line-height: 100%; margin: 0"><input type="checkbox" name="online" value="on"<?php if ($online=="on") print "checked";?>>╥εδⁿΩε ΓΩδ■≈σφφ√σ Ωε∞∩ⁿ■≥σ≡√
-
- <p style="text-indent: 0; word-spacing: 0; line-height: 100%; margin: 0"><font class='itext'>╩ε∞∩ⁿ■≥σ≡:</font><input type=text name='hosts' size=15 value='<?php print $hosts;?>'>
- </table>
-
- </table>
- </form>
-
- <table cellpadding=0 cellspacing=0 width='100%'>
- <tr>
- <td class='smalltext' align='left' width='20%'><b><a href='../'>─≡≤πΦσ ±σ≡ΓΦ±√</a></b>
- <td class='smalltext' align='center' width='20%'><a href='help.php<?php print $modestr;?>'>╩αΩ ≡αßε≥ασ≥ ∩εΦ±Ω?</a>
- <td class='smalltext' align='center' width='30%'>╬ß≡αßε≥αφε <a href='stats.php<?php print $modestr;?>'>τα∩≡ε±εΓ</a>: <b><?php print $counter;?></b>
- <td class='smalltext' align='right' width='30%'><i><b>╠√φΣσΩc <?php print $VERSION;?></b> (±) <a href='mailto:artus@mail.ru'>AlexeyPetrov</a>, 2004</i>
- </table>
-
- <?php
- if (!isset($_GET['query'])) exit();
- ?>
- <hr>
- <table align='center' border=1 cellpadding=1 cellspacing=0 width='100%'>
- <tr class='caption'><td>#<td>╧≤≥ⁿ<td>╚∞ <td width=75>╨ατ∞σ≡<td width=90>╧≡εΓσ≡σφ
- <?php
- list($microtime,$time)=explode(" ",microtime());
-
- $regquery=query_parse($query);
- $reghosts=query_parse($hosts);
- if ($online=="on")$fdata=fopen($FLISTNAME_ONLINE,"r");
- else $fdata=fopen($FLISTNAME_ALL,"r");
-
- $basesize=0;
- for ($num=0,$resnum=0; ($str=fgets($fdata))!=FALSE; $num++){
- list($hostip,$hostname,$path,$name,$size,$ident,$found,$confirm)=explode("|",$str);
- if ($size!=-1) $basesize+=$size;
- //╧≡εΓσ≡Ωα φα ±εε≥Γσ≥±≥ΓΦσ τα∩≡ε±≤ Φ∞σφΦ/∩α≡α∞σ≥≡εΓ ⌠αΘδα/ΣΦ≡σΩ≥ε≡ΦΦ
- if (!preg_match($regquery,$name,$qmatches,PREG_OFFSET_CAPTURE)) continue;
- if ($size==-1){
- if ($type=="files") continue;
- $class="boldrow";
- $sizestr="─Φ≡σΩ≥ε≡Φ ";
- $targetstr="target='_blank'";
- }
- else{
- if ($type=="dirs" || $size<$minsize*$SIZEUNIT || $maxsize>0 && $size>$maxsize*$SIZEUNIT) continue;
- $class="row";
- $sizestr=num_format($size);
- $targetstr="";
- }
-
- //╧≡εΓσ≡Ωα φα ±εε≥Γσ≥±≥ΓΦσ τα∩≡ε±≤ Φ∞σφΦ/αΣ≡σ±α Ωε∞∩ⁿ■≥σ≡α
- if (preg_match($reghosts,$hostip,$hipmatches,PREG_OFFSET_CAPTURE))
- $hostnamestr=name_highlight($hostip,$hipmatches);
- else
- if (preg_match($reghosts,$hostname,$hnmatches,PREG_OFFSET_CAPTURE))
- $hostnamestr=name_highlight($hostname,$hnmatches);
- else continue;
- if (substr($path,0,2)=="\\\\") $path="file:".str_replace("\\","/",$path);
- $pathstr=str_replace($hostip,$hostnamestr,$path);
-
- $namestr=name_highlight($name,$qmatches);
- $resnum++;
- print "<tr class='$class'>";
- print "<td>$resnum ";
- print "<td><a href='$path' target='_blank'>$pathstr</a>";
- print "<td><a href='$path$name' $targetstr>$namestr</a>";
- print "<td>$sizestr";
- print "<td align='center'>$confirm";
- }
- print "</table>";
- fclose($fdata);
-
- list($end_microtime,$end_time)=explode(" ",microtime());
- $duration = (float)$end_time - (float)$time + (float)$end_microtime - (float)$microtime;
- $numstr=num_format($num);
- $basesizestr=num_format($basesize/$SIZEUNIT);
- print "<table width='100%'><tr class='smalltext'>";
- printf ("<td width='50%%' align='center'>┬≡σ∞ Γ√∩εδφσφΦ : <b>%.2f ±σΩ.</b>",$duration);
- print "<td width='50%' align='center'>╩εδΦ≈σ±≥Γε ⌠αΘδεΓ Γ ßατσ: <b>$numstr (<i>$basesizestr ╠┴</i>)</b>";
- print "</table>";
-
- //╟α∩Φ±ⁿ τα∩≡ε±α Γ δεπ-⌠αΘδ ∩≡Φ "εß√≈φε∞" ≡σµΦ∞σ ∩εΦ±Ωα
- if ($mode!="invisible"){
- $fcounter=fopen($FCNTNAME,"w");
- fputs($fcounter,$counter);
- fclose($fcounter);
-
- $flog=fopen($FLOGNAME,"a");
- $date=date("Y-m-d H:i:s");
- $ip=getenv("REMOTE_ADDR");;
- $host=gethostbyaddr($ip);
- $logstr=sprintf("%d|%s|%s|%s|%s|%s|%d|%d|%s|%d|%.2f|%d|%d\n",$counter,$date,$ip,$host,$querystr,$type,$minsize,$maxsize,$hosts,$resnum,$duration,$num,$basesize/$SIZEUNIT);
- fputs($flog,$logstr);
- fclose($flog);
- }
- ?>
-