Jump to content

Can a javacript function terminate a php script?


ThunderAI

Recommended Posts

in the php help section there is a topic about preventing direct access to a php file unless it is in an iframe.  in order to tell this i used this function.

 

	<script>
			var youraterrorist

			if (top.location == self.location) {
					alert('your bad');
					document.write('your bad');
					youraterrorist = 1;
				}
				else {
					alert('your good');
					youraterrorist = 0;
				}
		</script>

 

is it possible for the javascript to actally terminate the rest of the file if this test fails?

Link to comment
Share on other sites

JavaScript is executed by the web browser after the entire page has loaded.

You could just send them to a different location, but they could easily get around it by disabling JavaScript.

 

If you want to keep someone out of somewhere, use server-side authentication.

 

 

Bruce

Link to comment
Share on other sites

JavaScript is executed by the web browser after the entire page has loaded.

You could just send them to a different location, but they could easily get around it by disabling JavaScript.

 

If you want to keep someone out of somewhere, use server-side authentication.

 

 

Bruce

 

Is just checking the value in a session user id ok.  I was able to do that and everything works how i want it to; however, would there be a better way?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.