PHP Conference Kansai 2025

Voting

: seven minus two?
(Example: nine)

The Note You're Voting On

fili at fili dot nl
19 years ago
To prevent direct calls to included files i use the following technique.

In the main file create an empty function with a random name. Like so:

<?php
function hjudejdjiwe() { return true; }
?>

Then check for the existence of this function within your include:

<?php
if (!function_exists('hjudejdjiwe')) { die('!'); }
?>

Simple but effective.

<< Back to user notes page

To Top