Skip to content

Instantly share code, notes, and snippets.

@slant
Created March 21, 2011 19:08
Show Gist options
  • Select an option

  • Save slant/880003 to your computer and use it in GitHub Desktop.

Select an option

Save slant/880003 to your computer and use it in GitHub Desktop.
An example to demonstrate why you should never store passwords in web-accessible PHP files.
# Located one level below the DocumentRoot
<?php $secure_password = "i_am_so_smrt"; ?>
# Located just inside the DocumentRoot
<p>
Bad idea:
<?php $insecure_password = "steal_my_stuff"; ?>
<?php echo $insecure_password; ?>
</p>
<p>
Good idea:
<?php include '../config.php'; ?>
<?php echo $secure_password; ?>
</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment