Customizing SMF > SMF Coding Discussion
[WIP/BETA] EU cookie law
Arantor:
Odd, I couldn't get either to remove the PHPSESSID when I tried it ages ago.
nend:
You know they are always changing how things work in PHP, I have version 5.3.6.
In any matter the functions are not recursive meaning they will only remove one cookie per call. So we must make it recursive to remove all the cookies. What do you think about headers_list function to do this?
Arantor:
*shrug* Whatever works, I guess.
nend:
Here this one should be recursive. Tested and works on my machine, hopefully works on more.
--- Code: ---<?php
ob_start('callback');
session_start();
$_SESSION['test'] = '123';
setcookie('test', '123', time()+3600);
echo '123';
ob_end_flush();
function callback($buffer) {
if (function_exists('header_remove')) {
foreach(headers_list() as $header) {if(strstr($header, 'Set-Cookie:')) {header_remove('Set-Cookie');}}
} else {
foreach(headers_list() as $header) {if(strstr($header, 'Set-Cookie:')) {header('Set-Cookie:');}}
}
return $buffer;
}
?>
--- End code ---
emanuele:
That's cool! :D
Anyway edits are necessary anyway because SMF (and most likely mods) assumes that session data are present in several places and so unless we want to live with an error log full of errors we need to check where the session is checked without taking care of assessing if present or not...I'm wondering if all these errors should be considered bugs...
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version