preventing direct access to a php page, only access if redirected
<p>I want to make my php page only accessible from another page redirect and prevent my user from accessing it directly. </p>

<p>I mean, let's say I have a page called "main.php" and another php file that I want to prevent direct access to, called "noaccess.php". </p>

<p>I want to make noaccess.php accessible only if I redirect from main.php</p>

<p>Any suggestions?</p>

<p>UPDATE: Session is good idea, but the problem is I have to use JavaScript to redirect the page, so the question is, can I use ajax to set a php session?</p>

<p>UPDATE 2 : OK I found solution, I don't need preventing direct access now, as I can check from mysql whether page needs to be accessible or not.</p>
