title: How to secure admin folder php
body: <p>I am looking to find a way I can secure admin area, especially the folder itself from outside access (These include folders with images and css). I have read a lot of suggestions but they all feel rather a compromise or work around than a bullet proof method or I am not understanding which is best for security and hidden from outside world, I want to be the only one that knows about it or access it. Hoping someone can shed some light what they would use, when they want the area completely hidden from outside world, whilst still accessible to you.</p>
  
  <p>Some of the methods I have come across involve:</p>
  
  <ol>
  <li>Moving folder outside of root</li>
  <li>Using Htaccess Deny all. (also means I can't login unless I apply a static IP address which I do not have)</li>
  <li>Another way I thought of could be to use session variable to store admin, recognize and grant access based on session ID. (This does mean all other css files and image folders are viewable).</li>
  <li>Adding an index page in the folder which I see alot of sites do. </li>
  </ol>
  
  <p>I currently have my login script to redirect me to my admin area, so is there anyway for the whole folder to recognize it's me and grant access and serve files on if a logged in admin php file is requesting it?, if not to decline access including images and css etc?</p>
  
  <p>Can't figure out how best to protect this area? Is using session a secure way of identifying an admin?</p>