PageRenderTime 94ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/freestyle riaf PTE/search.php

http://rtoss.googlecode.com/
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
  1. <?php
  2. require_once './conf.php';
  3. require_once './bb2html.php';
  4. echo '
  5. <html><head><title>' . $tit . '</title>
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  7. ' . $style . '
  8. </head>
  9. ' . $body;
  10. echo "<a href='$PHP_SELF'>??</a> <a href=\"./\">????????</a><br>";
  11. $word = $_GET['word'];
  12. if (trim($word) != '') {
  13. $words = preg_split('/(?| )+/', stripslashes($word));
  14. $d = dir($ddir);
  15. while ($ent = $d->read()) {
  16. if (preg_match('/^[0-9]+\\'.$ext.'$/', $ent)) {
  17. $lines = file($ddir . $ent);
  18. list($oname, $oemail, $odate, $ocom, $sub) = explode(',', $lines[0]);
  19. $key = substr($ent, 0, strpos($ent, '.'));
  20. $st = true;
  21. foreach($lines as $num => $line) {
  22. $find = false; //???
  23. for($i = 0; $i < count($words); $i++) {
  24. if ($words[$i] == '') continue; //?????
  25. if (stristr($line, $words[$i])) { // ?????
  26. $find = true; //???
  27. $line = str_replace($words[$i], "<b style='color:green;background-color:#ffff66'>$words[$i]</b>", $line);
  28. } elseif ($andor == 'and') { // AND????????????????
  29. $find = false;
  30. break;
  31. }
  32. }
  33. if ($find) {
  34. if ($st) {
  35. echo "<hr><a href='read.php?key=$key'><font size=4>$sub</font></a> $odate by $oname</b><br>";
  36. $st = false;
  37. }
  38. $num = $num + 1;
  39. list($name, $email, $date, $com) = explode(',', $line);
  40. if ($email != '') {
  41. $name = "<a href=\"mailto:$email\">$name</a>";
  42. }
  43. $com = bb2html($com);
  44. echo "<br><a href='read.php?key=$key&st=$num&to=$num'>$num</a>
  45. <font color=\"forestgreen\"><b>$name</b></font> [ $date ]<br>$com<br>";
  46. }
  47. }
  48. // if(!$find2) echo "<br><br></b>?".htmlspecialchars($word)."????????(;ยด?`) ????<br><br>";
  49. }
  50. }
  51. $d->close();
  52. exit;
  53. }
  54. echo "<form action=\"$PHP_SELF\" method=GET></h3><ul>
  55. <br><br>?????: <input type=text name=word size=10 value=" . htmlspecialchars($word) . ">
  56. <input type=submit value=\" ???? \"><br><font color=red>$err</font><br>";
  57. $d = dir($ddir);
  58. while ($ent = $d->read()) {
  59. if (preg_match('/^[0-9]+\\'.$ext.'$/', $ent))
  60. $tmp[] = substr($ent, 0, strpos($ent, '.'));
  61. }
  62. $d->close();
  63. rsort($tmp);
  64. $suball = file('subback.txt');
  65. foreach($suball as $sub) {
  66. list($key, $subject) = explode(',', $sub);
  67. list($key,) = explode('.', $key);
  68. $up[$key] = $subject;
  69. }
  70. foreach($tmp as $line) {
  71. echo " <a href=read.php?key=$line&ls=50>$line</a>";
  72. echo "??$up[$line]<br>\n";
  73. }
  74. echo '</form></body></html>';