Jump to content

PHP and file encryption/security


diesel225

Recommended Posts

Hi,

 

 

I have 2 php files, #1 with 2 variables, and #2 that reads those var and uses them. The thing that i'm not sure how to tackle is that file #1 has sensitive data and must be as secure as possible (possibly encrypted and only read by the file #2).

Can anyone point me in the right direction of how to encrypt the file #1 and provide the ability for the file #2 to securely read it?

 

Thanks for your help.

Link to comment
https://forums.phpfreaks.com/topic/41891-php-and-file-encryptionsecurity/
Share on other sites

on your index.php file at the top put this:

 


define('SOMETHING_HERE', true);

 

then at the top of every script that you want secure put this:

 


if (!defined('SOMETHING_HERE')) {  // checks to see if SOMETHING_HERE is true or not

   die('Restricted!'); // SOMETHING_HERE was not defined as TRUE

}
else {

// your sensitive data here.


}

 

This works with includes on your index.php Hopefully this is what you were asking for.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.