Skip to content

Instantly share code, notes, and snippets.

@Shaked
Created October 15, 2018 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shaked/52521cdf99286f8e2c57a1a6d6dcd5de to your computer and use it in GitHub Desktop.
Save Shaked/52521cdf99286f8e2c57a1a6d6dcd5de to your computer and use it in GitHub Desktop.
PHP Security Question - Is This Secure?
<?php
$userRequest = $_GET['userRequest'] ?? null;
$path = 'file' . $userRequest;
if (file_exists($path)) {
require_once($path);
} else {
echo 'File does not exist';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment