For anyone running PanoramaX Server as a remote web server, or running multiple servers, it’s really convenient to be able to check the logs via browser.
The following procedure can be added to your Web Published database to do just that.
I have it on the server in a procedure named “logs” and initially hit it with a link similar to this:
ShellOpenDocument “https://website.com/cgi-bin/panoramax.cgi?webdb~logs~list”
Throughout, substitute “webdb” for the actual name of your web published database.
> If arraylast(cgiExtraParameters,"~") = "list"
>
> ;list the available files
> Let lvLogs = listfiles(info("panoramafolder")+"/Logs","")
> arraymultisort lvLogs,lvLogs,cr()," ","1n"
>
> ;reverse the order of the list and trim it to 120 items
> lvLogs = ArrayRange(ArrayReverse(lvLogs,cr()),1,120,cr())
>
> ;add a value that causes links to expire
> Let lvNow = str(SuperDate(Today(),Now()))
>
> arrayfilter lvLogs,lvLogs,¶,{<a href = "/cgi-bin/panoramax.cgi?webdb ~logs~}+lvNow+{~}+import()+{" target="_blank">}+import()+{</><br />}
>
> cgiHTML = lvLogs
> Rtn
> EndIf
>
> ;check how long ago the log list was generated
> Let lvCheck = arrayfirst(cgiExtraParameters,"~")
> If SuperDate(Today(),Now())-val(lvCheck) > 1800 ;30 minutes
> cgiHTML = "Rejection Message"
> Rtn
> EndIf
>
> Let lvLog = fileload(info("panoramafolder")+"/Logs/"+arraylast(cgiExtraParameters,"~"))
>
> cgiHTML = "<blockquote><h3>"+arraylast(cgiExtraParameters,"~")+"</h3>"+replace(lvLog,¶,"<br />")+"</blockquote>"
>
> Rtn
Not at all to diminish Panorama but for security, it’s possible to rename panoramax.cgi on the server and it will still work in your links. For instance, you can rename it “my.cgi” and no one will guess what’s actually processing the cgi scripts. Using Abyss as the server software, instead of Apache, URL rewriting makes it possible to take it even further. My links can be anything I choose. Instead of “cgi-bin/panoramax.cgi?webdb~”, I might substitute “zyx”. What hacker will figure that out?