ASP (Jscript) rewritten to PHP
Posted: Tue Dec 29, 2009 7:17 pm
I am trying to rewrite this ASP/Jscript code to PHP so I can use it on my web site. It is part of a form generated by Top Producer. Here is the Jscript part:
Anyone here good at converting ASP to PHP? I'm a bit of a noob and have been Googling operators and syntax for days to no avail. I COULD spend weeks learning PHP (which is a given) however I would really like to finish this project sooner than that. Any help is greatly appreciated!
Code: Select all
<%@LANGUAGE="JScript" %>
<%
// Write a user entered value into the HTML page safely.
function writeSafeValue( sName ) {
var sValue;
sValue = "" + Request.QueryString( sName ) + "";
try {
if( typeof( sValue ) == "string" ) {
if( sValue != "undefined" ) {
// Do net let the user attempt to input HTML Code or
// SSI (Server Side Include) directives.
sValue = sValue.replace( /</g, "<" );
sValue = sValue.replace( />/g, ">" );
sValue = sValue.replace( /\"/g, """ );
}
else {
sValue = "";
}
}
} catch( e ) {
// Catch and display any errors that occur.
Response.Write( "writeValue( "" + sName + "" ) ERROR " + e.number + ": " + e.description + " - sValue: " + sValue );
sValue = "";
}
Response.Write( sValue );
}
%>
Anyone here good at converting ASP to PHP? I'm a bit of a noob and have been Googling operators and syntax for days to no avail. I COULD spend weeks learning PHP (which is a given) however I would really like to finish this project sooner than that. Any help is greatly appreciated!