Don't understand how to use UI Dialog, ajax & PHP to handle login/out functionality
I need to implement login/out functionality. This is for a single user, so I don't need a database check, I'm just storing the username and password in a separate php file, data.php, that is outside of the public_html folder. The login form is in a jQuery UI-driven dialog, defined in the admin.js file, along with other scripting/ajax calls, etc.
I'm having trouble figuring out the "flow" of the functionality. Basically, what I'm thinking I need to have happen is when index.php loads it checks if the user is logged in, if not, the login dialog needs to display. But how would the functionality of the login dialog work in this process? On the index page, what do I need to check to make sure the user is logged in - something stored in a session variable? If the user isn't logged in (which is determined in PHP), how do I open the login dialog? Do I need to do an ajax call on page load?
I've found plenty of tutorials about creating a login form, but either they include a database check - which I don't need, or they don't address how to use jQuery ajax in the process.
I'm not really looking for actual code examples to show me what I need to do, just maybe some pseudo code that demonstrates the flow of the logic/steps I need to take between the files (index.php, admin.js, admin.php, and data.php) - just to get me started.
Thanks for anyone's help.