0

I developed a few pages to restrict access by way of a username and password login. I keep getting an error that says my session variable "login" is undefined. here is the code in question, though it might be more so on another page.

<cfif SESSION.login EQ "No">
<cflocation url="adminLogin.cfm" addtoken="no">
</cfif>

I have a cfinclude template on each page I want to restrict access to.

Some help would be greatly appreciated. Thanks in advance!

Tony

Edited by teedoff: n/a

3
Contributors
10
Replies
12
Views
7 Years
Discussion Span
Last Post by arrgh
0

Where are you setting the session variables? I'd also check the obvious things like is sessionManagement enabled in the application.cfm/cfc.

IIRC, there used to be an issue with setting session variables and using cflocation on the same page. Don't know if it still applies though.

0

I'm no expert but I think you may just need to cfparam SESSION.login with a default value of "no" <cfparam name="SESSION.login" default="no"> in your Application.cfm. I've personally found no problem using session vars and cflocation in this way, the only problem I can think of with cflocation is that you can't append URL vars to the cflocation URL, but you can append session vars....I could be wrong though ;-)

0

Where are you setting the session variables? I'd also check the obvious things like is sessionManagement enabled in the application.cfm/cfc.

IIRC, there used to be an issue with setting session variables and using cflocation on the same page. Don't know if it still applies though.

Hi arrgh, thanks for the help. I have an application.cfm that sets the session management to yes.

<!--- Code gets executed with every page request!! --->
<cfapplication name="login" sessionmanagement="Yes">
<cfparam name="SESSION.login" default="No" type="any">
0

Well I think I figured out after the posts you, arrgh, and Shalinko posted. I didnt have a <cfset SESSION.login = "No"> on my adminLogin.cfm template. Not sure yet if its working correctly though, as now I have a new error saying the admin table doesnt exist...and I'm looking at it right now! lol


Ok well it DOESNT exist. I created the new rlbAdmin table in Navicat and it shows up fine, but when I look at my databases in DW its not there. Im still confused. I thought when I added things to mysql databases with navicat, it would, when refreshed, show up locally in DW.

Edited by teedoff: n/a

0

ok NOW it is there...showing in DW as well as Navicat. Still getting an ero that says that database table doesnt exists! Strange....lol

Thats when trying to login in remotely...using the URL.
When i try to login locally it gives the element Login is undefined in SESSION error. Obviously I have a couple issues going on. Any advice? TIA

Edited by teedoff: n/a

0

Well I think I figured out after the posts you, arrgh, and Shalinko posted. I didnt have a <cfset SESSION.login = "No"> on my adminLogin.cfm template

But you shouldn't have to! That's the whole point of using CFPARAM. It sets a default for a variable only if that variable doesn't exist ;-) As long as your other page is in covered by your Application.cfm, it should work without having to set the variable manually.

Sorry. I don't use DW.

0

lol arrgh I agree. everything works locally now! but remotely I still get an error that says the table doesn't exist! As you know I am using Navicat and I created this new table there. The new table shows in Navicat and I even created a quick page with a query to display the records of the new table and it works. This new query page doesnt work remotely, as I get the same error that the table doesn't exist. Maybe I'm really confused and missing out on the concept of MySQL and Navicat! lol Again, I assumed that if I create a table, add records, delete records, whatever, within navicat, because it has a connection to my remote DB server, then everything should be correct on the remote DB server. Am I just totally not grasping something??

0

Well you're talking about a totally different error now. It sounds like a db error. I can't see the query code from here ;) But with datasources it could be anything from missing permissions, wrong user account used to connect, to a datasource pointing to the wrong db.

Edited by arrgh: n/a

0

Oh my Lord! lol just off from chatting with hosting tech support. The other week I was having a similar issue, so I remember them saying they would move my database, to another server. I am using some hosting space from a friend's site. Anyway, in Navicat, I never changed the server hostname...which they didnt tell me to nor what the new host name was. Well I just changed it and added the new table in question and it works!..sheesh Thanks again! I hate when I post a question and something like this is the real issue...makes it seem like I posted it for nothing. Thanks arrgh!

0

If nothing else it makes me feel better about times when I've done that myself ;)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.