Author |
Topic  |
work mule
Senior Member
   
USA
1358 Posts |
Posted - 11 October 2002 : 12:39:46
|
This post stems from my other post here: http://forum.snitz.com/forum/topic.asp?TOPIC_ID=33125&whichpage=5
In config.asp, there's these couple of lines near the top:
strCookieURL = Left(Request.ServerVariables("Path_Info"), InstrRev(Request.ServerVariables("Path_Info"), "/"))
strUniqueID = "Snitz00"
If Application(strCookieURL & "ConfigLoaded")= "" Or IsNull(Application(strCookieURL & "ConfigLoaded")) Or blnSetup="Y" Then
Definition of Request.ServerVariables("Path_Info"): Extra path information as given by the client. You can access scripts by using their virtual path and the PATH_INFO server variable. If this information comes from a URL, it is decoded by the server before it is passed to the CGI script.
So considering these various paths, strCookieURL will be different. At http://www.mysite.com/page.asp | strCookieURL = "/" At http://www.mysite.com/articles/page.asp | strCookieURL = "/articles/" At http://www.mysite.com/forum/page.asp | strCookieURL = "/forum/" At http://www.mysite.com/community/forum/page.asp | strCookieURL = "/community/forum/"
I know that the forum was originally built with everything being contained within the same directory/folder. With this in mind, this method would support any number of forums on a single while maintaining different sets of variables. Is my thinking correct or am I way off-base? Either way, I have no issue with that and think it was a great idea to do it this way.
However, I don't know if many people realize that's how it works. So if you start using the forum code outside of your forum directory, then there will be different sets of variables being created.
So what I'm wondering is for sites that won't be implementing multiple forums and/or want to use the forum code outside of the forum directory, can this be hardcoded to a specific value?
strCookieURL = "MYUNIQUESTRING"
What ramifications would there be in doing this?
Also, out of curiousity, but why would strCookieURL and strUniqueID be different? Aren't they technically serving the same purpose, but one is dynamic and the other is hardcoded? |
|
alex042
Average Member
  
USA
631 Posts |
Posted - 11 October 2002 : 13:44:19
|
This is an issue I've been dealing with also. I've posted a topic here.
Although probably not the best way, I was able to get some MODs to work outside of the forum through hardcoding the strCookieURL in config.asp.
For example, when I implemented private messages outside of the forum directory, it kept telling me my empty mailbox exceeded the limit. After hardcoding the private messages cookie parameters in config.asp to strPMLimit = cint(Application("/forums/STRPMLIMIT")) & strPMStatus = Application("/forums/STRPMSTATUS"), that error message went away.
I'm sure there has to be a better way of doing this though because this method doesn't seem to always be reliable. I was hoping someone else would come up with a better idea.
|
Edited by - alex042 on 11 October 2002 13:46:46 |
 |
|
bjlt
Senior Member
   
1144 Posts |
Posted - 11 October 2002 : 14:03:37
|
In my opinion it's better not to hard code it as you may need such a cookie url some time, e.g. track if one has accessed a specific folder.
I just use strUniqueID
|
 |
|
Deleted
deleted
    
4116 Posts |
Posted - 11 October 2002 : 14:05:04
|
Use an application variable set in global.asa to point to your forum directory and use it everywhere on the site... |
Stop the WAR! |
 |
|
work mule
Senior Member
   
USA
1358 Posts |
Posted - 11 October 2002 : 14:06:27
|
strCookieURL for me was this:
"/olp_dev/community/forum-34/" = 24 characters / 48 bytes
In IIS5, application variables are all stored in Unicode (UTF-8?) and so it's 2 bytes per character.
In my development version, I've gone and hardcoded this variable (to test this out):
"FORUM_" = 6 characters / 12 bytes
There are 155 application variables for the forum. So for me (in this example), the savings is 5,580 bytes or 5.45 KB. Yeah, that's almost an insignificant amount, but nonetheless, it's there. I'd have to imagine there's more involved than the memory allocated to store all these variables. Think of each time the scripts execute, etc. Anyways...that's going off topic now. The issue is whether or not strCookieURL can be hardcoded with a value other than the "PATH_INFO". |
Edited by - work mule on 11 October 2002 14:07:33 |
 |
|
bjlt
Senior Member
   
1144 Posts |
Posted - 11 October 2002 : 14:14:54
|
since it finds the url (for cookie), you may need such a function (some codes actually need the real url). you can hard code it but it's better to have a new variable, then I see no difference with strUniqueID if do need to hard code one.
you can change value of strUniqueID to your own.
for application variables, I see no reason to use the strcookieurl but not strUniqueID? |
Edited by - bjlt on 12 October 2002 03:03:43 |
 |
|
work mule
Senior Member
   
