vForums Support Banner



 

Welcome Guest! Please Login or Register
vForums Support :: Programming & Coding :: Programming Discussion :: A JS code I made... - View Topic
Topic Rating: *****
Printable View
Nick
Very Senior Member
*****

[Avatar]

Posts: 3,012
Status: Offline
Gender: Male
Location: vForums
Age: 35
Joined:  
Reputation: 62%  


pmwww
A JS code I made... (3rd Jun 08 at 5:14am UTC)
I dunno if it works, I just made it {Tongue Out} I 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:
 
  1. <SCRIPT language="JavaScript"><!--
  2. /*********************************************************
  3.                 GateKeeper v1 - by Darkmage
  4.             http://magedesigns.vforums.co.uk
  5.                 You may edit this as long
  6.         as you keep this header in tact.
  7. **********************************************************/
  8.  
  9. function GateKeeper() {
  10.    var password = prompt("Password required:", "");
  11.    if (password) { this.location.href = password + "You site here"; }}
  12.  
  13. //--></SCRIPT>
  14.  
  15. </HEAD>
  16. <BODY>
  17. <A HREF="javascript:{;}" onClick="GateKeeper(); return false">Click here</A> To go to the secret page.
  18. <NOSCRIPT><FONT COLOR="#FF0000"><BR>Javascript is required to access this area. Yours seems to be disabled.</FONT></NOSCRIPT>  
  19.  
  20.  
  21. function gateKeeper() {
  22.    var username = prompt("Enter your username:", "User_Name");
  23.    var password = prompt("Enter your password:", "Password");
  24.    this.location.href = username + "/" + password + ".html";
  25. }
  26.  
  27. </script>
  28.  
 


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:
 
  1. <SCRIPT language="JavaScript"><!--
  2. /*********************************************************
  3.                 GateKeeper v1 - by Darkmage
  4.             http://magedesigns.vforums.co.uk
  5.                 You may edit this as long
  6.              as you keep this header in tact.
  7. **********************************************************/
  8. <A HREF="javascript:{;}" onClick="GateKeeper(); return false">Click here</A> To go to the secret page.
  9. <NOSCRIPT><FONT COLOR="#FF0000"><BR>Javascript is required to access this area. Yours seems to be disabled.</FONT></NOSCRIPT>
  10.  
  11. function GateKeeper() {
  12.    var username = prompt("Enter your username:", "test");
  13.    var password = prompt("Enter your password:", "test");
  14.    this.location.href = username + "/" + password + "http://www.freewebs.com/magedesigns/Secretpage.html";}}
  15.  
  16.   
  17.  
  18. function gateKeeper() {
  19.  
  20. }
  21.  
  22. //--></SCRIPT>
 


but for some reason the "Click here" wont show up, Do you know what is wrong?


EDIT 3:

I found a bug {Tongue Out} I guess it looks as this as the password: http://www.freewebs.com/magedesigns/Secretpage.html

This is another edit I did:

Code:
 
  1. <SCRIPT language="JavaScript"><!--
  2. /*********************************************************
  3.                 GateKeeper v1 - by Darkmage
  4.             http://magedesigns.vforums.co.uk
  5.                 You may edit this as long
  6.         as you keep this header in tact.
  7. **********************************************************/
  8.  
  9. function GateKeeper() {
  10.    var password = prompt("Enter your password:", "");
  11.    if (password) { this.location.href = password + ""; }}
  12.  
  13. //--></SCRIPT>
  14.  
  15. </HEAD>
  16. <BODY>
  17. <A HREF="javascript:{;}" onClick="GateKeeper(); return false">Click here</A> To go to the secret page.
  18. <NOSCRIPT><FONT COLOR="#FF0000"><BR>Javascript is required to access this area. Yours seems to be disabled.</FONT></NOSCRIPT>  
  19.  
  20.  
  21. function gateKeeper() {
  22.    var username = prompt("Enter your username:", "test");
  23.    this.location.href = username + "/" + password + "test";
  24. }
  25.  
  26. </script>
 


which is really weird as http://www.freewebs.com/magedesigns/Secretpage.html is not shown in the code above {Tongue Out} , Im so confused {Unsure}

EDIT 4: UUUGGG {Angry} I really do not know what I am doing, lol. I can put in anything for the username/password, and it goes through {Unsure} If any of you, want to re code the whole thing be my guest.

(as you can tell im not really good at JS {Cheesy} )
Marc
vChat Developer
*****
I <3 Rossy

Posts: 3,388
Status: Offline
Gender: Male
Location: Ontario, Canada
Age: 32
Joined:  

Additional Groups:
Coding Team
***


Reputation: 40%  


pmwww
Re: A JS code I made... (3rd Jun 08 at 8:31pm UTC)
I went ahead and coded my own from scratch. {Tongue Out}

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. {Smile}

Username: jspass
Password: hehnoob
Type: html

rroll.to— Shorten a link, rickroll your friends.
Nick
Very Senior Member
*****

[Avatar]

