comparison search.php @ 4:c3c31d031945

add passwd in search page
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Thu, 25 Jun 2015 18:29:48 +0200
parents bc6ce492f15d
children 1cf7bb8db5dd
comparison
equal deleted inserted replaced
3:bc6ce492f15d 4:c3c31d031945
1 <?php 1 <?php
2 include_once('config/Lib_mb_utf8.php'); 2 include_once('config/Lib_mb_utf8.php');
3 include_once('config/config.php'); 3 include_once('config/config.php');
4 include_once('search_function.php'); 4 include_once('search_function.php');
5
6 if ( isset($_POST['passwd']) ) {
7 $checkPasswd = 0;
8 } else {
9 $checkPasswd = 1;
10 }
5 ?> 11 ?>
6 12
7 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 13 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
8 <html> 14 <html>
9 <head> 15 <head>
13 <script src="search.js" charset="utf-8"></script> 19 <script src="search.js" charset="utf-8"></script>
14 </head> 20 </head>
15 <body> 21 <body>
16 <script type="text/javascript"> 22 <script type="text/javascript">
17 // prompt to ask the password when open page 23 // prompt to ask the password when open page
18 var password = "3333"; 24 var checkPasswd = <?php echo $checkPasswd?>;
19 var string = prompt("Please enter password", ""); 25 if (checkPasswd == 1) {
20 if(string!=password) { 26 var password = "3333";
21 alert("Wrong password!"); 27 var string = prompt("Please enter password", "");
22 window.location="http://localgazetteers.mpiwg-berlin.mpg.de"; 28 if(string!=password) {
23 } 29 alert("Wrong password!");
30 window.location="http://localgazetteers.mpiwg-berlin.mpg.de";
31 }
32 }
33
24 </script> 34 </script>
25 35
26 <form action='search.php' method='POST'> 36 <form action='search.php' method='POST'>
27 關鍵字: <input type="text" name="keyword" size="100"> (若要搜尋多筆關鍵字請用半型逗號,隔開)<br> 37 關鍵字: <input type="text" name="keyword" size="100"> (若要搜尋多筆關鍵字請用半型逗號,隔開)<br>
28 將結果輸出至: <input type="text" name="filename" size="40">.html (請用英文非空白字元命名)<br> 38 將結果輸出至: <input type="text" name="filename" size="40">.html (請用英文非空白字元命名)<br>
29 <input type="submit" name="search" value="搜尋"> 39 <input type="submit" name="search" value="搜尋">
40 <input type="hidden" name="passwd">
41
30 </form> 42 </form>
31 <br> 43 <br>
32 <div id="search_result"> 44 <div id="search_result">
33 <?php 45 <?php
34 if(isset($_POST['search']) && $_POST['keyword']!='' && $_POST['filename']!=''){ 46 if(isset($_POST['search']) && $_POST['keyword']!='' && $_POST['filename']!=''){