views:

18

answers:

1

I don't want to allow people to go directly to the pages in the AJAX directory but they still need to be served from their parent page. I have tried numerous .htaccess lines but they all block it from the main page as well. to sum up, I dont want people to be able to type in http://www.mysite.com/AJAX/page1.html and view it but page1.html needs to be brought into its parent page via AJAX.

<LIMIT GET POST>
Order deny, allow
deny from all
</LIMIT>

blocks all access

Can you define a flag in the parent file define('IS_IN_SCRIPT',1); and check for it in the AJAX pages? will that work with AJAX pages or only PHP includes?

A: 

You could always set up something so that if a particular argument isn't passed in via GET or POST, the ajax page will just redirect you elsewhere.

In php, it'd look like

if(!isset($_POST['some_var']))
  header('Location: somePage.html');
Sam Dufel
How would I ad that here? $("ul#yearMenu li a").live('click',function(e) { e.preventDefault(); var $parent = $(this).parent(); $parent.addClass("selected").siblings().removeClass("selected"); var href = $(this).attr('href'); $("#tableContent").load(href); });
Dirty Bird Design
Oh, I was thinking that it'd be better to do the check in php or some other server-side language. It's iffy trying to read post/get arguments from javascript.
Sam Dufel
so would my scheme of adding the header to the main page and checking for it on the AJAX pages be apropriate? Im calling the pages via jquery .load function
Dirty Bird Design
Can you help me a little more with the code? on the parent page I would have <?php $_POST['foo'];?> and on the AJAX pages would have <?php if(!isset($_Post['foo'])) header('Location:403.php')'?> correct?
Dirty Bird Design
I have it working to where if you hit the AJAX page url directly it redirects, but its not bringing in the AJAX page when you click the link now
Dirty Bird Design
Ah, no - to set the post variable, you have to send it via your ajax function - if it's easier, you can just use a GET instead and append a ?fo0=something to the end of the url of the ajax file
Sam Dufel