I've succesfully implemented this script: http://blueimp.github.com/jQuery-File-Upload/
(it uses jquery file upload )
The problem is that I am using the following PHP login script in conjection with it: http://phpsense.com/2006/php-login-script/
The image upload script calls an php file to delete/upload images via ajax. I want to secure that php file so that only users who are logged in can access it (since my script is used by admins to update the site).
I included this in the php file called
session_start();
//Check whether the session variable SESS_MEMBER_ID is present or not
if(!isset($_SESSION['SESS_MEMBER_ID']) || (trim($_SESSION['SESS_MEMBER_ID']) == '')) {
header("location: access-denied.php");
exit();
}
When I try to access the page through the script it fails saying the session variable was NULL (the user wasn't logged in even though they were).
The really strange thing is its random. If I keep refreshing the page over and over again it eventually succeeds in finding the session variable and loads the images.
The first thing I made sure was that the URL was consistent so I am using the full URL for all my ajax calls so that isn't the issue....