UGN Security Forums
My ProfileMember DirectoryLogin
Search our ForumsView our FAQView our Site Rules
View our CalendarView our Active TopicsGo to our Main Page

UGN Security Store
 

Network Sites UGN Security, The GoNix Initiative, Elite Web Gamers, Back of the Web, EveryDay Helper, VNC Web Design & Development
August
Su M Tu W Th F Sa
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
Sponsored Links
Latest Postings
Amazon Gift Card Generator/KeyGen?te
by Gecko666
08/22/14 09:21 AM
Latest Reviews
Topic Options
Rate This Topic
#19487 - 03/28/02 06:15 PM Password Protecting A Page With Java Script
BackSlash Offline
UGN's Resident Homo

Registered: 03/16/02
Posts: 599
Loc: 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."

Top
Sponsored Links
      
#19488 - 03/29/02 06:32 AM Re: Password Protecting A Page With Java Script
Gremelin Offline

Community Owner
*****

Registered: 02/28/02
Posts: 7192
Loc: 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, Elite Web Gamers & VNC Web Design Owner

Top
#19489 - 03/29/02 11:17 AM Re: Password Protecting A Page With Java Script
BackSlash Offline
UGN's Resident Homo

Registered: 03/16/02
Posts: 599
Loc: 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."

Top
#19490 - 03/29/02 12:52 PM Re: Password Protecting A Page With Java Script
SilentRage Offline
DollarDNS Owner

Registered: 03/04/02
Posts: 1273
Loc: 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

Top
#19491 - 03/29/02 01:00 PM Re: Password Protecting A Page With Java Script
Gremelin Offline

Community Owner
*****

Registered: 02/28/02
Posts: 7192
Loc: 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, Elite Web Gamers & VNC Web Design Owner

Top
#19492 - 03/30/02 09:22 AM Re: Password Protecting A Page With Java Script
BackSlash Offline
UGN's Resident Homo

Registered: 03/16/02
Posts: 599
Loc: TN
well, OBVIOUSLY
_________________________
"It's better to burn out, than to fade away."

Top
#19493 - 03/30/02 07:19 PM Re: Password Protecting A Page With Java Script
BackSlash Offline
UGN's Resident Homo

Registered: 03/16/02
Posts: 599
Loc: 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."

Top
#19494 - 03/30/02 09:09 PM Re: Password Protecting A Page With Java Script
Gremelin Offline

Community Owner
*****

Registered: 02/28/02
Posts: 7192
Loc: 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, Elite Web Gamers & VNC Web Design Owner

Top
#19495 - 03/31/02 03:03 AM Re: Password Protecting A Page With Java Script
Snake Offline
Junior Member

Registered: 03/02/02
Posts: 52
Loc: 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

Top
#19496 - 03/31/02 05:29 AM Re: Password Protecting A Page With Java Script
SilentRage Offline
DollarDNS Owner

Registered: 03/04/02
Posts: 1273
Loc: 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

Top

Moderator:  §intå×, Gremelin 
Featured Member
Registered: 08/22/14
Posts: 1
Forum Stats
2148 Members
46 Forums
33974 Topics
69141 Posts

Max Online: 1567 @ 04/25/10 02:20 AM
Top Posters
UGN Security 27136
Gremelin 7192
§intå× 3255
SilentRage 1273
Ice 1146
pergesu 1136
Infinite 1041
jonconley 955
Girlie 908
unreal 860
Newest Members
Gecko666, defghi795767, Devo60, ali, lavos
2147 Registered Users
Who's Online
0 registered (), 307 Guests and 320 Spiders online.
Key: Admin, Global Mod, Mod
Latest News


Donate
  Get Firefox!
Get FireFox!