Check login before someone uses a web form

genesisvh used Ask the Experts™
I have a web form that I only want users that are registered to use. I don't want anyone who is not a user to just put in the url and use the form. Is there a way to put a check login on the html form so that way it checks if the user is logged in and if not that it redirects you to the login page. Thanks
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
When the user logs in create a session variable

$_SESSION['username'] = "there username";

on the pages where they should be logged in check that session at the top of the page.

  header("Location: index.php");

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial