* 以下資料限本校 IP 瀏覽，校外請使用 SSL VPN服務 取得本校 IP。

查詢已完成上傳114年度資通安全通識教育訓練學習證明(提醒-主管及同仁每年需要完成3小時以上)

// 2017/10/19 Turn off all error reporting //error_reporting(0); $client_ip = get_client_ip(); if( cidr_match($client_ip, "140.114.0.0/16") or cidr_match($client_ip, "120.127.160.0/19") ) { echo "您的連線 IP: $client_ip\n"; echo "<br>"; echo "<br>"; echo "<hr>"; } else { // Not NTHU IP //$wiki_content = " * ** 您的連線 IP $client_ip 非本校 IP ($client_ip is not an NTHU IP address.)** ."; //$info = array(); //echo p_render('xhtml',p_get_instructions($wiki_content),$info); msg("您的連線 IP $client_ip 非本校 IP ($client_ip is not an NTHU IP address.)", -1); return -1; exit; } // Function to get the client IP address function get_client_ip() { $ipaddress = ''; if (isset($_SERVER['HTTP_CLIENT_IP'])) $ipaddress = $_SERVER['HTTP_CLIENT_IP']; else if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR']; else if(isset($_SERVER['HTTP_X_FORWARDED'])) $ipaddress = $_SERVER['HTTP_X_FORWARDED']; else if(isset($_SERVER['HTTP_FORWARDED_FOR'])) $ipaddress = $_SERVER['HTTP_FORWARDED_FOR']; else if(isset($_SERVER['HTTP_FORWARDED'])) $ipaddress = $_SERVER['HTTP_FORWARDED']; else if(isset($_SERVER['REMOTE_ADDR'])) $ipaddress = $_SERVER['REMOTE_ADDR']; else $ipaddress = 'UNKNOWN'; return $ipaddress; } function cidr_match($ip, $range) { list ($subnet, $bits) = explode('/', $range); $ip = ip2long($ip); $subnet = ip2long($subnet); $mask = -1 << (32 - $bits); $subnet &= $mask; return ($ip & $mask) == $subnet; } echo "<html>\n"; echo "<meta charset=\"UTF-8\" /><script type=\"text/javascript\">\n"; echo " function showHint(str) {\n"; echo " var xmlhttp;\n"; echo " if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari\n"; echo " xmlhttp = new XMLHttpRequest();\n"; echo " }\n"; echo " else {// code for IE6, IE5\n"; echo " xmlhttp = new ActiveXObject(\"Microsoft.XMLHTTP\");\n"; echo " }\n"; echo " xmlhttp.onreadystatechange = function () {\n"; echo " if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {\n"; echo " var result = xmlhttp.responseText;\n"; echo " var obj = JSON.parse(result);//解析json字串為json物件形式\n"; echo " var html = '<table border=1 width=100%>';//\n"; echo " for (var i = 0; i < obj.length; i++) {//\n"; echo " html += '<tr>';//\n"; echo " for (j = 0; j < obj[i].data.length; j++) {\n"; echo " html += '<td>' + obj[i].data[j] + '</td>';\n"; echo " }\n"; echo " html += '</tr>';\n"; echo " }\n"; echo " html += \"</table>\";\n"; echo " document.getElementById(\"order_status\").innerHTML = html;\n"; echo " if (obj.length == 1) //只有一筆代表查不到資料\n"; echo " alert('查無資料');\n"; echo " }\n"; echo " }\n"; echo " var url = \"https://script.google.com/macros/s/AKfycbztUXQb_CPMA4RtZYrXv5ZotCDuKHpgDtZGbbqZiWreXATH45bUd2_St7xCsdQ7u6a4/exec\";\n"; echo " xmlhttp.open(\"get\", url + \"?uid=\" + encodeURIComponent(str), true);\n"; echo " xmlhttp.send();\n"; echo " }\n"; echo " </script>\n"; echo "<p>輸入人事編號：<input id=\"uid\" type=\"text\" /> <input name=\"inq\" onclick=\"showHint(uid.value);\" type=\"button\" value=\"查詢\" /><br />\n"; echo "<span id=\"order_status\"></span></p>\n"; echo "</html>\n";