JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
clean up my urls
[wfpl.git] / http.php
index b82e3d1..51eb4d3 100644 (file)
--- a/http.php
+++ b/http.php
@@ -83,6 +83,9 @@ function redirect($url, $status = '302 Moved Temporarily', $message = '') {
        }
                        
        if(function_exists('session_save_messages')) {
+               if(function_exists('atexit_now')) {
+                       atexit_now();
+               }
                session_save_messages();
        }
 
@@ -92,4 +95,11 @@ function redirect($url, $status = '302 Moved Temporarily', $message = '') {
        exit();
 }
 
+# output http headers to allow caching of this page forever
+function http_cache_forever($cache_control = 'public') {
+       header('Last-Modified: '.gmdate('D, d M Y H:i:s', 5025) . ' GMT'); # long time ago
+       header("Cache-Control: $cache_control");
+       header('Expires: ' . gmdate('D, d M Y H:i:s',time()+31536000) . ' GMT'); # rfc 2616 says not to go more than a year in the future
+}
+
 ?>