0

How set direct access to php file I use fancybox to send function "You got new message", and i have newmessage.php on server and i want to hide this newmessage.php when user go to test.com/newmessage.php show messsage no direct access to file ?

If user got new message show newmessage.php function on fancybox ...
I try this but when is open fancybox and i get no direct access to file ...

if(!defined('MyConst')) {
 die('Direct access not permitted');
}
Cœur
  • 37,241
  • 25
  • 195
  • 267
Beytulla OO
  • 39
  • 1
  • 10
  • just put your `newmessage.php` outside the root folder, and no one will access it directly, but you will be able to include it like: `../newmessage.php`. – Salim Ibrohimi Feb 27 '18 at 03:24
  • Possible duplicate of [PHP: Check if a file is loaded directly instead of including?](https://stackoverflow.com/questions/2397004/php-check-if-a-file-is-loaded-directly-instead-of-including) – Seblor Feb 27 '18 at 07:55
  • With "fancybox" I suppose you mean it loads a URL either in an iframe, or fetches the HTML from it and puts it in a popup…? – deceze Feb 27 '18 at 07:58
  • so i do this i moved newmessage.php out of public_html to **etc/my-site/newmessage.php** there my function, now how i can call this function on index.php i try this `define("BASE_URL", "/etc"); define("ROOT_PATH", $_SERVER["DOCUMENT_ROOT"] . "/etc"); echo "test` but i cant get info .... any help ? – Beytulla OO Feb 28 '18 at 05:52

0 Answers0