home *** CD-ROM | disk | FTP | other *** search
- <%@ LANGUAGE="VBSCRIPT" %>
- <% Option Explicit
-
- Dim item
-
- If Request.QueryString("Edit")="Yes" Then
- EditVariables
- ElseIf Request.QueryString("Add")="Yes" Then
- AddVariable
- End If
- %>
-
- <HTML>
-
- <BODY BGCOLOR=#FFFFFF TOPMARGIN=0 LEFTMARGIN=0 ALINK=#23238E VLINK=#228B22 LINK=#23238E>
- <BASEFONT FACE="VERDANA, ARIAL, HELVETICA" SIZE=2>
-
- <!--Change link color on mouseover
- Only if running Internet Explorer 4.0 or later -->
- <!--#include file=../libHighlight.inc-->
-
- These are the existing Application level variables. Their values are stored
- in a text file called prefs.txt. Edit or delete them as desired in the form
- below.<BR><BR>
-
- <FORM METHOD=Post ACTION=SetPrefs.asp?Edit=Yes>
- <TABLE BORDER=1>
- <TR>
- <TD><B>Variable Name</B></TD>
- <TD><B>Variable Value</B></TD>
- <TR>
-
- <% DisplayVariables %>
- </TABLE>
- <INPUT TYPE=SUBMIT>
- </FORM>
-
- <P>
- To add, delete, or change a variable, type the name and value of the variable into the text
- boxes below, then click Submit. If you type the name of an exiting variable and give a new value, then this
- variable's value will be altered in the running application and in the prefs.txt file. If
- you use a new variable name, an additional variable will be created for you. If you use an
- existing variable name and omit a value, then this variable will be deleted.
- <P>
-
- <FORM METHOD=Post ACTION=SetPrefs.Asp?Update=Yes>
- <TABLE BORDER=1>
- <TR>
- <TD>Variable Name</TD>
- <TD>Variable Value</TD>
- </TR>
- <TR>
- <TD><INPUT NAME=VarName SIZE=25></TD>
- <TD><INPUT NAME=VarValue SIZE=50></TD>
- </TR>
- </TABLE>
- <INPUT TYPE=Submit>
- </FORM>
-
-
- <%
- Sub DisplayVariables
- Dim fso, txtSettings, stTextLine, intEqualPosition, stVarName, stVarValue, intCounter
-
- Set fso = Server.CreateObject("Scripting.FileSystemObject")
- Set txtSettings = fso.OpenTextFile(Server.MapPath("..\Prefs.txt"))
- Do Until txtSettings.AtEndOfStream
- stTextLine = ConvertQuotes(txtSettings.ReadLine)
- intEqualPosition = Instr(1, stTextLine, "=")
- If intEqualPosition <> 0 Then
- stVarName = Left(stTextLine, intEqualPosition - 1)
- stVarValue = Right(stTextLine, len(stTextLine) - intEqualPosition)
- End If
- Response.Write "<TR><TD>" & stVarName & "</TD>"
- Response.Write "<TD><INPUT SIZE=50 NAME=" & stVarName & " VALUE=" & Chr(34) & ConvertQuotes(stVarValue) & Chr(34) & "></TD></TR>"
- Loop
- End Sub
-
- ' in order to display the quotation mark character in a form's input box
- ' it is necessary to convert the quotation mark to the " sequence
- Function ConvertQuotes(st)
- dim intQuotePosition
- intQuotePosition = Instr(1, st, Chr(34))
- Do Until intQuotePosition = 0
- st = Left(st, intQuotePosition - 1) & """ & Right(st, len(st) - intQuotePosition)
- intQuotePosition = Instr(1, st, Chr(34))
- Loop
- ConvertQuotes = st
- End Function
-
- Sub ChangeVariables
-
- End Sub
-
- Sub EditVariables
- Dim fso, txtSettings
- Set fso = Server.CreateObject("Scripting.FileSystemObject")
- Set txtSettings = fso.CreateTextFile(Server.MapPath("Prefs.txt"), True, False)
- For Each item in Request.Form
- response.write item
- If Trim(item)<> "" And Trim (Request.Form(item))<>"" Then
- txtSettings.WriteLine item & "=" & Request.Form(item)
- End If
- Next
- End Sub
-
- Sub MakeNewTxtFile
- Dim fso, txtSettings
- Set fso = Server.CreateObject("Scripting.FileSystemObject")
- Set txtSettings = fso.CreateTextFile(Server.MapPath("Prefs.txt"), True, False)
- 'Create a new prefs.txt file to replace the old one
- For Each item in Request.Form("VarName")
- If item <> "" And Request.Form("VarName") <> "" Then
- txtSettings.WriteLine item & "=" & request.form(item)
- End If
- Next
- End Sub
-
- %>