<% var eCookieDate = new Date(); eCookieDate.setMonth(eCookieDate.getMonth()+1); var echoCookie = new String(); echoCookie = (eCookieDate.getMonth()+1) + "/" + eCookieDate.getDate() + "/" + eCookieDate.getFullYear() + " " + eCookieDate.getHours() + ":" + eCookieDate.getMinutes() + ":" + eCookieDate.getSeconds(); function convertSpecChar( cString ) { //$sc1c //&39 is defined by programmer to indicate apostrophe value //cString = ReplaceAll(cString,"'","&lsquo") ; cString = ReplaceAll(cString,"'","&39") ; cString = ReplaceAll(cString,'"',""") ; return cString ; } function trim(text) { return new String(text).replace(/^\s+|\s+$/g, ""); } function ltrim(text) { return new String(text).replace(/^\s+/, ""); } function rtrim(text) { return new String(text).replace(/\s+$/, ""); } function isNumeric(text) { var validChars = "0123456789.-"; if (text.length == 0) { return false; } for (i = 0; i < text.length; i++) { if (validChars.indexOf(text.charAt(i)) == -1) { return false; } } return true; } function Cleanse(text, length, isNumber) { text = trim(text); if (length != null && trim(length) != "undefined" && trim(length) != "" && text.length > length) { text = ""; } if (text != "" && isNumber && !isNumeric(text)) { text = ""; } if (text.toLowerCase().indexOf("select") > -1 || text.toLowerCase().indexOf("drop ") > -1 || text.toLowerCase().indexOf("alter ") > -1 || text.toLowerCase().indexOf("truncate") > -1 || text.toLowerCase().indexOf("xp_cmd") > -1 || text.toLowerCase().indexOf("insert") > -1 || text.toLowerCase().indexOf("shutdown") > -1 || text.toLowerCase().indexOf("update") > -1 || text.toLowerCase().indexOf("exec") > -1 || text.toLowerCase().indexOf("sp_exe") > -1) { text = ""; } if (text != "") { text = SpecialHTMLEncode(text).replace("'", "''").replace("]","]]").replace("--","").replace("!","").replace("%","").replace("!","").replace("@","").replace("#","").replace("$","").replace("*","").replace("(","").replace(")","").replace("{","").replace("}",""); } return text; } function SpecialHTMLEncode(text) { return text.replace("<", "<").replace(">", ">"); } function ReplaceAll(inString, oldValue, newValue) { //$sc1c var outString = ""; for (h=0;h -1 ) { lcNewVal = "null" ; //Default value for all L_TABLE link2 field } else { lcNewVal = 0 ; } } fields += lcVarName + ","; //$SC1A values += lcNewVal +", " ; } } else { defVal = DefVal(lcDefaultValues,lcVarName); if (trim(defVal) != trim(lcNewVal)) { lcNewVal = lcNewVal.replace(re, "''"); // double up the quotes in preparation of the SQL statement if (type == "C") { // update Strings and Characters UpDateField = lcVarName+"='"+lcNewVal+"'"; } else if (type == "D") { // update Dates if (trim(lcNewVal).length == 0) { UpDateField = lcVarName+"= null "; lcNewVal = "null"; } else { UpDateField = lcVarName+"='"+lcNewVal+"'"; } } else if (type == "L") { // update Boolean if (lcNewVal == "true") { UpDateField = lcVarName+"=1"; lcNewVal = "1"; } else { UpDateField = lcVarName+"=0"; lcNewVal = "0"; } } else { // update Numbers if (trim(lcNewVal).length == 0) { //$SC4 if ( lcVarName.toUpperCase().indexOf("L_") > -1 ) { lcNewVal = "null" ; //Default value for all L_TABLE link2 field } else { lcNewVal = 0 ; } } UpDateField = lcVarName + "=" + lcNewVal; } lcUpd = lcUpd + UpDateField + ","; if (trim(area).toUpperCase() == "PROVIDER" || trim(area).toUpperCase() == "SYSUDF") { ArrayFields[ArrayIndex] = lcVarName; ArrayNewValues[ArrayIndex] = lcNewVal; ArrayDefaultValues[ArrayIndex] = defVal; ArrayIndex++; } } } } } // End while //Is this a new record? if (newrecord == "Y") { //Are there any fields to insert? if (trim(fields.length) > 0) { if (fields.indexOf(",") > -1) { fields = fields.substring(0, fields.lastIndexOf(",")); } if (values.indexOf(",") > -1) { values = values.substring(0, values.lastIndexOf(",")); } SQLStatement = "insert into " + tablename2 + "(" + fields + ") values(" + values + ")"; } } else { //Where there any changes? if (trim(lcUpd.length) > 0) { if (lcUpd.indexOf(",") > -1) { lcUpd = lcUpd.substring(0, lcUpd.lastIndexOf(",")); } SQLStatement = "update " + tablename2 + " set " + lcUpd + " where link = " + link2; } } if (trim(SQLStatement.length) > 0) { //Does an insert or update have to be done? var oSQL = Server.CreateObject("QEData.SQLSelect"); var returnVoid = "" ; try { var newlink2; if (newrecord == "Y") { //$JE2A newlink2 = oSQL.Insert_Record(Request.Cookies("gcServerName"),Request.Cookies("gcDataBase"),trim(SQLStatement)); //$JE2A }else { //$JE2A oSQL.UpdateTable(Request.Cookies("gcServerName"),Request.Cookies("gcDataBase"), trim(SQLStatement)); } if (trim(area).toUpperCase() == "PROVIDER") { Response.Write(""); //$MM1C } else if (trim(area).toUpperCase() == "TBLMAINT") { Response.Write(""); } else { Response.Write("Saved..."); } } catch(e) { var lcMessage = custom_msg(e); %>  <% Response.Write(""); } oSQL = null; } else { if (trim(area).toUpperCase() == "PROVIDER") { //redraw the top then clear the bottom right Response.Write(""); //$MM1C } else if (trim(area).toUpperCase() == "TBLMAINT") { Response.Write(""); } else { Response.Write(""); } } } %>