function addslashes(str) { str = str.replace(/\\/g, '\\\\'); str = str.replace(/\'/g, '\\\''); str = str.replace(/\"/g, '\\"'); str = str.replace(/\0/g, '\\0'); return str; } function stripslashes(str) { str = str.replace(/\\'/g, '\''); str = str.replace(/\\"/g, '"'); str = str.replace(/\\0/g, '\0'); str = str.replace(/\\\\/g, '\\'); return str; }