$v) { $$k = $v; } $start = strtotime($start); $end = strtotime($end); header("Content-Type: text/Calendar"); header("Content-Disposition: inline; filename=event.ics"); echo "BEGIN:VCALENDAR\n"; echo "VERSION:2.0\n"; echo "METHOD:PUBLISH\n"; // required by Outlook echo "BEGIN:VEVENT\n"; echo "UID:".date('Ymd').'T'.date('His')."-".rand()."-northwestern.edu\n"; // required by Outlook echo "DTSTAMP:".date('Ymd').'T'.date('His')."\n"; // required by Outlook if ( ($start == $end) && (count("T", $start) == 1) ): // all day event echo "DTSTART;VALUE=DATE:".date('Ymd', $start)."\n"; echo "DTEND;VALUE=DATE:".date('Ymd', $start + (24*60*60))."\n"; else: echo "DTSTART:".date('Ymd', $start).'T'.date('His', $start)."\n"; echo "DTEND:".date('Ymd', $end).'T'.date('His', $end)."\n"; endif; echo "SUMMARY:{$title}\n"; echo "LOCATION:{$location}\n"; echo "DESCRIPTION:{$desc}\n"; echo "END:VEVENT\n"; echo "END:VCALENDAR\n"; echo "ORGANIZER:{$group}\n"; // required to save event since Outlook 2007 ?>