'.$sql.mysql_errno()); } if (!($r = mysql_fetch_array($res))) { header('Status: 404 Not Found'); echo('404 Not found!'); exit; } $file = sprintf($r['ppath'], $r['fpath']); ////////////////////////////////////////////////////////////////////////// // txt if ($format == 'txt') { header('Content-type: text/plain'); $fh = @fopen($file, 'r'); if (!$fh) die('failed to open file'); while (!feof($fh)) { $n = rtrim(fgets($fh, 4096)); $n = strtr($n, "\x1\x2\x3\x4\x5\x6\x7\x8\xa\xb\xc\xd\xe\xf\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", ' '); echo($n."\n"); } @fclose($fh); exit; } ////////////////////////////////////////////////////////////////////////// // show echo << Source Search Engine PRINTHEADER; $q = (isset($_REQUEST['q']) ? $_REQUEST['q'] : ''); $s = split_q($q); $pattern = array(); $replacement = array(); $i = 0; foreach ($s as $v) { $pattern[] = '/('.$v.')/i'; $replacement[] = '$1'; $i++; } $fh = @fopen($file, 'r'); if (!$fh) die('failed to open file'); $found = false; $i = 0; echo('
    '); while (!feof($fh)) { echo('
  1. '); $n = fgets($fh, 4096); $n = strtr($n, "\x1\x2\x3\x4\x5\x6\x7\x8\xa\xb\xc\xd\xe\xf\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", ' '); $n = htmlentities($n); $o = preg_replace($pattern, $replacement, $n); if (!$found and $o != $n) { $found = true; echo(''); } $i++; //printf("%4d: %s\n", $i, $i, $i, rtrim($o)); $code = rtrim($o); if (!$code) $code = ' '; printf("
    %s
  2. \n", $i, $code); } echo('
'); fclose($fh); echo << PRINTFOOTER; ?>