I have seen this question posted before, but I can't seem to find a good solution for my particular problem.
I am using Moodle 2.0. Moodle is installed in the root /public_html/ directory. In root install directory, I have a custom directory called "mysystem". The "mysystem" directory holds a custom system that is used for online training.
Everything works, meaning I can access everything in "mysystem" and it displays correctly. Though, what I need to do is edit the custom system (in the "mysystem" directory) to check if the user is logged into moodle and if not, redirect the user to the moodle login page.
This process is easy enough, but I cannot access anything contained in the moodle $_SESSION variable. I have called session_start() at the top of my script, but the $_SESSION variable is still empty even when a moodle user is logged in.
In several forum posts, I have read that "when trying to access moodle session data from outside of moodle, the easiest thing to do is include the moodle config.php into your script", yet this solution is not working. when including the moodle config I get a blank screen (some un-recognized error). Another solution I came across was to "convert" my custom system into a moodle plugin, but my custom system will have nothing to do with moodle...it just needs to check if a user is logged into moodle.
I hope this makes sense. Does anybody have any suggestions?
Thanks for the help!