/freestyle riaf PTE/search.php
PHP | 81 lines | 74 code | 6 blank | 1 comment | 11 complexity | 21def90d8046ce0ea2c1ca0f3a37327d MD5 | raw file
Possible License(s): BSD-3-Clause, LGPL-2.1, GPL-3.0, LGPL-3.0, GPL-2.0
- <?php
- require_once './conf.php';
- require_once './bb2html.php';
- echo '
- <html><head><title>' . $tit . '</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- ' . $style . '
- </head>
- ' . $body;
-
- echo "<a href='$PHP_SELF'>??</a> <a href=\"./\">????????</a><br>";
-
- $word = $_GET['word'];
- if (trim($word) != '') {
- $words = preg_split('/(?| )+/', stripslashes($word));
-
- $d = dir($ddir);
- while ($ent = $d->read()) {
- if (preg_match('/^[0-9]+\\'.$ext.'$/', $ent)) {
- $lines = file($ddir . $ent);
- list($oname, $oemail, $odate, $ocom, $sub) = explode(',', $lines[0]);
- $key = substr($ent, 0, strpos($ent, '.'));
- $st = true;
- foreach($lines as $num => $line) {
- $find = false; //???
- for($i = 0; $i < count($words); $i++) {
- if ($words[$i] == '') continue; //?????
- if (stristr($line, $words[$i])) { // ?????
- $find = true; //???
- $line = str_replace($words[$i], "<b style='color:green;background-color:#ffff66'>$words[$i]</b>", $line);
- } elseif ($andor == 'and') { // AND????????????????
- $find = false;
- break;
- }
- }
- if ($find) {
- if ($st) {
- echo "<hr><a href='read.php?key=$key'><font size=4>$sub</font></a> $odate by $oname</b><br>";
- $st = false;
- }
-
- $num = $num + 1;
- list($name, $email, $date, $com) = explode(',', $line);
- if ($email != '') {
- $name = "<a href=\"mailto:$email\">$name</a>";
- }
- $com = bb2html($com);
- echo "<br><a href='read.php?key=$key&st=$num&to=$num'>$num</a>
- <font color=\"forestgreen\"><b>$name</b></font> [ $date ]<br>$com<br>";
- }
- }
- // if(!$find2) echo "<br><br></b>?".htmlspecialchars($word)."????????(;ยด?`) ????<br><br>";
- }
- }
- $d->close();
- exit;
- }
-
- echo "<form action=\"$PHP_SELF\" method=GET></h3><ul>
- <br><br>?????: <input type=text name=word size=10 value=" . htmlspecialchars($word) . ">
- <input type=submit value=\" ???? \"><br><font color=red>$err</font><br>";
-
- $d = dir($ddir);
- while ($ent = $d->read()) {
- if (preg_match('/^[0-9]+\\'.$ext.'$/', $ent))
- $tmp[] = substr($ent, 0, strpos($ent, '.'));
- }
- $d->close();
- rsort($tmp);
-
- $suball = file('subback.txt');
- foreach($suball as $sub) {
- list($key, $subject) = explode(',', $sub);
- list($key,) = explode('.', $key);
- $up[$key] = $subject;
- }
- foreach($tmp as $line) {
- echo " <a href=read.php?key=$line&ls=50>$line</a>";
- echo "??$up[$line]<br>\n";
- }
- echo '</form></body></html>';