473,411 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

sumbiting forms, password protection, in javascript

tolkienarda
316 100+
Hi
I am a js beginer and i need to have a password protected page. i was wondering if i should use some sort of popup window or if i could do somthing with a form on a different page. here is how far i've gotten on the form idea but i have no idea on how to do a popup box with username and password in it
for example i might want to link them to www.webpage.com

<script language="javascript">
function approval(user, pass)
{
if user=="wam06"
{
}
if pass=="wamrc06"
{
}
}
</script>

Login

<form onSubmit="approval(user, pass)">
Username:&nbsp;<input type="text" name="user">
<br />
Password:&nbsp;<input type="password" name="pass">
<br />
<input type="submit">
</form>

i would like to somehow be able to stop people from just typing in the url i will direct them to so i think that a popup box would work better but i have no idea how to build one
Dec 21 '06 #1
2 2661
b1randon
171 Expert 100+
Hi
I am a js beginer and i need to have a password protected page. i was wondering if i should use some sort of popup window or if i could do somthing with a form on a different page. here is how far i've gotten on the form idea but i have no idea on how to do a popup box with username and password in it
for example i might want to link them to www.webpage.com

<script language="javascript">
function approval(user, pass)
{
if user=="wam06"
{
}
if pass=="wamrc06"
{
}
}
</script>

Login

<form onSubmit="approval(user, pass)">
Username:&nbsp;<input type="text" name="user">
<br />
Password:&nbsp;<input type="password" name="pass">
<br />
<input type="submit">
</form>

i would like to somehow be able to stop people from just typing in the url i will direct them to so i think that a popup box would work better but i have no idea how to build one
This is a very bad idea. Passwords done in javascript can always be broken by the user because they can view your javascript code. If you want to secure your site you need to use the web server or a server-side language like php or java.
Dec 22 '06 #2
AricC
1,892 Expert 1GB
You could use .htaccess if you aren't familiar with PHP but this is more of a 1 user solution if your trying to make a login search this site ronverdonk posted a great solution with PHP that includes security.
Dec 22 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Max | last post by:
Hello all, I am trying to protect a page within my site with a JS password scheme. Now I know JS can be quite easily "circumvented", but I came by a code below. My question is: 1. Is there...
7
by: Eagle35 | last post by:
any one now any good java/Html for password pages so i can protect some pages?? Thanks
2
by: chris | last post by:
Hi, I will be looking to use gatekeeper or some other javascript method of password protection but... Once there I need a way of resticting access to a page to stop someone from bookmarking...
7
by: Borked Pseudo Mailed | last post by:
Seeking feedback on Password Protection via Java/JavaScript ONLY (no cgi): SEE: http://online_tools.home.att.net/tools.html *AND* http://online_tools.home.att.net/extraCode.htm Thanks.
3
by: Nick | last post by:
I am working a new application...well actually a series of applications for my company. They want internal users to be able to go to a site and everything regarding security is transparent,...
0
by: Anonieko Ramos | last post by:
ASP.NET Forms Authentication Best Practices Dr. Dobb's Journal February 2004 Protecting user information is critical By Douglas Reilly Douglas is the author of Designing Microsoft ASP.NET...
7
by: Justin | last post by:
I am trying to password protect a subdirectory using forms authentication. I am using the "Location" tag to specify the directory to be protected. The login.aspx page is in the root directory of...
2
by: antonyliu2002 | last post by:
I am testing ASP.NET 2.0 Forms athentication with user credentials in SQL Server 2005. I don't want to put user credentials in web.config, so the credentials section is commented out. The...
1
by: Sean | last post by:
Hi, I've taken over a website, which has an admin section that is currently open. I added Forms Authentication to the admin directory with the using the location section in web.config: ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.