Mercurial > hg > LGSearch
annotate search.php @ 6:4b9ae7d500f9
add example page, modify password popup
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Wed, 14 Oct 2015 11:01:26 +0200 |
parents | 1cf7bb8db5dd |
children | 23dcd1b5e9c4 |
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 include_once('config/Lib_mb_utf8.php'); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
3 include_once('config/config.php'); |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
4 include_once('search_function.php'); |
4
c3c31d031945
add passwd in search page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
3
diff
changeset
|
5 |
c3c31d031945
add passwd in search page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
3
diff
changeset
|
6 if ( isset($_POST['passwd']) ) { |
c3c31d031945
add passwd in search page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
3
diff
changeset
|
7 $checkPasswd = 0; |
c3c31d031945
add passwd in search page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
3
diff
changeset
|
8 } else { |
c3c31d031945
add passwd in search page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
3
diff
changeset
|
9 $checkPasswd = 1; |
c3c31d031945
add passwd in search page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
3
diff
changeset
|
10 } |
0
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
11 ?> |
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 <!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
|
14 <html> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
15 <head> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
16 <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
|
17 <link href="search.css" type="text/css" rel="stylesheet"/> |
5 | 18 |
19 <script src="js/jquery/1.6.2/jquery.min.js" type="text/javascript"></script> | |
20 <script src="js/jquery/jquery-ui.js" type="text/javascript"></script> | |
21 | |
0
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
22 <script src="search.js" charset="utf-8"></script> |
6
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
23 <script type="text/javascript"> |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
24 // TODO: hide and show are not working here... |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
25 // after searching, the returning page still shows the popup |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
26 |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
27 // prompt to ask there password when open page |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
28 $(document).ready(function(){ |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
29 initSection(); |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
30 |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
31 var checkPasswd = <?php echo $checkPasswd?>; |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
32 |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
33 |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
34 if (checkPasswd == 1) { |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
35 $("#search").hide(); |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
36 showPopup(); |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
37 console.log("showPopup"); |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
38 } else { |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
39 $("#search").show(); |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
40 closePopup(); |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
41 console.log("closePopup"); |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
42 } |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
43 }); |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
44 |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
45 </script> |
0
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
46 </head> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
47 <body> |
6
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
48 |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
49 |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
50 |
5 | 51 |
6
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
52 <div id="popup"> |
5 | 53 <div>Enter Password:</div> |
6
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
54 <input id="pass" type="password" onKeyPress="return submitenter(event)"/> |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
55 <button onclick="checkPassword()">OK</button> |
5 | 56 </div> |
57 | |
6
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
58 |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
59 <div id="search"> |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
60 <form action='search.php' method='POST'> |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
61 關鍵字: <input type="text" name="keyword" size="100"> (若要搜尋多筆關鍵字請用半型逗號,隔開)<br> |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
62 將結果輸出至: <input type="text" name="filename" size="40">.html (請用英文非空白字元命名)<br> |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
63 <input type="submit" name="search" value="搜尋"> |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
64 <input type="hidden" name="passwd"> |
4
c3c31d031945
add passwd in search page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
3
diff
changeset
|
65 |
6
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
66 </form> |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
67 <br> |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
68 |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
69 <div id="search_result"> |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
70 <?php |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
71 if( isset($_POST['passwd']) && isset($_POST['search']) && $_POST['keyword']!='' && $_POST['filename']!=''){ |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
72 |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
73 $keywordArray=trimKeyword($_POST['keyword']); |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
74 $array=search($keywordArray); |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
75 writeCsvFile($array,$_POST['filename']); |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
76 // write html to search_results folder |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
77 printTable($array,$keywordArray,$_POST['filename'],$NO_TAG); |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
78 |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
79 } |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
80 ?> |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
81 </div> |
0
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
82 </div> |
6
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
83 |
4b9ae7d500f9
add example page, modify password popup
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
84 |
0
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
85 </body> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
86 </html> |
c9363a90b8b5
first commit to development server
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
87 |