PDA

View Full Version : password script help please!!



comaiwat
02-02-2009, 07:49 PM
Hi, I need help with the var location (see script code below), please let me know where I can put this custom URL in so that when it's call it know where to go. Because the way the code was written it goes to root. Here is my URL where I intent to put in place of the root.

http://gpu_ln02.us.grundfos.com/C125730D0046258B/webImages/biggestloser.html/$File/biggestloser.html

(below is a snipplets from http://www.javascriptkit.com/script/cut34.shtml)


<SCRIPT LANGUAGE="JavaScript">
<!--- Hide from tired old browsers that should be put to pasture.

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

function goForit() {
var location;
var password;
password=this.document.testform.inputbox.value
location=password + ".html"
fetch(location)
theKeeper=window.close()
}

function fetch(location) {
var root;
if (opener.closed) {
root=window.open('','theKeepersGopher','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=no');
root.location.href = location;
} else {
opener.location.href = location;
}
}

// End hiding --->
</SCRIPT>

Thanks in advance...

Nile
02-02-2009, 10:54 PM
If I understand what your saying I'd say replace:


location=password + ".html"
With:


location="http://gpu_ln02.us.grundfos.com/C125730D0046258B/webImages/biggestloser.html/"+password+"/biggestloser.html";

comaiwat
02-02-2009, 11:00 PM
Excellent, I will give it a shot tomorrow and post my finding. I appreciated your help. Thanks.

Nile
02-02-2009, 11:16 PM
I'm glad to help you Comaiwat. I hope it works!
Your welcome!

Javascript is not the best way to do this though. If you have php enabled you can do this:


<?php
if(isset($_POST['submit'])){
if(empty($_POST['pass'])){
die('Empty location, can\'t go anywhere!');
}
header("Location: http://gpu_ln02.us.grundfos.com/C125730D0046258B/webImages/biggestloser.html/".$_POST['pass']."/biggestloser.html");
}
?>

comaiwat
02-03-2009, 05:00 PM
Hi Nile, I understand completely and our domino server does not allow us to use PHP. I'm basically messing with our intranet site and I don't really care if some can hack into it. I'm a designer working on the site and tring to get some advice on scripting. I got the popup to entered the password it works great, except when it goes to the new "pasword" protected site it launched on to itself the "popped up" box. How can I have it launch on to the parent window? The original script I grabbed this from works fine, but I don't know why mine doesn't work like its suppose to. Here is where I grabbed the URL http://www.javascriptkit.com/script/cut34.shtml any suggestions? Also the link below show you the video capture of what's happening, if you care to watch it.
http://screencast.com/t/Lmd5b1sM
sorry, I forgot to adde the current code... I made few adjustment... specifically the window.location if I don't have window. then it won't go to the URL at all. So, I had to add that.

<SCRIPT LANGUAGE="JavaScript">
<!--- Hide from tired old browsers that should be put to pasture.

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

function goForit() {
var location;
var password;
password=this.document.testform.inputbox.value
window.location="http://gpu_ln02.us.grundfos.com/C125730D0046258B/webImages/biggestloser.html/$File/"+password+".html"
fetch(location)
theKeeper=window.close()
}

function fetch(location) {
var root;
if (opener.closed) {
root=window.open('','theKeepersGopher','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=no');
root.location.href = location;
} else {
opener.focus()
opener.top.location.href = location;
}
}

// End hiding --->
</SCRIPT>

Nile
02-04-2009, 04:12 AM
Try the window.parent method. Found here (http://www.javascriptkit.com/jsref/window.shtml).