title: Server access to file with no client access
body: <p>So I'm trying to make my own password protection system for my site for personal use, and I'm wanting to steer clear of SQL.</p>
  
  <p>I'm no master of web languages.</p>
  
  <p>The password of a given page is to be stored in a text file by the same name, but in a different directory.</p>
  
  <p>I've tried coding this thing a few times, and I almost succeeded once. I had it working, then found out that the files were publicly accessible by simply going to the right URL.</p>
  
  <p>I tried CHMODing all the directory and file permissions to owner only, thinking it would restrict the access from the client. No effect.</p>
  
  <p>I used my web host's password protection system to lock the directory containing the password files, but this required the input of the password whenever the script was called.</p>
  
  <p>I tried to prevent access to the files by moving them above the public_html folder, but javascript could not access them as it is client-side.</p>
  
  <p>PHP, I see as the solution to this, but I cannot figure out what it is I need to do exactly. PHP scripts are only run on first access of the page, so the PHP could not be contained on the same page as the original calling javascript (I don't know if it is possible to mix the two in a file anyway). So the PHP would need to be in a separate file, and would somehow need to be called as a function with a return? As I understand it, it would then be as easy as using the "include" function to pass the data to the php file, and then the return to pass to the calling javascript function.</p>
  
  <p>So there is my current train of thought, I guess; how can I call a separate php file to return as though it were a function?</p>
  
  <p>UPDATE FOR ANYONE ELSE WITH THE SAME ISSUE: The "post" method retrieves the return value of a php page in its callback function.</p>