Skip to content

Instantly share code, notes, and snippets.

@DavidMellul
Created March 1, 2018 23:04
Show Gist options
  • Save DavidMellul/6ea837b0938819fa6147c163e3b808fa to your computer and use it in GitHub Desktop.
Save DavidMellul/6ea837b0938819fa6147c163e3b808fa to your computer and use it in GitHub Desktop.
<?php
function nice_include($file) {
if (file_exists('/home/wwwrun/'.$file.'.php')) { // Taken from PHP docs
include '/home/wwwrun/'.$file.'.php';
}
}
nice_include("../private_admin_data.txt\0");
# => file_exists will return true since home/private_admin_data.txt exists
# => The '.php' extension will be skipped because of the \0 null-termination character.
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment