Does anyone know a PHP RegEx to allow only relative paths, not absolute?
For example, I have an AJAX function that submits this value to my PHP script "some-directory/another-directory/some-file.php".
My PHP script then includes that file.... include($some-php-document);
I don't want a hacker to be able to use my AJAX function to submit something like: "http://www.malicious-website.com/malicious-script.php"
In my PHP Document I would like to do something like:
<php>
$some-php-document = $_POST["some_value_submitted_via_ajax"];
//if $some-php-document is a URL (not a relative path to a file),
//then $some_php_document = null
//how can I use a php regex to accomplish the above?
</php>
How can I do this?
Or, let me know if there are more secure solutions.