Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-10-2012, 10:12 PM   PM User | #16
Mayankode
New Coder

 
Join Date: May 2011
Posts: 27
Thanks: 4
Thanked 0 Times in 0 Posts
Mayankode is an unknown quantity at this point
I have replaced the carousel code with

oIframe.src = "Codebox/" + password + ".html";

and it does the right thing when I enter the right password..
But does not bring back to dump if I enter wrong password... it just takes me (as intended by the original code) to /Codebox/wrongpassword.html

The problem here is, a wrong password can be any thing and the code contend in the pop up box does not know when it opens, what password the user is going to enter.

I know I am not understanding the code. Here is the file arrangement.
Webroot
-index.html (the homepage)
-dragto.html ( refered to as dump)
-gate.html (the pop up )
-Codebox
--xyz.html (refered to as treasure)

Please suggest what should the code be which I need to put in the pop up (gate.html).

I think I am confused about the not-carousel.html in the code. Please help
Here is the link with the implemented code. https://dl.dropbox.com/u/25512757/Sand-Box/index.html
Mayankode is offline   Reply With Quote
Old 12-10-2012, 10:25 PM   PM User | #17
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
Erm.. I see that you have kept your original script and just added mine as a completely independent script . You've even kept my reference to non-existent carousel, etc., pages - so no wonder it won't work.

You need to combine my script with yours - that is, with your goForit() function. If you have no idea how to do this then I can't help you any further and perhaps you should consider hiring someone to do this for you.

Good luck. Andy.
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS

Last edited by AndrewGSW; 12-10-2012 at 10:27 PM..
AndrewGSW is offline   Reply With Quote
Old 12-10-2012, 10:33 PM   PM User | #18
Mayankode
New Coder

 
Join Date: May 2011
Posts: 27
Thanks: 4
Thanked 0 Times in 0 Posts
Mayankode is an unknown quantity at this point
I was thinking the same. I wish I could merge it.

I will figure it out. Thank you for the heads up. I am sincerely thankful for your help. Will ask you if I run into any problem with this code. Thank you.
Mayankode is offline   Reply With Quote
Old 12-10-2012, 11:06 PM   PM User | #19
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
Well, seeing as it's Christmas, this will be nearer (its the code for the pop-up):
Code:
<!DOCTYPE html>
<HTML>
<HEAD>
<TITLE>Match 2014 Secret Documents</TITLE>

<script type="text/javascript">

////////////////////////////////////////////////////////////////////
///  Get your very own Gate Keeper from Professional Web Design  ///
///  http://junior.apk.net/~jbarta/weblinks/gate_keeper/         ///
////////////////////////////////////////////////////////////////////

var password = '', newLocation;
var oIframe;

window.onload = function () {
    oIframe = document.getElementById("secretIframe");
    oIframe.onload = function () {
        // for compatibility
        var oDoc = oIframe.contentWindow || oIframe.contentDocument;
        if (oDoc.document) {
            oDoc = oDoc.document;
        }
        var newLoc = oDoc.location.href;
        if (newLoc.indexOf(password) + 1) {
            // alert('Yes, it is the correct page!');
            fetch(newLocation);
            theKeeper = window.close();
        } else {
            // 404 - out of luck!
            opener.location.href = "dump.html";
            theKeeper = window.close();
        }
    };
};

function goForit() {
    password = this.document.testform.inputbox.value;
    newLocation = 'Codebox/'+ password + ".html";
    oIframe = document.getElementById("secretIframe");
    oIframe.src = newLocation;
}

function fetch(locn) {
  var root;
  if (opener.closed) {
    root = window.open(locn,'theKeepersGopher','height=500,width=400,left=100,top=100,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no');
  } else {
    opener.location.href = locn;
  }
}

// End hiding --->

</script>

</HEAD>

<BODY>
<iframe id="secretIframe">Hello</iframe>
<FONT FACE="ARIAL" SIZE=2 color="#000"><B>password xyz for treasure for any other password you will be taken to dump</B></FONT><BR>
&nbsp;


<CENTER>
<FORM NAME="testform" action="" method="get">
<INPUT TYPE="password" NAME="inputbox" VALUE="" size=20 class="pass"><p>
<INPUT TYPE="button" NAME="button" Value="get treasure" onClick="goForit(this.form)" class="button">

</FORM>
</CENTER>

</BODY>

</HTML>
It assumes a page called dump.html exists, as you suggested previously. I haven't tested it in combination with the main page.
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
AndrewGSW is offline   Reply With Quote
Old 12-10-2012, 11:52 PM   PM User | #20
Mayankode
New Coder

 
Join Date: May 2011
Posts: 27
Thanks: 4
Thanked 0 Times in 0 Posts
Mayankode is an unknown quantity at this point
I really appreciate your help Andy. I used the above code for the popup and I feel I am almost there. I can see the pop up box load the page after clicking submit in the password form. And as expected it does close itself after opening the page in the main window too. But the page it opens in the main window is not the dump.html (which is present in the root)rather it takes to the /Codebox/wrongpassword.html I have implemented it here https://dl.dropbox.com/u/25512757/Sand-Box/index.html

I don't want to bother you with this, And I appreciate your time and effort. I would still appreciate it even if you drop this out now. Thank you...

Last edited by Mayankode; 12-11-2012 at 12:09 AM..
Mayankode is offline   Reply With Quote
Old 12-11-2012, 12:13 AM   PM User | #21
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
It won't work from dropbox or locally - it should work from a server (probably..).

When the wrong password is entered it doesn't have a 404 page to display, so the address bar still contains 'wrongpassword' - so it thinks the right password was entered.
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
AndrewGSW is offline   Reply With Quote
Old 12-11-2012, 12:33 AM   PM User | #22
Mayankode
New Coder

 
Join Date: May 2011
Posts: 27
Thanks: 4
Thanked 0 Times in 0 Posts
Mayankode is an unknown quantity at this point
The whole thing boils down to the absence of a 404page...
I just uploaded them to the server in google appengine.. but like I was saying in the other post the errors are displayed with some gibberish error codes and it actually does not reach a 404 page. The page address remains the same.

So this did not work in the server too. And it will not work until I fix the definable 404page issue. Once I set it up, This pop up code will work like a charm I think. You have been very kind to me. And I appreciate that. Please do not worry about this. I will have it figured out by some friend of mine some time later.

Heartfelt thanks to you...
Mayankode is offline   Reply With Quote
Old 12-11-2012, 12:43 AM   PM User | #23
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
No worries. You could delete (temporarily) that stuff in your config-file, just leaving the redirection at the bottom to your own 404 page. Andy.
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
AndrewGSW is offline   Reply With Quote
Reply

Bookmarks

Tags
password protect

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:05 AM.


Advertisement
Log in to turn off these ads.