I dunno if it works, I just made itI played around with some things. What it is supposed to do is if you have a website, you click on the link that it provides, and it will show a pop up, you put the User name, and Password that (if you are the main person) you give out to certain members such as staff, and if its for staff only (this is not meant for forums but can be added to quickly get to the secret page) and you do not want the page viewed in the public eye, then you can use this to do so. Sure all you have to do is keep the link off of the main site, but what fun will you have to go to the "secret site".
Here is the code:
Code:
- <SCRIPT language="JavaScript"><!--
- /*********************************************************
- GateKeeper v1 - by Darkmage
- http://magedesigns.vforums.co.uk
- You may edit this as long
- as you keep this header in tact.
- **********************************************************/
- function GateKeeper() {
- var password = prompt("Password required:", "");
- if (password) { this.location.href = password + "You site here"; }}
- //--></SCRIPT>
- </HEAD>
- <BODY>
- <A HREF="javascript:{;}" onClick="GateKeeper(); return false">Click here</A> To go to the secret page.
- <NOSCRIPT><FONT COLOR="#FF0000"><BR>Javascript is required to access this area. Yours seems to be disabled.</FONT></NOSCRIPT>
- function gateKeeper() {
- var username = prompt("Enter your username:", "User_Name");
- var password = prompt("Enter your password:", "Password");
- this.location.href = username + "/" + password + ".html";
- }
- </script>
I will provide a page and Username/Password later as when I know this actually works.
Any one may edit/modify the code as long as you keep the Header intact.
Darkmage
EDIT: I guess it did not work: I must have did something wrong
here is the test page:
http://www.freewebs.com/magedesigns/test.html
but when I click on the "click here" link it shows the password as "staff" and it don't ask for user name/password which is
USER: test
PASSWORD: test
If you can see the error then can you please fix it for me. Thanks ^_^
EDIT2: I also tried this:
Code:
- <SCRIPT language="JavaScript"><!--
- /*********************************************************
- GateKeeper v1 - by Darkmage
- http://magedesigns.vforums.co.uk
- You may edit this as long
- as you keep this header in tact.
- **********************************************************/
- <A HREF="javascript:{;}" onClick="GateKeeper(); return false">Click here</A> To go to the secret page.
- <NOSCRIPT><FONT COLOR="#FF0000"><BR>Javascript is required to access this area. Yours seems to be disabled.</FONT></NOSCRIPT>
- function GateKeeper() {
- var username = prompt("Enter your username:", "test");
- var password = prompt("Enter your password:", "test");
- this.location.href = username + "/" + password + "http://www.freewebs.com/magedesigns/Secretpage.html";}}
- function gateKeeper() {
- }
- //--></SCRIPT>
but for some reason the "Click here" wont show up, Do you know what is wrong?
EDIT 3:
I found a bugI guess it looks as this as the password: http://www.freewebs.com/magede
signs/Secretpage.html
This is another edit I did:
Code:
- <SCRIPT language="JavaScript"><!--
- /*********************************************************
- GateKeeper v1 - by Darkmage
- http://magedesigns.vforums.co.uk
- You may edit this as long
- as you keep this header in tact.
- **********************************************************/
- function GateKeeper() {
- var password = prompt("Enter your password:", "");
- if (password) { this.location.href = password + ""; }}
- //--></SCRIPT>
- </HEAD>
- <BODY>
- <A HREF="javascript:{;}" onClick="GateKeeper(); return false">Click here</A> To go to the secret page.
- <NOSCRIPT><FONT COLOR="#FF0000"><BR>Javascript is required to access this area. Yours seems to be disabled.</FONT></NOSCRIPT>
- function gateKeeper() {
- var username = prompt("Enter your username:", "test");
- this.location.href = username + "/" + password + "test";
- }
- </script>
which is really weird as http://www.freewebs.com/magedesigns/Secretpage.html is not shown in the code above , Im so confused
![]()
EDIT 4: UUUGGGI really do not know what I am doing, lol. I can put in anything for the username/password, and it goes through
If any of you, want to re code the whole thing be my guest.
(as you can tell im not really good at JS)
I went ahead and coded my own from scratch.![]()
http://67.158.75.68/js_login.html
The way I made it work is that the username is the directory where the file is stored, the password is the filename, and the type is the file extension. I went a bit further and added an AJAX check to see if the file exists and in turn display a message based on the result.![]()
Username: jspass
Password: hehnoob
Type: html
Cool, but how will it be like mine? I want it to have the click here, and a pop up for the username, then after that a pop up for the password, then if they both are correct, another pop up shows up and says Congratulations! then you click ok, and it goes to that new page.
EDIT: I like yours its cool, but I want me GateKeeper ^_^, but I just want it to workand I don't know why its not working.
EDIT 2: see what I want is on one of my sites most likely Mage Designs, haven't decided yet, but it says Staff only for the "Click Here" part, and then the login info pops up, and if that staff member(s) know the login and password then they can view that page. Or like a Cbox on that hidden page, and so that Members of my forum can access it, but no guests will be able to, its more like a secure thing; But what I need to change is that you can View the source and see the login Information![]()
EDIT 3: I can get it to work on my computer, meaning C:/ part of it.
EDIT 4: Here is the file, just download it and extract it, and move the folder into your Documents, then open up index.html, and put the password in, it will be test, then it will take you to the test page, but if you get it wrong then it wont show up and it goes to a blank page: http://www.megaupload.com/?d=TTQ5MA0V
There's no way to properly hide the information using only JS. Your best bet would be to have a remotely hosted PHP file to do the login.
Oh I see and thats another level of coding I will need to learnSo how will I go about this?
Oh and how did you hide the login information? did you use PHP?
Oh I see and thats another level of coding I will need to learnSo how will I go about this?
Oh and how did you hide the login information? did you use PHP?
I didn't hide it at all; the login information is just the file it's being linked to.![]()
http://67.158.75.68/jspass/hehnoob.html
jspass/hehnoob.html
jspass - File directory & Login Username
hehnoob - File name & Login Password
html - File extension & Login Type
![]()
I know now XD i finally realized it lol.
go to this:
http://www.freewebs.com/magedesigns/test.html and put in Secretpage or home for the password, and it will take you to that page.
EDIT:
but in the pop up, how will I be able to put:
"This is password protected only the ones who know the password may only access this area!"
I know now XD i finally realized it lol.
go to this:
http://www.freewebs.com/magedesigns/test.html and put in Secretpage or home for the password, and it will take you to that page.
EDIT:
but in the pop up, how will I be able to put:
"This is password protected only the ones who know the password may only access this area!"
Use an AJAX status check to see if the file they entered exists. If it does, go to the page. If not, either redirect to a different page or popup the message you want.![]()
Im lost![]()
![]()
On which part?![]()
This:
Use an AJAX status check to see if the file they entered exists. If it does, go to the page. If not, either redirect to a different page or popup the message you want.![]()
and remember you are talking to a noob, who just attempted a JS, which works. but other then anything else im all confused on. AJAX, and PHP, I have no clue how they work or what they do.
http://w3schools.com/ajax/default.asp
![]()
thanks
thanks
No worries, post back if you need any clarification.![]()
alright will do.