diff options
author | Chad Little <clittle@users.sourceforge.net> | 2002-11-17 02:32:10 +0000 |
---|---|---|
committer | Chad Little <clittle@users.sourceforge.net> | 2002-11-17 02:32:10 +0000 |
commit | a497e2c7646bd65201184a61a8eab40789c328e8 (patch) | |
tree | 076f5b4bd2c126767965116535d05d194c5fdc9e | |
parent | 634f3af22feb3be1d325d9f44d83ae9289b0b668 (diff) | |
download | phpicalendar-a497e2c7646bd65201184a61a8eab40789c328e8.tar.gz phpicalendar-a497e2c7646bd65201184a61a8eab40789c328e8.tar.bz2 phpicalendar-a497e2c7646bd65201184a61a8eab40789c328e8.zip |
4 of 5 cookies seem to work on my machine.
-rw-r--r-- | functions/init.inc.php | 10 | ||||
-rw-r--r-- | index.php | 4 | ||||
-rw-r--r-- | preferences.php | 17 |
3 files changed, 22 insertions, 9 deletions
diff --git a/functions/init.inc.php b/functions/init.inc.php index 4e19477..5f2c0a8 100644 --- a/functions/init.inc.php +++ b/functions/init.inc.php @@ -11,6 +11,16 @@ if (!defined('BASE')) define('BASE', './'); include(BASE.'config.inc.php'); include(BASE.'functions/error.php'); +if ($HTTP_COOKIE_VARS['phpicalendar']) { + $phpicalendar = unserialize(stripslashes($HTTP_COOKIE_VARS['phpicalendar'])); + $language = $phpicalendar['cookie_language']; + $default_cal = $phpicalendar['cookie_calendar']; + $default_view = $phpicalendar['cookie_view']; + $style_sheet = $phpicalendar['cookie_style']; + // Need to fix this below + #$week_start_day = $phpicalendar['cookie_startday']; +} + // language support $language = strtolower($language); @@ -1,6 +1,10 @@ <?php include "./config.inc.php"; +if ($HTTP_COOKIE_VARS['phpicalendar']) { + $phpicalendar = unserialize(stripslashes($HTTP_COOKIE_VARS['phpicalendar'])); + $default_view = $phpicalendar['cookie_view']; +} if ($printview_default == 'yes') { $default_view = "print.php?printview=$default_view"; } else { diff --git a/preferences.php b/preferences.php index acbe57a..f2bccc4 100644 --- a/preferences.php +++ b/preferences.php @@ -1,5 +1,5 @@ <?php -$cookie_uri = 'http://'.$HTTP_SERVER_VARS['SERVER_NAME'].substr($HTTP_SERVER_VARS['PHP_SELF'],0,strpos($HTTP_SERVER_VARS['PHP_SELF'], '/')); +$cookie_uri = $HTTP_SERVER_VARS['SERVER_NAME'].substr($HTTP_SERVER_VARS['PHP_SELF'],0,strpos($HTTP_SERVER_VARS['PHP_SELF'], '/')); define('BASE','./'); $current_view = "preferences"; $default_view = "$default_view" . ".php"; @@ -13,22 +13,21 @@ if ($action == 'setcookie') { $cookie_startday = $HTTP_POST_VARS['cookie_startday']; $the_cookie = array ("cookie_language" => "$cookie_language", "cookie_calendar" => "$cookie_calendar", "cookie_view" => "$cookie_view", "cookie_startday" => "$cookie_startday", "cookie_style" => "$cookie_style"); $the_cookie = serialize($the_cookie); - setcookie("phpicalendar","$the_cookie",0,"/","$cookie_uri",0); + setcookie("phpicalendar","$the_cookie",time()+(60*60*24*7*12*10) ,"/","$cookie_uri",0); unset ($cookie_language, $cookie_calendar, $cookie_view, $cookie_style,$cookie_startday); } -if ($phpicalendar) { - #$phpicalendar = $_COOKIE['phpicalendar']; - $phpicalendar = unserialize($phpicalendar); +if ($HTTP_COOKIE_VARS['phpicalendar']) { + $phpicalendar = unserialize(stripslashes($HTTP_COOKIE_VARS['phpicalendar'])); $cookie_language = $phpicalendar['cookie_language']; $cookie_calendar = $phpicalendar['cookie_calendar']; $cookie_view = $phpicalendar['cookie_view']; $cookie_style = $phpicalendar['cookie_style']; $cookie_startday = $phpicalendar['cookie_startday']; - echo "Cookie read"; } -echo "$cookie_uri"; -print_r($HTTP_COOKIE_VARS); +#echo "$cookie_uri"; +#print_r(unserialize($HTTP_COOKIE_VARS['phpicalendar'])); +#print_r($phpicalendar); include(BASE.'functions/ical_parser.php'); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" @@ -79,7 +78,7 @@ include(BASE.'functions/ical_parser.php'); <table width="100%" border="0" cellspacing="0" cellpadding="0" class="G10B"> <?php - if ($phpicalendar) { ?> + if ($action == 'setcookie') { ?> <tr> <td colspan="2" align="center"><font class="G10BOLD">Your preferences have been set.</font></td> </tr> |