I just got a JavaScript timeout script working for a control panel but knowing JavaScript can be turned off I figured writing a cookie with JavaScript while logging in and checking to make sure the cookie is there (re-direct them back to the login screen with a warning) would pretty much ensure that JavaScript was running. While that is one way of going about it brought on another brain buster that I can’t figure out because if I try to write the JavaScript cookie and use a location re-direct I get the following error:
Warning: Cannot modify header information - headers already sent by (output started at /blah/blah/blah/blah/not_the_actual_name.php:61) in /blah/blah/blah/blah/not_the_actual_name.php:on line 62
I’ve tried all the following and still get the error:
echo” <script>
document.cookie = ‘foo=’+’bar’;
</script>”;
I’ve switched the single quotes for double and double for singles.
I tried closing out php, ?> and writing the cookie info and returning to php, <?php
When I used to include instead of using the re-direct the script info for writing the cookie appeared on the destination page. I tried using an intermediate page for writing the cookie ( a 2nd redirect). The only thing that has worked is, I redirected to an intermediate page, put the cookie headers in the <head> section of the html followed with a meta-direct but if the page hangs up there for whatever reason all the cookie info is on the page source. I’ve done lots of searching on this one and haven’t found anything quite the same. If any info is needed I would be glad to offer. Thanx