Treehouse: Grow your CSS skills. Land your dream job.

how to redirect if one is logged in or not

  • # April 27, 2013 at 1:34 am

    i am making a website, but i am confused about how to redirect to dashboard if he or she is logged in or if not not then redirect them to login page,please help.

    for eg- if one goes to , then he can access his dashboard but if he’s not logged in then he is redirected to login page.

    # April 27, 2013 at 11:04 am

    @coolinfoforme If you’re using PHP, then use the following function: It will allow you to redirect the browser to a different site. For example, `header(‘Location:‘);` will redirect the browser to the dashboard site. In essence, you should check if the user is logged in using the session global variable (or `$_SESSION`) and if he/she is, redirect to the dashboard using the above function. Else, you would redirect the user to the login page using the same `header()` function.

    # April 27, 2013 at 11:05 am

    @coolinfoforme Also, how does this pertain to CSS?

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.