Mercurial > hg > LGSearch
comparison search.php @ 5:1cf7bb8db5dd
modify passwd popup
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Mon, 12 Oct 2015 15:36:13 +0200 |
parents | c3c31d031945 |
children | 4b9ae7d500f9 |
comparison
equal
deleted
inserted
replaced
4:c3c31d031945 | 5:1cf7bb8db5dd |
---|---|
13 <!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"> |
14 <html> | 14 <html> |
15 <head> | 15 <head> |
16 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | 16 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
17 <link href="search.css" type="text/css" rel="stylesheet"/> | 17 <link href="search.css" type="text/css" rel="stylesheet"/> |
18 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script> | 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 | |
19 <script src="search.js" charset="utf-8"></script> | 22 <script src="search.js" charset="utf-8"></script> |
20 </head> | 23 </head> |
21 <body> | 24 <body> |
22 <script type="text/javascript"> | 25 <script type="text/javascript"> |
23 // prompt to ask the password when open page | 26 // prompt to ask the password when open page |
24 var checkPasswd = <?php echo $checkPasswd?>; | 27 var checkPasswd = <?php echo $checkPasswd?>; |
25 if (checkPasswd == 1) { | 28 if (checkPasswd == 1) { |
26 var password = "3333"; | 29 showPopup(); |
27 var string = prompt("Please enter password", ""); | |
28 if(string!=password) { | |
29 alert("Wrong password!"); | |
30 window.location="http://localgazetteers.mpiwg-berlin.mpg.de"; | |
31 } | |
32 } | 30 } |
31 function done() { | |
32 var password = document.getElementById("pass").value; | |
33 $.ajax({ | |
34 url : 'search_function.php', | |
35 async : false, | |
36 type : 'POST', | |
37 data : 'func=checkPassword'+'&password='+password, | |
38 success: function (e) { | |
39 }, | |
40 error: function (e) { | |
41 alert("Internal error when checking password."); | |
42 } | |
43 }).done(function(result) { | |
44 console.log("password checking result: "+result); | |
45 if (result == 1) { | |
46 document.getElementById("popup").style.display = "none"; | |
47 } else { | |
48 // still showing popup | |
49 alert("Wrong password!"); | |
50 showPopup(); | |
51 } | |
52 }); | |
53 }; | |
54 | |
55 function showPopup() { | |
56 // clear previous input | |
57 if (document.getElementById("pass")) { | |
58 document.getElementById("pass").value = ""; | |
59 document.getElementById("popup").style.display = "block"; | |
60 } | |
61 } | |
62 | |
33 | 63 |
64 | |
34 </script> | 65 </script> |
66 | |
67 <div id="popup"> | |
68 <div>Enter Password:</div> | |
69 <input id="pass" type="password"/> | |
70 <button onclick="done()">OK</button> | |
71 </div> | |
35 | 72 |
36 <form action='search.php' method='POST'> | 73 <form action='search.php' method='POST'> |
37 關鍵字: <input type="text" name="keyword" size="100"> (若要搜尋多筆關鍵字請用半型逗號,隔開)<br> | 74 關鍵字: <input type="text" name="keyword" size="100"> (若要搜尋多筆關鍵字請用半型逗號,隔開)<br> |
38 將結果輸出至: <input type="text" name="filename" size="40">.html (請用英文非空白字元命名)<br> | 75 將結果輸出至: <input type="text" name="filename" size="40">.html (請用英文非空白字元命名)<br> |
39 <input type="submit" name="search" value="搜尋"> | 76 <input type="submit" name="search" value="搜尋"> |