PDA

View Full Version : Webserver Lua Code Problem



harleydude
September 20th, 2006, 08:30 AM
I have the following code in a .lhtml file. The LogFile variable is actually assigned a file name passed in thru webserver:GetCGI(). I have it hard coded for testing this issue.


<table width="70%" align="center" cellspacing="0" cellpadding="0">
<tr>
<td class="securitylog">
<%
local LogFile = "WebAccess "..os.date("%Y-%m-%d")..".Log"
local ConfigFile = win.GetDirectory('GIRDERDIR').."\\UserData\\WebAccess\\"
webserver:print (ConfigFile..LogFile)
%>
</td>
</tr>
</table>

When I access the page the actual lua code is displayed on the screen instead of just printing the ConfigFile..LogFile. I believe the problem is the last \\ on the win.GetDirectory line. If I remove the \\ then the page displays however the file path/name is not usable for retreiving the contents of the file. Bug or am I doing something wrong? Same problem on versions 4.0.5.1 & 4.0.5.2.

Ron
September 20th, 2006, 10:22 AM
I think I know what that is. The parser gets confused by the \\" .



<%
local LogFile = "WebAccess "..os.date("%Y-%m-%d")..".Log"
local ConfigFile = win.GetDirectory('GIRDERDIR').."/UserData/WebAccess/"
webserver:print (ConfigFile..LogFile)
%>

harleydude
September 20th, 2006, 11:13 AM
NOt in front of my development machine at the moment. How will that affect the file io routines? Will C:\Program Files\Promixis\Girder/UserData/WebAccess/WebAccess 2006-09-20.Log be a valid path?

Ron
September 20th, 2006, 11:14 AM
should work just fine.

harleydude
September 20th, 2006, 01:32 PM
Ok, I will give it a try tonight.

Thanks

harleydude
September 20th, 2006, 07:36 PM
All is good.

Thanks