Click to See Complete Forum and Search --> : Need Help with Navigation


Sparky
12-18-2002, 02:33 PM
I have a website that useres log in with a user code and password. This page is for Foster Parents and is directed to a bulliten board for them to post questions or request help. However I have had several persons going to this page with out logging in and posting porn sites. I need away to stop people from getting on the page without logging in from the main page first with a user name and password. I have tried the javascript "Must Visit From" but can not get it to work. Each time I am redirected to the index page and try to go to the page I have linked to it sends me back to the index page. Can someone please help me.

swon
12-18-2002, 04:04 PM
What kind of programming do you use (ASP,PHP...Or just HTML)?

Sparky
12-18-2002, 04:08 PM
I am using HTML in this page.
here is the script I am using.
<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
var requiredfrom = "sample.html"; // required prev. page
if (document.referrer.indexOf(requiredfrom) == -1) {
alert("Your Access is Denied ! You must Login before you can visit this page ! " );
window.location=requiredfrom;
}
// End -->
</script>


The scrip works but when it sends me to the index page and I clink on the link to go back to the page I was sent from it sends me back the the index page and does not recongnize that the index page I came from was the refferd page.

swon
12-18-2002, 06:18 PM
How do you define the link in the sample.html?

Make sure that the link has the http:// header, else the referrer is not able to save some location.

Sparky
12-18-2002, 06:26 PM
Thank you for your help. I just tried it out with your suggestion and it works with a simple tag, howver I need it to work from a log in java script here is the script it is logging in from

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function Login(){
var done=0;
var username=document.login.username.value;
username=username.toLowerCase();
var password=document.login.password.value;
password=password.toLowerCase();
if (username=="masters" && password=="master") { window.location="http://www.lcdsecurity.com/test/testpage.html"; done=1; }

if (done==0) { alert("Invalad! Username or Password !");}
}
// End -->
</SCRIPT>

I need the redirect scrip to be able to know that when someone loggs in they are comming from the refferd page.

I appreciate all you help.
Kind regards Larry