USA
1358 Posts |
Posted - 11 October 2002 : 14:18:25
|
quote: Originally posted by bjlt
In my opinion it's better not to hard code it as you may need such a cookie url some time, e.g. track if one has accessed a specific folder.
I just use strUniqueID
You're missing the point of my post. oops... ignore that. 
strCookieURL is used to prefix the name of the application variables. There are 155 of them. In config.asp, there is this check:
If Application(strCookieURL & "ConfigLoaded")= "" Or IsNull(Application(strCookieURL & "ConfigLoaded")) Or blnSetup="Y" Then
When working out of say, the /forum/ and /article/ directories, that will be two unique/different variables.
Application(strCookieURL & "ConfigLoaded")
for /forum/ will be : "/forum/ConfigLoaded" for /article/ will be : "/article/ConfigLoaded"
If your forum variables are configured, when you get to your article folder, it'll be looking for a totally different set and then load another set, but prefixed with /article/.
You do highlight an area where hardcoding would cause trouble. If you set your cookies to your forum directory, it uses the strCookieURL value. But why not use something like FORUM_STRFORUMURL and parse off the domain name?
See, you'd think strCookieURL is strictly used for cookies, but it's not. It's also used to prefix application variable names. I wonder if strUniqueID was originally intended for that role. |
Edited by - work mule on 11 October 2002 16:16:32 |
 |
|
bjlt
Senior Member
   
1144 Posts |
Posted - 11 October 2002 : 14:23:24
|
mnnn. Aren't we talking exactly the same thing?
yes, it's used for application variables and causing trouble, so it needs to be changed or hard coded. Yet strCookieURL is used by other functions to track the real url of a folder, so it's better leave that function there and hardcode your application prefix as something else.
I think we can just use strUniqueID in such a case and I do wonder why it's strCookieUrl but not strUniqueID used for the application. |
Edited by - bjlt on 12 October 2002 03:02:03 |
 |
|
bjlt
Senior Member
   
1144 Posts |
Posted - 11 October 2002 : 14:31:09
|
My suggestion for the next version is to use strUniqueID for the application varialbes, and to add in the readme that everybody should change the value of strUniqueID to his/her own. |
Edited by - bjlt on 12 October 2002 03:01:16 |
 |
|
work mule
Senior Member
   
USA
1358 Posts |
Posted - 11 October 2002 : 16:15:07
|
quote: Originally posted by bjlt
mnnn. Aren't we talking exactly the same thing?
Yeah, we are... 
I was busy writing while you were posting. Initially it seemed like we weren't, but we are now. I was just too lazy to edit my reply.  |
 |
|
@tomic
Senior Member
   
USA
1790 Posts |
Posted - 11 October 2002 : 16:21:04
|
Hmmmmmm, yes something needs to be done here. I have a set of application variables for each folder and I am using several. I have none of the problems Alex is having but at times all of the folders have a decent number of users and I am thinking this is part of the reason my host contacted me about using so much of the server's RAM. So for now, as a quick fix, I am going to move some of this back into the forum directory although my new article system is fortunately already set up that way.
@tomic |
SportsBettingAcumen.com |
 |
|
bjlt
Senior Member
   
1144 Posts |
Posted - 12 October 2002 : 02:46:34
|
Well it depends on how you set up your site, such as to use one configuration for the entire site or each forum, have one or more then one forums, or move snitz files to other directories or not. |
Edited by - bjlt on 12 October 2002 03:02:58 |
 |
|
bjlt
Senior Member
   
1144 Posts |
Posted - 12 October 2002 : 11:44:23
|
New idea on this: make few new variables: 1. strApplicationURL either = strLocalForumURL or = strUniqueID if you use snitz as a backbone for your site (e.g. using its login feature for your whole site) and one set application variables for the site, you can use strApplicationURL = strUniqueID
If you build several forums while move some files of snitz to other directories, use strApplicationURL = strLocalForumURL
we need to examine all the Application(strCookieURL and Session(strCookieURL carefully and determine which to be changed and what it should be changed to.
Of course we still need strCookieURL.
2. strLocalForumURL now we have strForumURL which includes the domain name. It's not convinient if you test several forums on your different machines. With strLocalForumURL, which can be defined starting from the root, it's easier to move files out of the forum folder. Let's make it default to empty, and change all href=default.asp to href = " & strLocalForumURL & "default.asp" |
 |
|
alex042
Average Member
  
USA
631 Posts |
Posted - 16 October 2002 : 09:28:50
|
quote: I have a set of application variables for each folder and I am using several.
I seem to be getting mine to load by directory now by copying and running setup.asp in each directory to load the variables for that directory. Where do you have your config.asp? Does this make a difference?
|
 |
|
Eric915
Starting Member
31 Posts |
Posted - 04 November 2002 : 17:34:23
|
err... So how do I get my users to be logged in from out of the fourm page? I still can't get it to work  |
 |
|
@tomic
Senior Member
   
USA
1790 Posts |
Posted - 04 November 2002 : 20:55:53
|
I have never had a problem with users logging in/out on any server I have worked with. I have, however, made sure that ALL links/images/paths whatever are prefaced by strForumURL. For instance strImageURL works great in the forum. Outside the forum it does not work so well unless it looks like strForumURL & strImageURL. I got into the habit of adding strForumURL to everything.
@tomic |
SportsBettingAcumen.com |
 |
|
Topic  |
|