Protecting a php when page loaded with jQuery's .load fuction
<p>My index page (index.php?profile=profilename_here) loads content into a div using jQuery's <code>load()</code> function in the normal fashion and all is working fine.</p>

<pre><code>$().ready(function() {
    $('#details').load('pages/sidebar/details.php?profile=&lt;?PHP echo $profile;?&gt;').fadeIn(2000);
});
</code></pre>

<p>then in my pages/sidebar/details.php I have mysql queries.</p>

<pre><code>$result = mysql_query("SELECT * FROM public_profile WHERE username='$profile'") or die(mysql_error());  
</code></pre>

<p>All the php stuff is secure and I am sanitising all varibales as I should be.... but if someone was to go to 'pages/sidebar/details.php?profile=' and change the profile name they will be bringing up other peoples details.</p>

<p>Is it possible to check if the page was loaded by <code>.load()</code> and if not, to stop the page from loading or scripts from executing?</p>
