From 3d74a314dd1ad90a65b1d50f4213d50e26f39930 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Fri, 15 Nov 2002 06:26:43 +0000 Subject: Initlal cookie code, kinda broke. --- preferences.php | 46 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 10 deletions(-) (limited to 'preferences.php') diff --git a/preferences.php b/preferences.php index 78c1060..86888cc 100644 --- a/preferences.php +++ b/preferences.php @@ -3,7 +3,7 @@ define('BASE','./'); $current_view = "preferences"; include(BASE.'functions/ical_parser.php'); -$default_path = 'http://'.$HTTP_SERVER_VARS['SERVER_NAME'].substr($HTTP_SERVER_VARS['PHP_SELF'],0,strpos($HTTP_SERVER_VARS['PHP_SELF'], '/rss/')); +$cookie_uri = 'http://'.$HTTP_SERVER_VARS['SERVER_NAME'].substr($HTTP_SERVER_VARS['PHP_SELF'],0,strpos($HTTP_SERVER_VARS['PHP_SELF'], '/')); $default_view = "$default_view" . ".php"; if ($allow_preferences == 'no') header("Location: $default_view"); $action = $HTTP_GET_VARS['action']; @@ -11,12 +11,22 @@ if ($action == 'setcookie') { $cookie_language = $HTTP_POST_VARS['cookie_language']; $cookie_calendar = $HTTP_POST_VARS['cookie_calendar']; $cookie_view = $HTTP_POST_VARS['cookie_view']; - $the_cookie = array ("cookie_language" => "$cookie_language", "cookie_calendar" => "$cookie_calendar", "cookie_view" => "$cookie_view"); - echo '
'; print_r($the_cookie); echo '
'; - serialize($the_cookie); - #setcookie("the_cookie","$the_cookie",time()+6604800,"/","localhost",0); + $cookie_style = $HTTP_POST_VARS['cookie_style']; + $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"); + //echo '
'; print_r($the_cookie); echo '
'; + $the_cookie = serialize($the_cookie); + setcookie("phpicalendar","$the_cookie",time()+6604800,"/","$cookie_uri",0); +} else { + $phpicalendar = $HTTP_COOKIE_VARS['phpicalendar']; + $phpicalendar = explode($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_uri"; ?> @@ -64,6 +74,14 @@ if ($action == 'setcookie') { + + + + + + -- cgit v1.2.3
Your preferences have been set.
@@ -143,10 +161,14 @@ if ($action == 'setcookie') { // Begin Day Start Selection // echo 'Select your start day of week:

'; - print "\n"; $i=1; foreach ($daysofweek_lang as $daysofweek) { - print "\n"; + if ($i == "$cookie_startday") { + print "\n"; + } else { + print "\n"; + } $i++; } print "\n"; @@ -161,7 +183,11 @@ if ($action == 'setcookie') { if (($file != ".") && ($file != "..") && ($file != "CVS")) { if (!is_file($file)) { $file = ucfirst($file); - print "\n"; + if ($file == "$cookie_style") { + print "\n"; + } else { + print "\n"; + } } } } @@ -169,7 +195,7 @@ if ($action == 'setcookie') { print "\n"; echo '

'; - echo ''; + echo ''; echo '
'; ?>