SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict pentium10's Avatar
    Join Date
    Apr 2004
    Location
    Transilvania
    Posts
    208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can i get the name of file?

    I introduced at the begining of the included files this:

    PHP Code:
    if (eregi("reg.php"$PHP_SELF)) {
        die (
    "You can't access this file directly...");

    But i must manually change de reg.php value for each file.
    Is there a method/function to read out what is the name of the file?
    Rype :: book, do, charge, collect,
    track time, track expenses and invoice easily on the go.
    Available on Mac, Win, iPhone, WinMobile.
    http://www.rypenow.com

  2. #2
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you could use the __FILE__ constant.
    a better solution woud probably be to put this into your files :
    PHP Code:
    if (!defined('WARD_FROM_DIRECT_REQUEST')) {
        die (
    "You can't access this file directly...");

    and then simply define('WARD_FROM_DIRECT_REQUEST', 1) in the main file(s).

    An even better solution would ofcause be not to put your includefiles in a publicly accessible dir, or just put a .htaccess file in there, witch prevents access.

  3. #3
    SitePoint Addict pentium10's Avatar
    Join Date
    Apr 2004
    Location
    Transilvania
    Posts
    208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how can i make this .htaccesss and what should i write into?
    Rype :: book, do, charge, collect,
    track time, track expenses and invoice easily on the go.
    Available on Mac, Win, iPhone, WinMobile.
    http://www.rypenow.com

  4. #4
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •