Jump to content

How to show custom page to non logged-in/registered users


ugintl
 Share

Recommended Posts

I have a website script built with php, html, css and javascript. I want to show custom page to non logged-in/registered users and after they login, they should go to index page or you can say dashboard.

 

Currently a visitor goes directly to index page with login or register options. My website's index.php and template's index.html files are attached.

 

Moreover, I would appreciate if anyone can tell me how can I bootstrap my website (ugintl.move.pk). I guess it is the template which needs to be modified. template folder's snap also attached.

 

Waiting for a helpful reply :Pleased:index.html index.phppost-191842-0-32097900-1448034989_thumb.png

Link to comment
Share on other sites

I guess you should have kept it simple and straight. I found this and it worked.

<?php    // First execute a common code to connect to the database and start the session    require("includes/common.php");        // At the top of the page check to see whether the user is logged in or not    if(empty($_SESSION['user']))    {        // If they are not, redirect them to the login page.        header("Location: login.php");                // Remember that this die statement is absolutely critical.  Without it,        // people can view your members-only content without logging in.        die("Redirecting to login.php");    }
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...