Your browser does not seem to support CSS. If images appear below, please disregard them.
It appears that you're running an Ad-Blocker. This site is monetized by Advertising and by User Donations; we ask that if you find this site helpful that you whitelist us in your Ad-Blocker, or make a Donation to help aid in operating costs.
Previous Thread
Next Thread
Print Thread
Rate This Thread
#19487 - 03/29/02 02:15 AM Password Protecting A Page With Java Script  
Joined: Mar 2002
Posts: 599
BackSlash Offline
UGN's Resident Homo
BackSlash  Offline
UGN's Resident Homo

Joined: Mar 2002
Posts: 599
TN
-------------------
JavaScript Password
-------------------

This is how to make a password protected page using javascript. This may be better used under a programming topic, but it does relate to web design in that many web designers will want to protect a page with a password, possibly for members, etc.

-------------------
How It's Done
-------------------

This is quite a simple script, however, due to that, it is not very effective and I wouldn't recomend protecting anything important with it. Below is the script, I will then explain parts of it.






Explanation:

var password; (this defines a variable named password)

var pass1="GayGizmo"; (this creates the password that will be accepted. you can have more than one accepted, thus pass1, pass2, pass3, etc.)

password=prompt('Please enter your password',' '); (this prompts the viewer to enter a password. what he enters is now the value of the variable "password")

if (password==pass1)
alert('Password Correct! Click OK to enter!');
(if the password entered matches the one we set (GayGizmo), then it will alert that you have found the right password and it will take you to the page)


else
{
window.location="http://www.currantech.com";
}
(this tells the script that if the password entered was something diff then it will take them to this site.)


And thats it for password protecting a page with javascript. Also, remember that this is not the safest way to protect a page and it can easily be cracked simply by looking at the pages source. Post anything else that has to do with password protecting or if you have some corrections to my script, etc.

-BackSlash


"It's better to burn out, than to fade away."
Sponsored Links
#19488 - 03/29/02 02:32 PM Re: Password Protecting A Page With Java Script  
Joined: Feb 2002
Posts: 7,195
Gremelin Offline
Community Owner
Gremelin  Offline

Community Owner

