dannyluked Posted March 18, 2009 Share Posted March 18, 2009 Does anyone have an idea how I can made a line of php code to go at the top of a page. I want this so that when the page is viewed it checks if the $username = Admin. If not the guest See's a message, If it is admin other information is shown. Thanks in advance, Link to comment https://forums.phpfreaks.com/topic/150057-password-protect-page/ Share on other sites More sharing options...
trq Posted March 18, 2009 Share Posted March 18, 2009 Have you actually googled for a simple login / auth system? there should be literally thousands of examples on the net already. Link to comment https://forums.phpfreaks.com/topic/150057-password-protect-page/#findComment-788058 Share on other sites More sharing options...
pcw Posted March 18, 2009 Share Posted March 18, 2009 if($_SESSION['username'] == admin) { Print page } else { Guest Page }; Of course you will need to pass the seesion variable from the login page Link to comment https://forums.phpfreaks.com/topic/150057-password-protect-page/#findComment-788059 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.