Script

Show Script

Showing code for: showscript.irev

Back

<?rev
   -- Standard header -------------------------------
   put "Troz : : On-Rev" into tHeader
   include "../../includes/header.irev"
   
   include "../../includes/menu.irev"
   --------------------------------------------------
?>

<?rev include "includes/scriptlink.irev" ?>
<h1>Show Script</h1>

<?rev

   -- Run script sample here

   put $_GET["showscript"] into tScriptFile

   if tScriptFile is empty then
      -- show the script for this file by default
      put "showscript.irev" into tScriptFile
   end if

    if there is not a file tScriptFile then
      put tScriptFile & " script not found. Please press 'Back' and try again."
   else
   
      -- log this to show which scripts are being looked at
      put "data/script_log.txt" into tFilePath
      put line 1 of shell("date '+%d %b %Y %H:%M'") into tLogTime
      put $_SERVER["REMOTE_ADDR"] into tRemAddr
      put tLogTime & tab & tScriptFile & tab & tRemAddr & cr into tRec
      put tRec after URL ("file:" & tFilePath)
      
      put "<h2>Showing code for: " & tScriptFile & "</h2>"

   -- Add a JavaScript link to get back to the sample
?>

      <a href="javascript:javascript:history.go(-1)">Back</a><br /><br />

<?rev

      put URL ("file:" & tScriptFile) into tScript

      -- this replaces the ampersand,  less-than & greater-than symbols
      -- with their HTML entities: ampersand amp;, ampersand lt; & ampersand gt;
      replace "&" with "&amp;" in tScript
      replace "<" with "&lt;" in tScript
      replace ">" with "&gt;" in tScript

      -- the default tab is too spaced out
      replace tab with "&nbsp;&nbsp;&nbsp;" in tScript

      put "<code><pre>"
      put tScript
      put "</pre></code>"

   end if
   
?>

<?rev
   -- Standard footer -------------------------------
   include "includes/showIncludes.irev"
   include "../../includes/footer.irev"
   --------------------------------------------------
?>