/*************************************************** some JavaScript functions for ip loger & blocker ver 0.1 by highseek **************************************************/ function decodeURL(str){ var s0, i, j, s, ss, u, n, f; s0 = ""; // decoded str for (i = 0; i < str.length; i++){ // scan the source str s = str.charAt(i); if (s == "+"){s0 += " ";} // "+" should be changed to SP else { if (s != "%"){s0 += s;} // add an unescaped char else{ // escape sequence decoding u = 0; // unicode of the character f = 1; // escape flag, zero means end of this sequence while (true) { ss = ""; // local str to parse as int for (j = 0; j < 2; j++ ) { // get two maximum hex characters for parse sss = str.charAt(++i); if (((sss >= "0") && (sss <= "9")) || ((sss >= "a") && (sss <= "f")) || ((sss >= "A") && (sss <= "F"))) { ss += sss; // if hex, add the hex character } else {--i; break;} // not a hex char., exit the loop } n = parseInt(ss, 16); // parse the hex str as byte if (n <= 0x7f){u = n; f = 1;} // single byte format if ((n >= 0xc0) && (n <= 0xdf)){u = n & 0x1f; f = 2;} // double byte format if ((n >= 0xe0) && (n <= 0xef)){u = n & 0x0f; f = 3;} // triple byte format if ((n >= 0xf0) && (n <= 0xf7)){u = n & 0x07; f = 4;} // quaternary byte format (extended) if ((n >= 0x80) && (n <= 0xbf)){u = (u << 6) + (n & 0x3f); --f;} // not a first, shift and add 6 lower bits if (f <= 1){break;} // end of the utf byte sequence if (str.charAt(i + 1) == "%"){ i++ ;} // test for the next shift byte else {break;} // abnormal, format error } s0 += String.fromCharCode(u); // add the escaped character } } } return s0; } function getCookie( cookieName ) { var search = cookieName + "="; var cookie = decodeURL(document.cookie); // ÇöÀç Äí۰¡ Á¸ÀçÇÒ °æ¿ì if( cookie.length > 0 ) { // ÇØ´ç Äí۸íÀÌ Á¸ÀçÇÏ´ÂÁö °Ë»öÇÑ ÈÄ Á¸ÀçÇϸé À§Ä¡¸¦ ¸®ÅÏ. var startIndex = cookie.indexOf( cookieName ); // ¸¸¾à Á¸ÀçÇÑ´Ù¸é if( startIndex != -1 ) { // °ªÀ» ¾ò¾î³»±â À§ÇØ ½ÃÀÛ À妽º Á¶Àý startIndex += cookieName.length; // °ªÀ» ¾ò¾î³»±â À§ÇØ Á¾·á À妽º ÃßÃâ endIndex = cookie.indexOf( "&", startIndex); // ¸¸¾à Á¾·á À妽º¸¦ ¸øÃ£°Ô µÇ¸é ÄíŰ Àüü±æÀÌ·Î ¼³Á¤ if( endIndex == -1) { endIndex = cookie.indexOf( "%26", startIndex); if( endIndex == -1) { endIndex = document.cookie.length; } } // Äí۰ªÀ» ÃßÃâÇÏ¿© ¸®ÅÏ return cookie.substring( startIndex+1 , endIndex ) ; } else { // ÄíŰ ³»¿¡ ÇØ´ç Äí۰¡ Á¸ÀçÇÏÁö ¾ÊÀ» °æ¿ì return ""; } } else { // ÄíŰ ÀÚü°¡ ¾øÀ» °æ¿ì return ""; } } function setCookie (name,value,expires,path,domain,secure) { document.cookie = name + "=" + escape (value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); } function delete_ip(s) { var regexp=/^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4]\d|[01]?\d\d|\d)\.(25[0-5]|2[0-4]\d|[01]?\d\d|\d)\.(25[0-5]|2[0-4]\d|[01]?\d\d|\d)$/; var temp=regexp.exec(s); if(temp==null) { alert("ip Çü½ÄÀÌ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù"); return false; } else if(confirm("ip "+s+"ÀÇ ±â·ÏÀ» »èÁ¦ÇϽðڽÀ´Ï±î?")) { return true; } else return false; } function delete_id(s) { if (confirm("¾ÆÀ̵ð "+s+"´ÔÀÇ ±â·ÏÀ» »èÁ¦ÇϽðڽÀ´Ï±î?")) { return true; } else return false; } function search_ip(s) { var regexp=/^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4]\d|[01]?\d\d|\d)\.(25[0-5]|2[0-4]\d|[01]?\d\d|\d)\.(25[0-5]|2[0-4]\d|[01]?\d\d|\d)$/; var temp=regexp.exec(s); if(temp==null) { alert("ip Çü½ÄÀÌ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù"); return false; } else { return true; } }