Skip to main content
BreakawayPaul
Inspiring
July 11, 2012
Question

Querying a CFFILE read

  • July 11, 2012
  • 1 reply
  • 4145 views

My CMS logs application errors, and I used to use a <cfhttp> to create a queryable recordset that I would then build an HTML table out of.

Yesterday, our "security" department disabled <cfhttp>, so now I am stuck with only <cffile action="read">.  I still want to read the contents of the log file and display them in an HTML table.

Any advice?

P.S. I don't put the errors into the database because we're still stuck using MS Access for our website's database, so I need to keep database hits to a minimum.

    This topic has been closed for replies.

    1 reply

    Inspiring
    July 11, 2012

    First things first, I'd be saying "OI: we're actually using <cfhttp> in our code, you muppets", to the "security" department.  And find out from them what the rationale is for disabling it.  Even if they do have grounds for disabling it, this should be done after you have refactored your code.  Not beforehand.

    That said, if they files are in your local system - which I infer they are given you can <cffile> them - I am kinda puzzled why you were using <cfhttp> in the first place:it's far better to use the local filesystem than your web server to fetch file data for you.  Plus... it means your logs are web-browseable, which is something the security peeps really ought to be concerned about.

    --

    Adam

    BreakawayPaul
    Inspiring
    July 11, 2012

    This is on an internal, restricted server that only people within the building have access to.  None of it is live.

    The reason <cfhttp> is disabled is because the "security" people changed the testing server so that you need to enter a username/password combo to view any pages (sort of like password protected directories in Apache).  Since our instance of CF is running as a service (which is yet another discussion), <cfhttp> is denied access.  So is our batch HTML validator.  So is our link checker.

    So that's the skinny.

    The reason I was using <cfhttp> to grab the file contents is because it made it really easy to dump that into an HTML table.  I'm just not totally sure how to dump a <cffile> read into that same HTML table.

    BreakawayPaul
    Inspiring
    July 11, 2012

    Ok, I sort of have things working using <cffile>, <cfloop>, and listgetat().  A few bugs (like listgetat(list,5,"|") reads the beginning item of the next like) but I'm working on them.