From e362e8beb12b18b2ef1988770128fbdaec9e265d Mon Sep 17 00:00:00 2001 From: Stephan Poehlsen Date: Wed, 23 Nov 2005 02:25:01 +0000 Subject: erste Version vom Webinterface git-svn-id: file:///home/lennart/svn/public/sse/trunk@34 5fbabb74-0606-0410-a5e4-b5cc6a42724e --- www/file.php | 123 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 www/file.php (limited to 'www/file.php') diff --git a/www/file.php b/www/file.php new file mode 100644 index 0000000..8949c05 --- /dev/null +++ b/www/file.php @@ -0,0 +1,123 @@ +'.$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; + +?> \ No newline at end of file -- cgit