communication
 databases
 directories
 file handling
 html and code
 image editing
 image listing
 sessions and co
 string handling
 information
 forms
 apple stuff
 image handling
 array handling
 lixlpixel
php - snippets
google search terms detected and highlighted.
remove highlighting | keep highlighting
make snippet in "file handling" - download "include secure" - open demo of "include secure"
 search
php - snippets

Valid CSS!

php webring logo
prev next
random list
join the Ring!

file handling - include secure was created/last modified on Sun 18 Apr 2004 8:55 PM

This checks the name of the PHP file currently executing.
If it is crackme.php , then the program dies before it gets to important code, because you didn't intend for anyone to execute this file on its own.
If it is included in some other PHP file, then the $PHP_SELF variable will be something other than crackme.php , and the program will continue to execute.

<?php
    
      
if (eregi("crackme.php", $PHP_SELF)) exit;
   
   
// this is for demonstration only
      
if (eregi("include_secure", $PHP_SELF)) echo "this file shouldn't be called like this";
   
?>

learn more about some of the PHP functions used in this snippet: continue, current, die, echo, end, ereg, eregi, exec, exit, file, for, include, tan, var

view the GNU general license - view the GNU library license - search on PHPsnippets - see your code like this

 a lixlpixel.com site

PHParadise.com - PHP-classes.org - your site on safari