Use the code below to check if a user is logged in. This is useful if you want to only show certain parts of your component to registered users and not non-registred users. Have fun.
This is a short tutorial on how to create a simple(with simplicity comes a lot of security issues) Login system using php sessions and ajax. Note: I do not address any security issues in this tutorial. This system of doing this is in no way full proof when it comes to being secure. But it should get you to a good start. PHP freaks has awesome article on php security. So go ahead and read on.
So you wanna redirect your page huh?