Use JavaScript to encode and decode the data. The Code is as follows:
<MCE: Script Type = "text/JavaScript"> <! -- <Br/> var URL ={</P> <p> // public method for URL encoding <br/> encode: function (string) {<br/> return escape (this. _ utf8_encode (string); <br/>}, </P> <p> // public method for URL Decoding <br/> Decode: function (string) {<br/> return this. _ utf8_decode (Unescape (string); <br/>}, </P> <p> // Private Method for UTF-8 encoding <br/> _ utf8_encode: function (string) {<br/> string = string. replace (// R/n/g ," /N "); <br/> var utftext =" "; </P> <p> for (VAR n = 0; n <string. length; n ++) {</P> <p> var c = string. charcodeat (n); </P> <p> If (C <128) {<br/> utftext + = string. fromcharcode (c); <br/>}< br/> else if (C> 127) & (c <2048) {<br/> utftext + = string. fromcharcode (C> 6) | 192); <br/> utftext + = string. fromcharcode (C & 63) | 128); <br/>}< br/> else {<br/> utftext + = string. fromcharcode (C> 12) | 224); <Br/> utftext + = string. fromcharcode (C> 6) & 63) | 128); <br/> utftext + = string. fromcharcode (C & 63) | 128); <br/>}</P> <p> return utftext; <br/> }, </P> <p> // Private Method for UTF-8 decoding <br/> _ utf8_decode: function (utftext) {<br/> var string = ""; <br/> var I = 0; <br/> var c = C1 = C2 = 0; </P> <p> while (I <utftext. length) {</P> <p> C = utftext. charcodeat (I); </P> <p> If (C <128) {<br /> String + = string. fromcharcode (c); <br/> I ++; <br/>}< br/> else if (C> 191) & (c <224 )) {<br/> C2 = utftext. charcodeat (I + 1); <br/> string + = string. fromcharcode (C & 31) <6) | (C2 & 63); <br/> I + = 2; <br/>}< br/> else {<br/> C2 = utftext. charcodeat (I + 1); <br/> C3 = utftext. charcodeat (I + 2); <br/> string + = string. fromcharcode (C & 15) <12) | (C2 & 63) <6) | (C3 & 63); <br/> I + = 3; <br/>}</ P> <p >}</P> <p> return string; <br/>}</P> <p> var SSS = "http: // 192.168.5.194/html/base/base_qry_main.php? New = 1 & time [0] [0] = + & time [0] [1] = % 3E % 3d & time [0] [2] = 12 & time [0] [3] = 29 & time [0] [4] = 2010 & time [0] [5] = & time [0] [6] = & time [0] [7] = & time [0] [8] = + & time [0] [9] = + & submit = query + dB & num_result_rows =-1 & time_cnt = 1 "; </P> <p> alert (URL. decode (SSS); <br/> // alert (SSS. replace ("& amp;", "&", "ig"); <br/> // alert (URL. decode (SSS. replace ("& amp;", "&", "ig"); <br/> // --> </MCE: SCRIPT>
The code for verifying IP addresses using JavaScript is as follows:
<MCE: Script Type = "text/JavaScript"> <! -- <Br/> string. prototype. isip = function () {<br/> var respacecheck =/^ ([0-9] {1, 3 })/. ([0-9] {1, 3 })/. ([0-9] {1, 3 })/. ([0-9] {1, 3}) $/I; <br/> If (respacecheck. test (this) {<br/> This. match (respacecheck); <br/> If (Regexp. $1 <= 255 & Regexp. $1> 0 <br/> & Regexp. $2 <= 255 & Regexp. $2> = 0 <br/> & Regexp. $3 <= 255 & Regexp. $3> = 0 <br/> & Regexp. $4 <= 255 & Regexp. $4> = 0) {<br/> return true; <br/>} else {<br/> return false; <br/>}< br/>}else {<br/> return false; <br/>}< br/> var strip = "0.0.5.194 "; <br/> alert (strip. isip (); <br/> // --> </MCE: SCRIPT>
The javascript code for clearing spaces using JavaScript code is as follows:
String. Prototype. Trim = function ()
{
Return this. Replace (/(^/S *) | (/S * $)/g ,"");
}
String. Prototype. ltrim = function ()
{
Return this. Replace (/(^/S *)/g ,"");
}
String. Prototype. rtrim = function ()
{
Return this. Replace (/S * $)/g ,"");
}