Joined: Feb 2002
Posts: 7,195
Likes: 3
Portland, OR; USA
hey i resent that :(...


Becides, every passworded page i go to i view to source of the page, i mean its not that hard to "crack" a javascript password.. its more fun to use CGI cas no one knows where the pass.txt is on your server ;x


Donate to UGN Security here.
UGN Security, Back of the Web, and VNC Web Services Owner
#19489 - 03/29/02 07:17 PM Re: Password Protecting A Page With Java Script  
Joined: Mar 2002
Posts: 599
BackSlash Offline
UGN's Resident Homo
BackSlash  Offline
UGN's Resident Homo

Joined: Mar 2002
Posts: 599
TN
thats the idea gizzy, and thanks for pointing out that its not a safe way to protect a page. i only said that how many times in my original post?

-BackSlash


"It's better to burn out, than to fade away."
#19490 - 03/29/02 08:52 PM Re: Password Protecting A Page With Java Script  
Joined: Mar 2002
Posts: 1,273
SilentRage Offline
DollarDNS Owner
SilentRage  Offline
DollarDNS Owner

Joined: Mar 2002
Posts: 1,273
OH, USA
Well Gizmo, I hope that it doesn't matter if the person knows where your "pass.txt" is. You SHOULD instead be using a htpasswd file or some other file who's permissions wouldn't grant read access anyway.


Domain Registration, Hosting, Management
http://www.dollardns.net
#19491 - 03/29/02 09:00 PM Re: Password Protecting A Page With Java Script  
Joined: Feb 2002
Posts: 7,195
Gremelin Offline
Community Owner
Gremelin  Offline

Community Owner

Joined: Feb 2002
Posts: 7,195
Likes: 3
Portland, OR; USA
oh hell yeh, but most free servers dont allow htaccess i was sayin that all for people who were using a free service. As for payservices .htaccess ALWAYS


Donate to UGN Security here.
UGN Security, Back of the Web, and VNC Web Services Owner
Sponsored Links
#19492 - 03/30/02 05:22 PM Re: Password Protecting A Page With Java Script  
Joined: Mar 2002
Posts: 599
BackSlash Offline
UGN's Resident Homo
BackSlash  Offline
UGN's Resident Homo

Joined: Mar 2002
Posts: 599
TN
well, OBVIOUSLY


"It's better to burn out, than to fade away."
#19493 - 03/31/02 03:19 AM Re: Password Protecting A Page With Java Script  
Joined: Mar 2002
Posts: 599
BackSlash Offline
UGN's Resident Homo
BackSlash  Offline
UGN's Resident Homo

Joined: Mar 2002
Posts: 599
TN
This is just an addition to my original post. Basically this is another Java Script Password Protector, but this one is a little bit harder to get through than the other. However, once again I will say this is not a safe way to protect a page, so look into other ways of password protecting a page if you want to do it.

How To Do It:

Start with your original page called page1.html On this page have the below link to an middle page between the original and the one the password protects.


Enter Here


This link takes you to a middle page which has the password script on it. The script is below.



Middle Page





I won't explain this much, but basically it asks for a password, if its correct it takes you to the third page, page3.html, if its not the correct it takes you back to the original page. If this is confusing to you check my original post because it goes into great detail on each part. The reason this is better than the first is because in the first all the viewer must do is open the source of the page to see the password. With this new script the viewer can still open the source to see the password, but since the script is on a middle page it makes it so that the viewer must turn of the use of scripts in his browser so that he can view the source. This just takes a little more thinkin on the viewers side, and hopefully will protect you more. I'm sure gizzy or someone will have some other way to get around this besides turning off the scripts, but thats because they are too smart. The point is if you are going to use a javascript protected page, this second script is better than the first I posted.

-BackSlash


"It's better to burn out, than to fade away."
#19494 - 03/31/02 05:09 AM Re: Password Protecting A Page With Java Script  
Joined: Feb 2002
Posts: 7,195
Gremelin Offline
Community Owner
Gremelin  Offline

Community Owner

Joined: Feb 2002
Posts: 7,195
Likes: 3
Portland, OR; USA
lol then i view your source, and paste the password for the world, ktnx..


Donate to UGN Security here.
UGN Security, Back of the Web, and VNC Web Services Owner
#19495 - 03/31/02 11:03 AM Re: Password Protecting A Page With Java Script  
Joined: Mar 2002
Posts: 52
Snake Offline
Junior Member
Snake  Offline
Junior Member

Joined: Mar 2002
Posts: 52
NZ
Javascript passwords suck to the badest, it was the first password i ever cracked, back in my newbie days, kehehe, i was proud of myself.

/me remembers back the days he and his mate had a hacker group called "The Skull Monkeys"

the first page we ever defaced was http://www.expage.com/page/jaredspaje which we knew the password too

#19496 - 03/31/02 01:29 PM Re: Password Protecting A Page With Java Script  
Joined: Mar 2002
Posts: 1,273
SilentRage Offline
DollarDNS Owner
SilentRage  Offline
DollarDNS Owner

Joined: Mar 2002
Posts: 1,273
OH, USA
The safest way to password protect your page via script, is through VBScript (and maybe JScript?) and have it encoded. VBScript pages can still be decoded but you'd have to do a bit of searching for something that'd do it.


Domain Registration, Hosting, Management
http://www.dollardns.net
Sponsored Links

Member Spotlight
Gremelin
Gremelin
Portland, OR; USA
Posts: 7,195
Joined: February 2002
Show All Member Profiles 
Forum Statistics
Forums45
Topics46,798
Posts81,968
Average Daily Posts11
Members2,159
Most Online1,567
Apr 25th, 2010
Latest Postings
Top Posters(All Time)
UGN Security 39,962
Gremelin 7,195
§intå× 3,255
SilentRage 1,273
Ice 1,146
pergesu 1,136
Infinite 1,041
jonconley 955
Girlie 908
unreal 860
Top Liked Users (All Time)
§intå× Likes: 1
Cold Sunn Likes: 1
Crime Likes: 1
Cyrez Likes: 1
Ghost Likes: 1
Gremelin Likes: 4
Ice Likes: 1
unreal Likes: 1
Top Liked Users (30 Days)
Powered by UBB.threads™ PHP Forum Software 7.6.0
(Snapshot build 20160902)