473,790 Members | 2,951 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can I password protect a page?

Hi there,

I don't know much about web design but I proudly managed to password protect
a page on my site. Later I realized that everyone looking at the source in
any web browser can see the password. Is there a way to improve this code so
that instead of the password people viewing the page source would only see
bullets instead of the characters of the password (or hide it alltogether?)

Thank you for your help.

Hi there

Here is the code:

<script language="javas cript">
<!--//

function pasuser(form) {
if (form.pass.valu e=="michael2") {
location="index 2.html"
} else {
alert("Invalid Password")
}
}
//-->
</script>

<tr><td><h1><i> <b>Password:</b></i></h1></td><td><form name="login"><i nput
name="pass"
type="password" ></td></tr>
<tr><td><inpu t type="button" value="Login"
onClick="pasuse r(this.form)"></td><td><br>
Nov 5 '05 #1
3 3332
This is not something you normally do in Javascript. There are a number of ways to do this. I assume you don't have access to the
actual webserver, if you do then you can setup authentication there. Otherwise you need to go to a dynamic content language like JSP
or PHP or something like that.

Dennis

Narlen wrote:
Hi there,

I don't know much about web design but I proudly managed to password protect
a page on my site. Later I realized that everyone looking at the source in
any web browser can see the password. Is there a way to improve this code so
that instead of the password people viewing the page source would only see
bullets instead of the characters of the password (or hide it alltogether?)

Thank you for your help.

Hi there

Here is the code:

<script language="javas cript">
<!--//

function pasuser(form) {
if (form.pass.valu e=="michael2") {
location="index 2.html"
} else {
alert("Invalid Password")
}
}
//-->
</script>

<tr><td><h1><i> <b>Password:</b></i></h1></td><td><form name="login"><i nput
name="pass"
type="password" ></td></tr>
<tr><td><inpu t type="button" value="Login"
onClick="pasuse r(this.form)"></td><td><br>

Nov 5 '05 #2

Narlen wrote:
Hi there,

I don't know much about web design but I proudly managed to password protect
a page on my site. Later I realized that everyone looking at the source in
any web browser can see the password. Is there a way to improve this code so
that instead of the password people viewing the page source would only see
bullets instead of the characters of the password (or hide it alltogether?)


This should be done on the server using htProtect(unles s you are on a
Microsoft server using Frontpage and perhaps some other Microsoft
programs.). If your host does not allow basic server side operations
such as this, dump your host and get another one. Good hosts that cater
to small business often are no more, or less, expensive than hosts that
cater mainly to casual users. There is a glut of hosts around the
world, and these days it makes little difference if your host is in
your own country or half-way around the world.

My domain host lets you select a shared Microsoft or Unix(Apache)
server. I use Unix. The control panel has nearly everything you might
want to use such as htProtect, php, perl, shopping carts, secure pages,
and automated domain search and purchase. Here is what my host says to
do to password protect:

"htProtect utility allows you to password-protect any directory on your
site so only authorized visitors can open its content with their
browsers.
To start htProtect, click the WebProtect icon on your home page.

Warning: Don't use this feature if you have Frontpage Extensions
installed. You would need to use Frontpage itself to perform this
function."

It only takes a few very simple inputs to a form and a few key clicks
to password protect any directory you wish. There is really no need to
have to bother to write your own php or other script to password
protect.

Nov 5 '05 #3
wl
"Narlen" <m_******@hotma il.com> wrote in message
news:BF914485.1 5680%m_******@h otmail.com...
Hi there,

I don't know much about web design but I proudly managed to password
protect
a page on my site. Later I realized that everyone looking at the source in
any web browser can see the password. Is there a way to improve this code
so
that instead of the password people viewing the page source would only see
bullets instead of the characters of the password (or hide it
alltogether?)

Thank you for your help.

Hi there

Indeed the best way to do password protection is serverside. If this is
impossible, please visit Real Gagnon's site:

http://64.18.163.122/rgagnon/jsdetails/js-0022.html

Wim
Nov 5 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3417
by: Wm | last post by:
Something just occurred to me... <yeah, I know, it scared me too> I just password-protected a website by including a password authentication script in each page of a private section. The script checks the login against the mySQL database. This type of protection will only affect the .php pages, won't it? The images that are contained in the pages are not protected, as they would be if I had a .htaccess file on the parent directory..? This...
7
2150
by: juglesh | last post by:
<body><div align="center"> <?php if (!isset($password)){ ?><form action="<?php $_SERVER; ?>" method="post"> type password here&nbsp;<input name="password" type="text" size="8"> then <input name="submit" type="submit"> </form> <?php die; }
10
2706
by: Mike Painter | last post by:
I need a scheme to give people password access to JavaScript quizzes that I have. I've done a lot of programming but almost no JS. Probably one password per person for each of five tests. I suspect I will be maintaining the lists but if there is a *very* easy routine that an end user could use it would be nice. It usually takes more than five visits to get this guy up on anything new.
10
6014
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 a way to find a password for this script? How easily? 2. Is there a stronger scheme available in JS?
0
1144
by: teenzbutler | last post by:
I am attempting to password protect some web pages. I have following the instructions within the following article: Microsoft Knowledge Base Article - 301464 - How To Use Simple ASP Code to Password Protect Your ASP Pages. Every thing works fine. The am having a problem figuring out how to add additional usernames and passwords. It appears as though the code is only good for one user. Can anyone help me out. I have pasted the code below....
5
2997
by: Brent Burkart | last post by:
I want to protect my website with a user and password. I have SQL Server 2000 where I want to store the users and passwords and the website is complete. I just need to add in some security with password protection. Can anyone help me out?
4
2577
by: sunniyeow | last post by:
Hi, My question is regarding password protecting 2 different folders inside a single virtual directory using forms authentication method. Easier if I illustrate things out... - <authentication mode="Forms"> - Virtual Directory aka Top Level Root = /mysite - Inside /mysite I have 2 sub-folders which I want to password protect = /adminonly and /memberonly - /adminonly is assigned to a single Admin user with a hard-coded pair of username...
5
2801
by: nick | last post by:
I need to create a simple asp.net application that use password protect some html pages. The html page provider doesn't know asp.net. And the host doesn't allow me to create user accounts. What's the best way to store users/password except database tables? and to store html files?
22
5830
by: teejayem | last post by:
Hi, I am new to programming with databases and was wanting some help. Is there any way to password protect an access database and access sent sql commands to it via vb.net code? Any help would be much appreciated. Thanks in advanced.
0
9512
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10419
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10201
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9023
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7531
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6770
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5424
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3709
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2910
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.