Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/O Code)
 seting up a variable
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

zinpin
Junior Member

Australia
202 Posts

Posted - 10 February 2004 :  19:23:15  Show Profile
can someone help me with this, i need to setup a variable that you can either click on or off through the admin panel. it will have it's own page where there will be a checkbox. Just like you see in the feature configuration page.
This variable will be an integer and when a user visits the forum if this variable is set to on they will be redirected to another page away from the forum. (this is just for when I'm working with the code)
The redirect thing I know how to do it's the variable bit that I just can't seem to work out in terms of storing in the same manner as the configuration page in admin.

Edited by - zinpin on 10 February 2004 19:25:28

cripto9t
Average Member

USA
881 Posts

Posted - 11 February 2004 :  12:22:10  Show Profile
Where strYourVariable should be identical in all instances below and page_name.asp = what you name this page.
new page to be linked in admin options

<!--#INCLUDE FILE="config.asp"-->
<!--#INCLUDE FILE="inc_sha256.asp"-->
<!--#INCLUDE FILE="inc_header.asp" -->
<!--#INCLUDE FILE="inc_func_admin.asp" -->
<!--#INCLUDE FILE="inc_moderation.asp" -->
<%
if Session(strCookieURL & "Approval") <> "15916941253" then
	scriptname = split(request.servervariables("SCRIPT_NAME"),"/")
	Response.Redirect "admin_login.asp?target=" & scriptname(ubound(scriptname))
end if
if Request.Form("Method_Type") = "Write_Configuration" then
        Err_Msg = ""
        if Err_Msg = "" then
		for each key in Request.Form 
			if left(key,3) = "str" or left(key,3) = "int" then
				strDummy = SetConfigValue(1, key, ChkString(Request.Form(key),"SQLstring"))
			end if
		next

		Application(strCookieURL & "ConfigLoaded") = ""

		Response.Write	"      <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """>Configuration Posted!</font></p>" & vbNewLine & _
				"      <meta http-equiv=""Refresh"" content=""2; URL=admin_home.asp"">" & vbNewLine & _
				"      <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """>Congratulations!</font></p>" & vbNewLine & _
				"      <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><a href=""admin_home.asp"">Back To Admin Home</font></a></p>" & vbNewLine
	end if
else
        Response.Write	"      <form action=""page_name.asp"" method=""post"" id=""Form1"" name=""Form1"">" & vbNewLine & _
			"      <input type=""hidden"" name=""Method_Type"" value=""Write_Configuration"">" & vbNewLine & _
			"      <table border=""0"" cellspacing=""0"" cellpadding=""0"" align=""center"">" & vbNewLine & _
                        "        <tr valign=""middle"">" & vbNewLine & _
			"          <td bgColor=""" & strPopUpTableColor & """ align=""right""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><b>Subject:</b> </font></td>" & vbNewLine & _
			"          <td bgColor=""" & strPopUpTableColor & """><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
			"            On:<input type=""radio"" class=""radio"" name=""strYourVariable"" value=""1""" & chkRadio(strYourVariable,0,false) & "> " & vbNewLine & _
			"            Off:<input type=""radio"" class=""radio"" name=""strYourVariable"" value=""0""" & chkRadio(strYourVariable,0,true) & "></td>" & vbNewLine & _
			"        </tr>" & vbNewLine & _
                        "        <tr valign=""middle"">" & vbNewLine & _
			"         <td bgColor=""" & strPopUpTableColor & """ colspan=""2"" align=""center""><input type=""submit"" value=""Submit New Config"" id=""submit1"" name=""submit1""> <input type=""reset"" value=""Reset Old Values"" id=""reset1"" name=""reset1""></td>" & vbNewLine & _
			"        </tr>" & vbNewLine & _
                        "      </table>" & vbNewLine & _
			"      </form>" 
end if
WriteFooter
Response.end
%>


In config.asp

Add this to the end of the dim list (around line 127)
Dim strYourVariable


Add this to the end of variable listings (around line 390 (end of the page))
strYourVariable = Application(strCookieUrl & "STRYOURVARIABLE")




And then

if strYourVariable = 1 then
    Response.Redirect "newPage.asp"
end if



    _-/Cripto9t\-_

Edited by - cripto9t on 11 February 2004 12:26:04
Go to Top of Page

zinpin
Junior Member

Australia
202 Posts

Posted - 11 February 2004 :  18:24:43  Show Profile
wow thanks cripto9t, it took me most of the day yesterday to try and trace the existing variables to see how they did it as I thought that no one would be answering.
Thanks again mate.
Go to Top of Page

cripto9t
Average Member

USA
881 Posts

Posted - 12 February 2004 :  18:47:06  Show Profile
quote:
Originally posted by zinpin

it took me most of the day yesterday to try and trace the existing variables to see how they did it



No Problem .
I remember it took me alot of time to figure it out too .
You can also look at the function chkRadio() in "inc_func_common.asp" to get a better understanding of what's going on.

    _-/Cripto9t\-_
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 13 February 2004 :  04:53:25  Show Profile
Maybe I'm misinterpreting your reasons for needing to do this but why not simply shut the forums down via down.asp/


Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.37 seconds. Powered By: Snitz Forums 2000 Version 3.4.07