0

I was told that encryption is the best way to send vars. So i've found a piece of code but i wont work

$salt = 'test';
function simple_encrypt($text){ // line 9
    return trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $salt, $text, MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))));
} // line 11

function simple_decrypt($text){
    return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $salt, base64_decode($text), MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND)));
}

the error is:

Fatal error: Cannot redeclare simple_encrypt() (previously declared in /home/baspeters/domains/bas-peters.nl/public_html/Forum2/inc/settings.php:9) in /home/baspeters/domains/bas-peters.nl/public_html/Forum2/inc/settings.php on line 11 
2
  • 2
    You're probably including or requiring the file more than once. Commented Oct 31, 2013 at 21:29
  • no i've only included it in the top of the index.php <?php ini_set('display_errors', 1); error_reporting(~0); ob_start(); include("inc/config.php"); include("inc/dateTimeToNL.func.php"); include("inc/settings.php"); include("content/check.php"); include("content/adminFunctions.php"); ?> it's the settings.php Commented Oct 31, 2013 at 21:35

1 Answer 1

1

You have the simple_encrypt function declared twice. Make sure you're not including a file that also has simple_encrypt defined in it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.