PDA

View Full Version : Only enter page from specific page



antca
Nov 24th, 2003, 04:01 PM
Hello,
GREAT FORUM!
I'm getting ito Java but am still at the point of using free scripts from Java kit/ here etc... and manipulating (alot of latenight ahhhh, I get it!)
I'm password protecting a site (not needing it secure- just needs to look like it)
THE Q - The one thing I DO want is to have the page there getting to only entered from the login (avoid people going direct to the "faux secured" page).
There was a script somewhere -here or??? that looked perfect I cannot find it or remember the codeing...
Anyone....
if you have what I'm looking for please include any info for the thanks and links page....and in the script!
Thanks!

noXen
Nov 24th, 2003, 04:24 PM
I guess its Borgtex's Secure Login wih Javascript u're talking about. If thats the case, you can get it here (http://codingforums.com/showthread.php?s=&threadid=10114)

Hope that helps.

-noXen

A1ien51
Nov 24th, 2003, 04:26 PM
First off Java and JavaScript are two different languages.

If you want real security, then you need a sever side language to do this since a person can disable JavaScript and view your site.

The best way to see if a person has entered the password is to set a session cookie on the password screen. When a page is loaded, you check for that cookie. If the cookie exsists then you allow the person to view the page. Else send them to the log in page.

Eric

A1ien51
Nov 24th, 2003, 04:26 PM
Or you can check for the refering page and redirect based on that

antca
Nov 24th, 2003, 05:12 PM
I'm good with the password thing... it's the scripting for the page there getting to I need something that only allows access if entered from a specific page. Page1 -> password prompt ---> page2. But if someone entered URL for page 2 it would not load because they did not enter from page1

FYI -Secure is not a big thing, just want it to look like it (using:
<SCRIPT>
function passWord() {
var testV = 1;
var pass1 = prompt('Please Enter Your Password',' ');
while (testV < 3) {
if (!pass1)
history.go(-1);
if (pass1.toLowerCase() == "letmein") {
alert('You Got it Right!');
window.open('protectpage.html');
break;
}
testV+=1;
var pass1 =
prompt('Access Denied - Password Incorrect, Please Try Again.','Password');
}
if (pass1.toLowerCase()!="password" & testV ==3)
history.go(-1);
return " ";
}
</SCRIPT>
<CENTER>
<FORM>
<input type="button" value="Enter Protected Area" onClick="passWord()">
</FORM>
</CENTER>

Looks good and clean on a page...

It's people avoiding the login and bookmarking the page2

Thanks again.

antca
Nov 24th, 2003, 09:36 PM
JAVA'S FUN


<script>
<!--
/*Referrer Checker- By JavaScript Kit
(www.javascriptkit.com) Over 200+ free JavaScripts here!
*/

//specify valid referrals for script to accept
//if you wish an entire domain to be valid, enter that (ie: "javascriptkit.com")
var validreferrals=new Array()
validreferrals[0]="http://www.javascriptkit.com/script/cut170.shtml"
validreferrals[1]="http://javascriptkit.com/script/cut170.shtml"

var passed=0

for (r=0;r<validreferrals.length;r++){
if (document.referrer.indexOf(validreferrals[r])!=-1){
passed=1
break
}
}

if (passed==0){
alert("Access to the page denied!")
history.go(-1)
}

//-->
</script>