TrackUsers not working in CF7

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default TrackUsers not working in CF7

    Here is a custom tag that worked in CF5 but has not worked in CF7. Any
    suggestions as to why would be more than helpful.

    <!---
    Custom Tag Name: TrackUsers.cfm
    Author: Bruce Van Horn, Netsite Dynamics LLC
    Email: [email]Bruce@NetsiteDynamics.com[/email]
    Date: October 11, 2001

    Purpose: To allow users to keep track of active users on a server

    Requirements: ColdFusion 5.0 or higher

    Attributes:
    User (required) = "a unique identifier for this user like IP number or
    SessionID"
    AppName (required) = "Name of the application calling this tag"

    Usage Example:
    Place this tag in every Application.cfm page on your sever:

    <CF_TrackUsers User="#cgi.remote_addr#" AppName="MyApp">

    --->

    <cflock timeout="30" throwontimeout="No" type="EXCLUSIVE" scope="APPLICATION">
    <cfif (not isDefined("Server.qUsers")) OR (NOT IsQuery(Server.qUsers))>
    <cfscript>
    Server.qUsers = QueryNew("User,AppName,RequestTime");
    QueryAddRow(Server.qUsers);
    QuerySetCell(Server.qUsers,"User",Attributes.User) ;
    QuerySetCell(Server.qUsers,"AppName",Attributes.Ap pName);
    QuerySetCell(Server.qUsers,"RequestTime",CreateODB CTime(now()));
    </cfscript>
    <cfelse>
    <cfquery name="qMaxReq" dbtype="query">
    select max(requesttime) as lastreq, Count(User) AS RowCount
    from Server.qusers
    </cfquery>
    <cfset ElapsedTime = CreateODBCTime(now()) - qMaxReq.LastReq>
    <cfif (TimeFormat(Variables.ElapsedTime,'m') gt 15) OR (qMaxReq.RowCount gt
    350)>
    <cfscript>
    Server.qUsers = "";
    Server.qUsers = QueryNew("User,AppName,RequestTime");
    </cfscript>
    </cfif>
    <cfscript>
    QueryAddRow(Server.qUsers);
    QuerySetCell(Server.qUsers,"User",Attributes.User) ;
    QuerySetCell(Server.qUsers,"AppName",Attributes.Ap pName);
    QuerySetCell(Server.qUsers,"RequestTime",CreateODB CTime(now()));
    </cfscript>
    </cfif>
    </cflock>

    -----------------------
    Throws the following error:

    Error Occurred While Processing Request
    Error Executing Database Query.

    Query Of Queries syntax error.
    Encountered "Count ( User. Incorrect Select List,

    The error occurred in D:\CFusionMX7\CustomTags\TrackUsers.cfm: line 32
    Called from
    D:\virtualwww\site_effects\clients\mis_splash\mis_ v2\Application.cfm: line 127
    Called from D:\CFusionMX7\CustomTags\TrackUsers.cfm: line 32
    Called from
    D:\virtualwww\site_effects\clients\mis_splash\mis_ v2\Application.cfm: line 127

    30 : </cfscript>
    31 : <cfelse>
    32 : <cfquery name="qMaxReq" dbtype="query">
    33 : select max(requesttime) as lastreq, Count(User) AS RowCount
    34 : from Server.qusers




    --------------------------------------------------------------------------------

    SQL select max(requesttime) as lastreq, Count(User) AS RowCount from
    Server.qusers

    Please try the following:
    Check the ColdFusion documentation to verify that you are using the correct
    syntax.
    Search the Knowledge Base to find a solution to your problem.


    Browser Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
    Remote Address 69.153.221.90
    Referrer
    Date/Time 25-May-05 11:57 AM

    Stack Trace (click to expand)
    at
    cfTrackUsers2ecfm1515940139.runPage(D:\CFusionMX7\ CustomTags\TrackUsers.cfm:32)
    at
    cfApplication2ecfm695863572.runPage(D:\virtualwww\ site_effects\clients\mis_splas
    h\mis_v2\Application.cfm:127) at
    cfTrackUsers2ecfm1515940139.runPage(D:\CFusionMX7\ CustomTags\TrackUsers.cfm:32)
    at
    cfApplication2ecfm695863572.runPage(D:\virtualwww\ site_effects\clients\mis_splas
    h\mis_v2\Application.cfm:127)


    java.sql.SQLException: <br><b>Query Of Queries syntax error.</b><br>
    Encountered "Count ( User.
    Incorrect Select List,

    at coldfusion.sql.imq.jdbcStatement.parseSQL(jdbcStat ement.java:566)
    at coldfusion.sql.imq.jdbcStatement.fetchResult(jdbcS tatement.java:536)
    at coldfusion.sql.imq.jdbcStatement.execute(jdbcState ment.java:131)

    -----------------------

    Thanks in advance for your help....

    boopower Guest

  2. Similar Questions and Discussions

    1. #38816 [Opn]: PHP code that was working perfectly recently stopped working.
      ID: 38816 User updated by: mtoohee at gmail dot com -Summary: PHP code that was working perfectly recently stopped....
    2. Macromedia Flash Player installed and working properly suddenlys stops working..
      No idea what has caused the Flash player to stop working. This is not my machine but a relatives who has asked for help over the T'giving...
    3. Data not working on Label but is working in Datagrid
      I am creating a simple website in Flex. I want to show different content from the database for home, about us, contact us, etc. I am using a CFC as...
    4. Working TableStyle Not Working on a Second DataGrid
      I am having difficulty getting Tablestyles to work on a datagrid. I have 2 datasets, 1 filled and the other not. The first contains customer, stock...
    5. ZX-7 not working
      What are your thoughts. Should I spend between 89.00 and 200.00 to have the ZX-7 fixed, or spend 385.00 to by the new Pentax *ist? Frederick
  3. #2

    Default Re: TrackUsers not working in CF7

    I got it to work by making a small change... seems like it didnt like the
    column name being called "User". When I changed it to count(*) it worked. Then
    I changed it to UserID (and renamed the column "User" to "UserID" and that
    worked, too). Here is the new custom tag code I used that works:

    <cflock timeout="30" throwontimeout="No" type="EXCLUSIVE" scope="APPLICATION">

    <cfif (not isDefined("Server.qUsers")) OR (NOT IsQuery(Server.qUsers))>
    <cfscript>
    Server.qUsers = QueryNew("UserID,AppName,RequestTime");
    QueryAddRow(Server.qUsers);
    QuerySetCell(Server.qUsers,"UserID",Attributes.Use r);
    QuerySetCell(Server.qUsers,"AppName",Attributes.Ap pName);
    QuerySetCell(Server.qUsers,"RequestTime",CreateODB CTime(now()));
    </cfscript>
    <cfelse>
    <cfdump var="#Server.qUsers#">
    <cfquery name="qMaxReq" dbtype="query">
    select max(requesttime) as lastreq, count(UserID) AS RowCount
    from Server.qUsers
    </cfquery>
    <cfset ElapsedTime = CreateODBCTime(now()) - qMaxReq.LastReq>
    <cfif (TimeFormat(Variables.ElapsedTime,'m') gt 15) OR (qMaxReq.RowCount gt
    350)>
    <cfscript>
    Server.qUsers = "";
    Server.qUsers = QueryNew("UserID,AppName,RequestTime");
    </cfscript>
    </cfif>
    <cfscript>
    QueryAddRow(Server.qUsers);
    QuerySetCell(Server.qUsers,"UserID",Attributes.Use r);
    QuerySetCell(Server.qUsers,"AppName",Attributes.Ap pName);
    QuerySetCell(Server.qUsers,"RequestTime",CreateODB CTime(now()));
    </cfscript>
    </cfif>
    </cflock>

    sdwebguy99 Guest

Posting Permissions

  • You may not post new threads
  • You may 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