Mercurial > hg > LGSearch
annotate search_locust_temple.php @ 7:23dcd1b5e9c4 default tip
add keywords highlighting on searching result
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Mon, 16 Nov 2015 16:58:39 +0100 |
parents | c9363a90b8b5 |
children |
rev | line source |
---|---|
0
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1 <?php |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
2 |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
3 include_once('config/Lib_mb_utf8.php'); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
4 include_once('config/config.php'); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
5 include_once('search_function.php'); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
6 /* |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
7 set_time_limit(0); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
8 ini_set('memory_limit', '-1'); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
9 |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
10 $link_mysql = mysql_connect($mysql_server, $mysql_user, $mysql_password); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
11 mysql_query("SET NAMES utf8"); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
12 |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
13 if (!$link_mysql) { |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
14 die('Could not connect: ' . mysql_error()); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
15 } |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
16 |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
17 $db_selected = mysql_select_db($mysql_database, $link_mysql); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
18 if (!$db_selected) { |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
19 die ('Can\'t use foo : ' . mysql_error()); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
20 } |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
21 function trimKeyword($keywords){ |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
22 $token=strtok($keywords,","); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
23 while($token!=false){ |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
24 $token=trim($token); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
25 $keywordArray[]=$token; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
26 $token=strtok(","); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
27 } |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
28 return $keywordArray; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
29 } |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
30 |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
31 function search($keywordArray){ |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
32 $condition=""; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
33 foreach($keywordArray as $i=>$keyword){ |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
34 if($i!=0){ |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
35 $condition.=" OR "; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
36 } |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
37 $condition.=" contents.content LIKE '%".$keyword."%' "; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
38 } |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
39 //$query="SELECT books.name AS book_name, books.level1, books.level2, books.period, contents.books_id, contents.line, contents.content FROM contents JOIN books ON contents.books_id = books.id WHERE MATCH (content) AGAINST ('蝗神廟' IN BOOLEAN MODE) ORDER BY contents.books_id, contents.line"; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
40 |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
41 $query="SELECT books.name AS book_name, books.level1, books.level2, books.period, contents.books_id, contents.line, contents.content |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
42 FROM contents |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
43 JOIN books ON contents.books_id = books.id |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
44 WHERE ".$condition." |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
45 ORDER BY contents.books_id, contents.line"; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
46 //WHERE contents.content LIKE '%".$keyword."%' |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
47 $result = mysql_query($query); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
48 //echo "result length: ".mysql_num_rows($result)."<br>"; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
49 //go through each page |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
50 while ($row = mysql_fetch_assoc($result)) { |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
51 //find the sections that includes this page |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
52 $subQuery="SELECT id, name, start_page, end_page |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
53 FROM sections |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
54 WHERE books_id=".$row['books_id']." AND start_page<=".$row['line']." AND end_page>=".$row['line']; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
55 $subResult=mysql_query($subQuery); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
56 $sectionArray=array(); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
57 while($subRow=mysql_fetch_assoc($subResult)){ |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
58 $sectionArray[]=$subRow; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
59 } |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
60 $row['section']=$sectionArray; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
61 |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
62 //find the next page and concatenate |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
63 $subQuery="SELECT content |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
64 FROM contents |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
65 WHERE books_id=".$row['books_id']." AND line=".($row['line']+1); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
66 $subResult=mysql_query($subQuery); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
67 $subRow=mysql_fetch_assoc($subResult); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
68 $row['content'].=$subRow['content']; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
69 |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
70 $resultArray[]=$row; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
71 } |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
72 return $resultArray; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
73 } |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
74 |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
75 function printTable($array,$keywordArray,$filename){ |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
76 //var_dump($array); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
77 //return; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
78 $header='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
79 <html> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
80 <head> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
81 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
82 <link href="../search.css" type="text/css" rel="stylesheet"/> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
83 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
84 <script src="../search.js" charset="utf-8"></script> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
85 </head> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
86 <body>'; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
87 $keywordStr=""; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
88 foreach($keywordArray as $i=>$keyword){ |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
89 if($i!=0){ |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
90 $keywordStr.=", "; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
91 } |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
92 $keywordStr.=$keyword; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
93 } |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
94 $fp=fopen("./search_results/".$filename.".html","w"); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
95 fwrite($fp,$header); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
96 echo sizeof($array)." result(s) of \"".$keywordStr."\" "; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
97 fwrite($fp,sizeof($array)." result(s) of \"".$keywordStr."\"<br><br>"); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
98 $str="<table>"; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
99 $str.="<tr>"; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
100 $str.="<td class='sequence'>#<td class='bookId'>book id<td class='bookName'>book name<td class='level1'>level1<td class='level2'>level2<td class='period'>period<td class='sectionName'>section info<td class='page'>page<td class='content'>content"; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
101 fwrite($fp,$str); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
102 echo $str; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
103 $i=1; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
104 foreach($array as $row){ |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
105 $str="<tr>"; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
106 $str.="<td>".$i; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
107 $str.="<td>".$row['books_id']; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
108 $str.="<td>".$row['book_name']; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
109 $str.="<td>".$row['level1']; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
110 $str.="<td>".$row['level2']; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
111 $str.="<td>".$row['period']; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
112 $str.="<td>"; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
113 fwrite($fp,$str); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
114 echo $str; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
115 foreach($row['section'] as $section){ |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
116 $str="<div class='section'><a href='tagging_text.php?id=".$section['id']."' target='_blank'>".$section['name']."</a>p".$section['start_page']."-".$section['end_page']."</div>"; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
117 echo $str; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
118 $str="<div class='section'><a href='../tagging_text.php?id=".$section['id']."' target='_blank'>".$section['name']."</a>p".$section['start_page']."-".$section['end_page']."</div>"; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
119 fwrite($fp,$str); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
120 } |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
121 $str="<td>".$row['line']; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
122 //$str.="<td>".$row['content']; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
123 $str.="<td>".findLocustTempleDescription($row['content'],$keywordArray,0); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
124 fwrite($fp,$str); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
125 echo $str; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
126 $i++; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
127 } |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
128 |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
129 echo "</table>"; |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
130 fwrite($fp,"</table></body></html>"); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
131 fclose($fp); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
132 } |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
133 */ |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
134 |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
135 ?> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
136 |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
137 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
138 <html> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
139 <head> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
140 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
141 <link href="search.css" type="text/css" rel="stylesheet"/> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
142 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
143 <script src="search.js" charset="utf-8"></script> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
144 </head> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
145 <body> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
146 <form action='search_locust_temple.php' method='POST'> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
147 關鍵字: <input type="text" name="keyword"> (若要搜尋多筆關鍵字請用半型逗號,隔開)<br> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
148 將結果輸出至: <input type="text" name="filename">.html<br> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
149 <input type="submit" name="search" value="搜尋"> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
150 </form> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
151 <br> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
152 <div id="search_result"> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
153 <?php |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
154 if(isset($_POST['search']) && $_POST['keyword']!='' && $_POST['filename']!=''){ |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
155 $keywordArray=trimKeyword($_POST['keyword']); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
156 $array=search($keywordArray); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
157 writeCsvFile($array,$_POST['filename']); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
158 printTable($array,$keywordArray,$_POST['filename'],$LOCUST_TEMPLE); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
159 } |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
160 ?> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
161 </div> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
162 </body> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
163 </html> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
164 |