note 53977 deleted from function.get-current-user by danbrown

From: Date: Sat, 19 Jul 2008 23:58:04 +0000
Subject: note 53977 deleted from function.get-current-user by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-141813@lists.php.net to get a copy of this message
Note Submitter: SiliconExpress at Techie dot com ---- The 'constant' __FILE__ works easier ... Example : echo __FILE__; Returns - '/home/username/public_html/filename.php' This works INSIDE includes!!! It saved me a bunch of problems.. If I want to make sure somebody does not load a file directly this is supposed be be an include this is the code I use... Hope it helps you as much as it does me! :) //If user tries to load page directly the redirect to the home page if ($_SERVER['SCRIPT_FILENAME'] == __FILE__) { header("HTTP/1.1 301 Moved Permanently"); header("Location: /"); echo "DO NOT TRY TO ACCESS THIS FILE DIRECTLY\r\n"; exit;}

« previous php.notes (#141813) next »