Disable error display

Discussion in 'Programming' started by gigamike, May 31, 2008.

  1. #1
    Guys,

    How i can turn off the displaying of error in Coldfusion. The version im using is 5. Is there any settings like in php.ini display error=off.

    second, is there also a function like MD5 for coldfusion so i can MD5 password.

    Third, seems cf 5 is easy to SQL inject, is there a way of function like mysql_escape_string in cf

    Thanks,

    Mike
     
    gigamike, May 31, 2008 IP
  2. apmsolutions

    apmsolutions Peon

    Messages:
    66
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You should trap your errors with <cftry> and <cfcatch> Just put nothing in the <cfcatch and you will be fine.

    Why would you want to not display anything though? You should at least let the user know some sort of error occured.

    To prevent sql injection, ALWAYS use cfqueryparam in your queries.

    ex:
    WHERE id = <cfqueryparam cfsqltype="cf_sql_integer" value="#ID#" >
    Code (markup):
     
    apmsolutions, May 31, 2008 IP
  3. websiteideas

    websiteideas Well-Known Member

    Messages:
    1,406
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    130
    #3
    I think what you might be looking for is this: <cfsetting showDebugOutput = "no" >

    You might also want to consider making use of the onError cffunction in application.cfc.
     
    websiteideas, May 31, 2008 IP
  4. gigamike

    gigamike Active Member

    Messages:
    165
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #4
    Hi,

    Many thanks for your help, by the way, does

    <cfqueryparam cfsqltype="numeric" value="URL.id" >

    is same with

    <cfparam name="URL.id" default="0" type="numeric">

    Second, i added a error handler setup on Application.cfm i.e.

    <cferror type="REQUEST" template="error.cfm" mailto="myemail@test.com">

    is this fine ?

    Thanks,

    Mike


     
    gigamike, Jun 2, 2008 IP
  5. gigamike

    gigamike Active Member

    Messages:
    165
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #5
    Hi,

    Many thanks for the help. Yes i used something like what you mention. I have a

    <cferror type="REQUEST" template="error.cfm" mailto="myemail@test.com">

    in my Application.cfm

    Thanks,

    Mike


     
    gigamike, Jun 2, 2008 IP
  6. gigamike

    gigamike Active Member

    Messages:
    165
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #6
    guys,

    By the way for the md5. This is what i did, since i cant find an MD5 for cfm, i just use Hash() so if in case an sql injection occurs and tries to display the password.

    What do you think about that ?

    Thanks,

    Mike
     
    gigamike, Jun 2, 2008 IP