PHPGeek80 Posted February 23, 2007 Share Posted February 23, 2007 Hi, I have one index.php file that adds and gets data from a mysql database. Within this file i have an include statement: include("include/mcrypt-functions.php"); where "mcrypt-functions.php" is the following: <?php function funct_encrypt($data) { $key = "fuvBUcutvIVbiuvuv"; $iv_size = mcrypt_get_iv_size(MCRYPT_XTEA, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $enc = mcrypt_encrypt(MCRYPT_XTEA, $key, $data, MCRYPT_MODE_ECB, $iv); return $encrypted; } function funct_decrypt($data) { $key = "fuvBUcutvIVbiuvuv"; $iv_size = mcrypt_get_iv_size(MCRYPT_XTEA, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $dec = mcrypt_decrypt(MCRYPT_XTEA, $key, $data, MCRYPT_MODE_ECB, $iv); return $decrypted; } ?> after i add or get data from the database i redirect back to the main page using: header('Location: index.php?p=viewall'); but when i do this i get a message like this: Warning: Cannot modify header information - headers already sent by (output started at /home/*****/public_html/links/include/mcrypt-functions.php:24) in /home/*****/public_html/links/index.php on line 168 This message stops the page drom redirecting successfully and i get a blank page with the warning. How can i stop this error? Thanks. Link to comment https://forums.phpfreaks.com/topic/39748-how-can-i-stop-mcrypt-modifying-headers/ Share on other sites More sharing options...
beaux1 Posted February 23, 2007 Share Posted February 23, 2007 http://www.phpfreaks.com/forums/index.php/topic,37442.0.html Link to comment https://forums.phpfreaks.com/topic/39748-how-can-i-stop-mcrypt-modifying-headers/#findComment-191929 Share on other sites More sharing options...
PHPGeek80 Posted February 23, 2007 Author Share Posted February 23, 2007 Thanks beaux1. Added the output buffering to the start and end of the file ehich now works a treat. Is it best to add buffering to every php file? Link to comment https://forums.phpfreaks.com/topic/39748-how-can-i-stop-mcrypt-modifying-headers/#findComment-191937 Share on other sites More sharing options...
artacus Posted February 23, 2007 Share Posted February 23, 2007 You shouldn't need ob for this. Make sure there are absolutely no characters before your opening <?php tag and none after your closing ?> tag. Link to comment https://forums.phpfreaks.com/topic/39748-how-can-i-stop-mcrypt-modifying-headers/#findComment-191947 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.