note 53977 added to function.get-current-user

From: Date: Mon, 20 Jun 2005 02:34:33 +0000
Subject: note 53977 added to function.get-current-user
Groups: php.notes 
Request: Send a blank email to php-notes+get-90659@lists.php.net to get a copy of this message
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;} ---- Manual Page -- http://www.php.net/manual/en/function.get-current-user.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+53977 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53977&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53977&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53977&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53977&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+53977&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53977&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+53977&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#90659) next »