Posts: 3,012
Status: Offline
Gender: Male
Location: vForums
Age: 35
Joined:  
Reputation: 62%  


pmwww
Re: A JS code I made... (3rd Jun 08 at 10:20pm UTC)
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 work {Wink} and 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 {Unsure}

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
Marc
vChat Developer
*****
I <3 Rossy

Posts: 3,388
Status: Offline
Gender: Male
Location: Ontario, Canada
Age: 32
Joined:  

Additional Groups:
Coding Team
***


Reputation: 40%  


pmwww
Re: A JS code I made... (3rd Jun 08 at 11:18pm UTC)
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.

rroll.to— Shorten a link, rickroll your friends.
Nick
Very Senior Member
*****

[Avatar]

Posts: 3,012
Status: Offline
Gender: Male
Location: vForums
Age: 35
Joined:  
Reputation: 62%  


pmwww
Re: A JS code I made... (3rd Jun 08 at 11:20pm UTC)
Oh I see and thats another level of coding I will need to learn {Unsure} So how will I go about this?

Oh and how did you hide the login information? did you use PHP?
Marc
vChat Developer
*****
I <3 Rossy

Posts: 3,388
Status: Offline
Gender: Male
Location: Ontario, Canada
Age: 32
Joined:  

Additional Groups:
Coding Team
***


Reputation: 40%  


pmwww
Re: A JS code I made... (3rd Jun 08 at 11:33pm UTC)
 
Oh I see and thats another level of coding I will need to learn {Unsure} So 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. {Wink}

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

{Wink}

rroll.to— Shorten a link, rickroll your friends.
Nick
Very Senior Member
*****

[Avatar]

Posts: 3,012
Status: Offline
Gender: Male
Location: vForums
Age: 35
Joined:  
Reputation: 62%  


pmwww
Re: A JS code I made... (3rd Jun 08 at 11:51pm UTC)
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!"
Marc
vChat Developer
*****
I <3 Rossy

Posts: 3,388
Status: Offline
Gender: Male
Location: Ontario, Canada
Age: 32
Joined:  

Additional Groups:
Coding Team
***


Reputation: 40%  


pmwww
Re: A JS code I made... (4th Jun 08 at 12:19am UTC)
 
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. {Wink}

rroll.to— Shorten a link, rickroll your friends.
Nick
Very Senior Member
*****

[Avatar]

Posts: 3,012
Status: Offline
Gender: Male
Location: vForums
Age: 35
Joined:  
Reputation: 62%  


pmwww
Re: A JS code I made... (4th Jun 08 at 12:27am UTC)
Im lost {Tongue Out} {Cheesy}

Marc
vChat Developer
*****
I <3 Rossy

Posts: 3,388
Status: Offline
Gender: Male
Location: Ontario, Canada
Age: 32
Joined:  

Additional Groups:
Coding Team
***


Reputation: 40%  


pmwww
Re: A JS code I made... (4th Jun 08 at 12:27am UTC)
On which part? {Tongue Out}

rroll.to— Shorten a link, rickroll your friends.
Nick
Very Senior Member
*****

[Avatar]

Posts: 3,012
Status: Offline
Gender: Male
Location: vForums
Age: 35
Joined:  
Reputation: 62%  


pmwww
Re: A JS code I made... (4th Jun 08 at 12:29am UTC)
This:
Quote:

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. {Wink}


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.
Marc
vChat Developer
*****
I <3 Rossy

Posts: 3,388
Status: Offline
Gender: Male
Location: Ontario, Canada
Age: 32
Joined:  

Additional Groups:
Coding Team
***


Reputation: 40%  


pmwww
Re: A JS code I made... (4th Jun 08 at 12:48am UTC)
http://w3schools.com/ajax/default.asp

{Wink}

rroll.to— Shorten a link, rickroll your friends.
Nick
Very Senior Member
*****

[Avatar]

Posts: 3,012
Status: Offline
Gender: Male
Location: vForums
Age: 35
Joined:  
Reputation: 62%  


pmwww
Re: A JS code I made... (4th Jun 08 at 1:40am UTC)
thanks
Marc
vChat Developer
*****
I <3 Rossy

Posts: 3,388
Status: Offline
Gender: Male
Location: Ontario, Canada
Age: 32
Joined:  

Additional Groups:
Coding Team
***


Reputation: 40%  


pmwww
Re: A JS code I made... (4th Jun 08 at 2:51am UTC)
 
thanks


No worries, post back if you need any clarification. {Smile}

rroll.to— Shorten a link, rickroll your friends.
Nick
Very Senior Member
*****

[Avatar]

Posts: 3,012
Status: Offline
Gender: Male
Location: vForums
Age: 35
Joined:  
Reputation: 62%  


pmwww
Re: A JS code I made... (4th Jun 08 at 2:59am UTC)
alright will do.
 Printable View

All times are GMT+0 :: The current time is 5:50am
Page generated in 0.6957 seconds
This Forum is Powered By vForums (v2.4)
Create a Forum for Free | Find Forums