King King - 2 months ago 10
PHP Question

how to hide pages from unregistered users

I want to hide certain pages on my navigation bar for users that are not registered, not to see those certain pages. How can I accomplish this?

If a user is not registered, no access will be given to him or her on some pages on the website. I'm using PHP.

Meaning if you are not a registered member you will be limited on seeing some pages. Otherwise if you a member you have access to all the pages on the site.

Answer

I have accomplish this by adding the following code

if ($userid == "") {
    Header("Location: index.php");
    die();
}

This worked like a charm.

Comments