title: How can i check if page accessed directly?
body: <p>Hi :)
  I want to forbid access of a page directly, what i mean is if some one try to access for example the page </p>
  
  <blockquote>
    <p>proccess.php</p>
  </blockquote>
  
  <p>He will get an error message.
  BUT! if the page is accessed via AJAX call, it will act normal.</p>
  
  <p>i've tried:</p>
  
  <pre><code>if( preg_match( '/' . basename( __FILE__ ) . '/', $_SERVER['REQUEST_URI'] ) )
  {
   die("Error!");
  }
  </code></pre>
  
  <p>but the problem is that when i access it via AJAX call, it act like i've accessed it directly...</p>
  
  <p>please help :)</p>