Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
AcidGuy #1
avoid logging same user again...
the system consist of many wireless pocket pc connected to a portatil computer
which has the access point and is the server which counts the data; every
inventory employee has one so they can move freely around the store and make
the count, every pocket pc counts with a reader system, so then submit the data
to the server and everything is ok....
so the problem is, how can avoid 2 users accessing with the same username?
my boss was running the system and everything was ok until he got another
pocket pc, and tried to login with the same user an to my surprise the
coldfusion server give him permission withouth problem...
i am using the cflogin and cfloginuser tag, so i was convinced coldfusion mx
did it automatically, is there a way to avoid what i mentioned early about 2
accesing with same username at same time?
thx for any advice or help!
AcidGuy Guest
-
Logging a user
Hey all, Question - is there any way to "log" the people who have logged in to use a CF App? Here is my scenario - I am creating a CF app that... -
How can I avoid NaN
When my .swf loads the variables from the .txt file (days=2&hours=17&minutes=10&seconds=56), the swf file starts and shows seconds "56" for one... -
How to avoid this
Hi, I have a project where when the user scroll over the buttons a picture or movie display on the screen. All works fine, but moving between... -
logging user visit
I am building an ASP application, in this application, one of the functions is that I have to know exactly how long a user has used a certain page... -
Avoid SmartNavigation
I've done some investigating about various problems with the SmartNavigation feature. It seems to me that the general consensus is to avoid... -
BSterner #2
Re: avoid logging same user again...
Taking verbiage directly from the "Macromedia Coldfsuion MX Web Application
Construction Kit"
"It is up to you to ensure that each possible combination of NAME and PASSWORD
is unique (this is almost always the case anyway, an application should never
allow two users to have the same username and password). the best practice
would be to make sure that some kind of unique identified (Such as the
ContactID) be used as part of the NAME, just to make sure that ColdFusion
understands how to distinguish your users from one another".
So, in short it is up to you to prevent these multiple logins. One approach
is to use the SessionTracker object available in CFMX+.
<cfapplication name="TestApp" clientmanagement="yes" sessionmanagement="yes"
sessiontimeout="#CreateTimeSpan(0,0,20,0)#">
<cfscript>
tracker = createObject("java", "coldfusion.runtime.SessionTracker");
sessions = tracker.getSessionCollection("TestApp");
</cfscript>
<cfdump var="#sessions#" label="Session Collection Information">
<cfabort>
BSterner Guest
-
AcidGuy #3
Re: avoid logging same user again...
so, is there a way to access to the properties of each object like cfdump do it
?
so i can check for a existing username in the tracker and then avoid 2 users
logging in the same session
thx for any help!
AcidGuy Guest
-
BSterner #4
Re: avoid logging same user again...
One option is to just loop through the structure returned by
'tracker.getSessionCollections()'. Like...
<cfscript>
duplicateLogin = false;
for (keyName in sessions)
{
if (FORM.username eq sessions[keyName].username) //assumes there's a session
variable named 'username'
{
duplicateLogin = true;
break;
}
}
if (duplicateLogin) ...
//Code to handle duplicate login goes here
</cfscript>
BSterner Guest
-
AcidGuy #5
Re: avoid logging same user again...
i could the names of the people connected, but still some bad things remain
there...
when 1 user is logged the system show 2 session, thats what i could see with
cfdump, when 2 users go and login, then appear the right 2 sessions, and the
strange session dissapear...
so when the strange session is opened, the system of course cant get the
INOMBRE property which si into a structure called SESIONACTUAL so the server
throws this error :
Element SESIONACTUAL.INOMBRE is undefined in a Java object of type class
coldfusion.runtime.MemorySessionScope referenced as
this is really weird since i have been spending a lot of energy trying to make
this works...
so i used the isDefined() to know if the structure and the variable exists or
not and the server throws another error, then StructKeyExists to check if
SESIONACTUAL exists so then the code is able to avoid the strange and the
system throws another error...
this is really weird, the good is that it feel one step closer, so the
problem is to deal with demonic errors ...
any help is apreciated!
AcidGuy Guest
-
jorgepino #6
Re: avoid logging same user again...
can you create a field in your db that would tell you when your login ro log out?
jorgepino Guest
-
AcidGuy #7
Re: avoid logging same user again...
huh, at the end i could do it making a similar aproach with the code you gave me
here there is a nice article that can help someone :
[url]http://coldfusion.sys-con.com/read/41900.htm[/url]
thx for the support!
AcidGuy Guest



Reply With Quote

