In my website idea I have got a number of pages that should be accessible by the admin only.
Is this a good practice? (amateur alert)
Also how do I protect these pages? I know about
if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) || ($_SERVER['PHP_AUTH_USER']!='admin') || ($_SERVER['PHP_AUTH_PW']!='password'))
{// The username/password weren't entered so send the authentication headers
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Basic realm="Admin"');
Is this all I can do?
Also how do I make sure that my website is secure? That is, since I am an amateur, I have this book on PHP and all I have in my PHP script are a few if-else statements and accordingly SQL queries?
Is this how the php script would usually be like or have I just learnt the most basic thing and I'm making use of it more than I should?