Looking for javascript to verify whether used logged in or not | Member | | Join Date: Oct 2009
Posts: 94
| | |
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
| | | 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
| | | 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
|  | Moderator | | Join Date: Aug 2008 Location: Leipzig, Germany
Posts: 3,629
| | | 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
| | | 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
| | | 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
| | | 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.
|  | Moderator | | Join Date: May 2007 Location: Munich, Germany
Posts: 4,126
| | | re: Looking for javascript to verify whether used logged in or not Quote:
Originally Posted by tvnaidu 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
| | | re: Looking for javascript to verify whether used logged in or not
Thanks you verymuch, appreciated.
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | 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
| | | 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?
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | 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.
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | 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.
|  | Similar JavaScript / Ajax / DHTML bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,295 network members.
|