Professional Web Applications Themes

Encrypt in select statement - Coldfusion - Advanced Techniques

I have to debug error message caused by the following. What I don't understand is where should I start since I've never done it this way. This is for login to a site. The validation looks like this: <cfquery name="ValidateUsers" datasource="#Application.MyDB#"> SELECT User_ID, Encrypt(Password) as EncPwd FROM Users WHERE Login='#Form.username#' AND Password='#Form.password#' </cfquery> Then client variable is set: <cfset client.penc = #Authenticate.EncPwd#> The error says: Invalid client variable contents The value of the client variable penc is not a string, number, boolean, or date/time value When I run the query in SQL, I got User_ID = 12 and EncPwd = ...

  1. #1

    Default Encrypt in select statement

    I have to debug error message caused by the following. What I don't understand
    is where should I start since I've never done it this way. This is for login to
    a site.
    The validation looks like this:
    <cfquery name="ValidateUsers" datasource="#Application.MyDB#">
    SELECT User_ID, Encrypt(Password) as EncPwd FROM Users WHERE
    Login='#Form.username#' AND Password='#Form.password#'
    </cfquery>

    Then client variable is set:
    <cfset client.penc = #Authenticate.EncPwd#>

    The error says:
    Invalid client variable contents The value of the client variable penc is not
    a string, number, boolean, or date/time value

    When I run the query in SQL, I got User_ID = 12 and EncPwd = <binary>

    This query runs with no error on CF 5. I'm now in the process of testing this
    application to rum under cfMX platform and find out what need to be fixed.

    Can anybody give advice or solution on how should I fix this situation?




    alecken Guest

  2. #2

    Default Re: Encrypt in select statement

    Not sure if there's code in between your query and your <cfset>, but you're
    using a query name of "Authenticate" in your <cfset>, where the query that's
    pulling the EncPwd is actually named ValidateUsers.

    Kronin555 Guest

  3. #3

    Default Re: Encrypt in select statement

    Sorry that's my fault and I've corrected my original posting.

    alecken Guest

  4. #4

    Default Re: Encrypt in select statement

    Where are you storing client variables? registry? cookie? database?
    Kronin555 Guest

  5. #5

    Default Re: Encrypt in select statement

    The 2 of them are stored in the cookies, the rest is registry
    <cfcookie name="MyUser_ID" value=#ValidateUsers.User_ID# expires="20">
    <cfcookie name="MyEncPwd" value=#ValidateUsers.EncPwd# expires="20">


    alecken Guest

  6. #6

    Default Re: Encrypt in select statement

    the 2 of them? I'm not quite following you here....

    You can only pick one location to store client variables. If you have it set
    as "registry", then this line:
    <cfset client.EncPwd = #ValidateUsers.EncPwd#>
    will attempt to store EncPwd in the registry.

    Is it this <cfset> line that's throwing the error? If so, you can completely
    ignore the <cfcookie> lines (unless you're setting that cookie, then using the
    cookie to set the client.EncPwd).

    Have you ever tried to store binary data in the registry (ie client variable
    with registry specified as storage) before? It looks like it needs to be a
    simple data type.

    Kronin555 Guest

  7. #7

    Default Re: Encrypt in select statement

    This application is written by othe programmer whom I've never met.
    All I can see is, when I look at my CF administrator under client variables,
    the one that is checked for client storage is registry

    Then in this template I also see :
    <cfcookie name="MyUser_ID" value=#ValidateUsers.User_ID# expires="20">
    <cfcookie name="MyEncPwd" value=#ValidateUsers.EncPwd# expires="20">

    And the error is actually comes up when it hit the first line of setting
    EncPwd:
    <cfset client.EncPwd = #ValidateUsers.EncPwd#>

    I did some testing for the exact same codes on the other server, I output
    client.EncPwd and the result is 07788556879905

    When I run the first query in my MSSQL, EncPwd shows <binary>

    Why is it working in CF 5 but not in MX? and how am I supposed to make changes
    so that it also work in MX.





    alecken Guest

Similar Threads

  1. help with SQL SELECT statement
    By TimNMtl in forum Dreamweaver AppDev
    Replies: 12
    Last Post: August 21st, 08:28 PM
  2. help with SELECT statement
    By Chris Hohmann in forum ASP
    Replies: 2
    Last Post: August 19th, 05:10 PM
  3. SELECT statement
    By Simon in forum Microsoft SQL / MS SQL Server
    Replies: 23
    Last Post: August 18th, 01:12 PM
  4. Need help with select statement
    By Don in forum Microsoft SQL / MS SQL Server
    Replies: 2
    Last Post: July 23rd, 04:53 AM
  5. possible to run a select with an if statement in it?
    By Jim in forum Microsoft SQL / MS SQL Server
    Replies: 2
    Last Post: July 17th, 04:48 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139