Connecting Tech Pros Worldwide Help | Site Map

Looking for javascript to verify whether used logged in or not

Member
 
Join Date: Oct 2009
Posts: 94
#1: Oct 16 '09
I have Two kinds of web pagess, one is for control page for only admin login, another one is to view status for user login. initially both html files can view with 192.168.0.10/control.htm and other file is 192.168.0.10/status.htm. I searched on Internet and I got some login code. this login comes when I give 192.168.0.10, then I gets login page, I can login with admin/admin, also I can login with user/user, once login, the corresponding page comes with admin login, control.htm comesup, with user login, status.htm file shows, on both of these pages I have logout, when admin or user click on logout, then login page comes back. even admin or user logout, if I give absolute path like 192.168.0.10/control.htm or 192.168.0.10/status.htm on browsewr, those pages are comingup, how can I force without login, that page shouldnot come?. when admin or user didn't login, I don't want those pages should showup, it should show only when admin or user loggedin. These web pages running on microcontroller with limited memory, not like full pledge high-end processor, I don't have CGI/PERL on this microcontroller, I can set some variables in flash, or I can read some variables from flash to web. can I get some javascript to force login page when admin or user not logged in when they give absolute path like above, please let me know.
Member
 
Join Date: Oct 2009
Posts: 94
#2: Oct 19 '09

re: Looking for javascript to verify whether used logged in or not


Can some expert give me a clue about how to do this?. thanks in advance
Member
 
Join Date: Oct 2009
Posts: 94
#3: 4 Weeks Ago

re: Looking for javascript to verify whether used logged in or not


I am new to javascript.

I have login page with javascript, checks login-id and password, admin/admin and user/user, once admin or user login, it brings control page (control.htm) for admin and status page (status.htm) for user. but without login, if I give absolute address of control page or status page directly (192.168.0.10/control.htm or 192.168.0.10/status.htm) it shows up. Is there anyway I can put a javascript validation in control/status page to makesure without login, those page shouldn't appear, can I get some javascript.

Web server running on microcontroller, not full pledge scripts like CGI/Perl won't run here.

thanks in advance
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#4: 4 Weeks Ago

re: Looking for javascript to verify whether used logged in or not


but you are aware that password validation only with Javascript is highly insecure?
Member
 
Join Date: Oct 2009
Posts: 94
#5: 4 Weeks Ago

re: Looking for javascript to verify whether used logged in or not


Actually that is fine, by default I supply different password fof admin and user. Most of the time admin only controls, where as the users will notified that they have to login with user id only, also I am supplying different password for admin and user. Admin is the one who opens manual and reads, admin knows both passwords, where as the user don't know admin password except user password.

I added login script, I can paste if needed. What I want is, after logi, admin login takes to control page (read and write) and user login takes to status page, (Read only), but if I give absolute path, both pages are visible without either login, I need some kind of auth to show pages with abs path.

Please let me know.
Member
 
Join Date: Oct 2009
Posts: 94
#6: 4 Weeks Ago

re: Looking for javascript to verify whether used logged in or not


cursor not pointing to login user id box, unless I keep cursor and click in that box, by default how can I force cursor goto login id box?.
Member
 
Join Date: Oct 2009
Posts: 94
#7: 4 Weeks Ago

re: Looking for javascript to verify whether used logged in or not


It is fine if it is insecure. I am looking how inside pages shouldn't show with absolute path.
gits's Avatar
Moderator
 
Join Date: May 2007
Location: Munich, Germany
Posts: 4,126
#8: 4 Weeks Ago

re: Looking for javascript to verify whether used logged in or not


Quote:

Originally Posted by tvnaidu View Post

cursor not pointing to login user id box, unless I keep cursor and click in that box, by default how can I force cursor goto login id box?.

have a look at the answer to your other post where you asked that question.

kind regards
Member
 
Join Date: Oct 2009
Posts: 94
#9: 4 Weeks Ago

re: Looking for javascript to verify whether used logged in or not


Thanks you verymuch, appreciated.
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#10: 4 Weeks Ago

re: Looking for javascript to verify whether used logged in or not


I'm afraid JavaScript doesn't provide much security and it's very easy to circumvent any login process coded using JavaScript. You may try Flash.
Member
 
Join Date: Oct 2009
Posts: 94
#11: 4 Weeks Ago

re: Looking for javascript to verify whether used logged in or not


can I get some example in Flash, I am using javascriot currently, when I go view source code, it shows complete javascript, id and password, i am looking somehow to mask that info.

Another one is, currently without login, if I give complete path like 192.168.0.10/control.htm, also 192.168.0.10/status.htm. It shows pages directly without login, Is there anyway I can add a script if user didnot login, it shouldn't show that page, can I do?
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#12: 4 Weeks Ago

re: Looking for javascript to verify whether used logged in or not


Not without server-side code. JavaScript can easily be seenread. Even if you obfuscate the code, it's usually a futile exercise.

I don't know about Flash. You'd have to ask in the Flash forum.
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#13: 4 Weeks Ago

re: Looking for javascript to verify whether used logged in or not


Noticed you have two threads on the same topic. Merged threads. Please do not double post.
Reply