Search code examples
phpdirectoryfopenmcrypt

mcrypt CBC unable to access outside www


From a novice: In currently experimenting with mcrypt CBC.

I have no issues getting recall.mcrypt.php to recall mcrypt.php file inside the same directory but because of best practices and security needs, I'm placing mcrypt.php outside the directory using:

$file = fopen("/opt/lampp/test.mcrypt/mcrypt.php","r");

In doing so I'm getting the following error:

Fatal error: Class 'phpFreaksCrypto' not found in /opt/lampp/htdocs/CCS/mcrypt/recall.mcrypt.php on line 6

mcrypt.php

if (realpath(__FILE__) == realpath($_SERVER['SCRIPT_FILENAME']))
{
// tell people trying to access this file directly goodbye...
exit('This file can not be accessed directly...');
}

class phpFreaksCrypto
{
// content is located here
}

The settings for mcyrpt.php have been set to read. Maybe my confusion lies in fopen even though I thought this command is used for this very purpose or is there a command that better recalls mcyrpt.php in this type of situation.

All insights and suggestions are welcome. Thank you.


Solution

  • Where is mcrypt.php comming from? In order to include a .php file for additional functionality from this file you will have to use the statements include, require etc.

    Is this what you want to do?