//------------------------------------------------------------------------------ // Licensed Materials - Property of IBM // (c) Copyright IBM Corporation 2001,2002 All Rights Reserved. // US Government Users Restricted Rights - Use, duplication or disclosure // restricted by GSA ADP Schedule Contract with IBM Corp. //------------------------------------------------------------------------------ // Set Library Date & Time // // Filename: ml_set_datetime_background_process.htm // // This file process the data received from the Set Date & Time page. // // When a POST is operation result information is retrieved from POST // data and displayed in the Message Box. // // // Input: POST data // url original request page // month the library set month // day the library set day // year the library set year // hour the library set hour // minute the library set minute // second the library set second // timezone the library set timezone // daytime this is AM if the library's set hour is less than 12 or PM if the library's set hour // is equal or grater than 12 // // // Ouput: POST ('form_out') // url original request page // errorCode result of operation // returnMessage text information about the operation results // // // // Change History: // // Date Defect Changed By Description of Change // ---- ------ ---------- --------------------- // 11/10/2005 roomor01 File Created //------------------------------------------------------------------------------ include('user_inc.htm'); class Date{ var $month; var $day; var $year; var $hour; var $minute; var $second; var $timezone; var $ntp; var $ntp_1; var $ntp_2; function Date($year, $month, $day, $hour, $minute, $second, $ampm, $timezone, $ntp, $ntp_1, $ntp_2) { $this->year = $year; $this->month = $month; $this->day = $day; $this->hour = $hour; $this->minute = $minute; $this->second = $second; $this->ampm = $ampm; $this->timezone = $timezone; $this->ntp = $ntp; $this->ntp_1 = $ntp_1; $this->ntp_2 = $ntp_2; } } //Process data for actions if($_SERVER['REQUEST_METHOD']=='POST') { $url = $_REQUEST['url']; $month = $_POST['month']; //error_log("GUI month: ".$month); $day = $_POST['day']; //error_log("GUI day: ".$day); $year = $_POST['year']; //error_log("GUI year: ".$year); $datetext=$day."-".$month."-".$year; //error_log($datetext); $timestamp = strtotime($datetext); //error_log($timestamp); $date = getdate($timestamp); //error_log($date['year']."-".$date['mon']."-".$date['mday']); $hour = intval($_POST['hour']); //error_log("GUI hour: ".$hour); $daytime = $_POST['daytime']; //error_log("GUI daytime: ".$daytime ); if($hour<12 && $daytime=="PM"){ $hour = $hour+12; }else if($hour==12 && $daytime=="AM"){ $hour = 0; } settype($hour, "string"); //error_log("GUI hour 24h: ".$hour." type: ".gettype($hour)); $minute = intval($_POST['minute']); settype($minute, "string"); //error_log("GUI minute: ".$minute); $second = intval($_POST['second']); settype($second, "string"); //error_log("GUI second: ".$second); $timezone = $_POST['timezone']; //error_log("GUI timezone: ".$timezone); $ntp = $_POST['ntp']; if ($ntp == 0) { $ntp = 0; } else { $ntp = 1; } $datetime = new Date($date['year'], $date['mon'], $date['mday'], $hour, $minute, $second, $ampm, $timezone, $ntp, $_POST['ntp_1'], $_POST['ntp_2']); error_log('update_date_and_time('.$user.','.$datetime->year.','.$datetime->month.','.$datetime->day.','.$datetime->hour.','.$datetime->minute.','.$datetime->second.','.$datetime->timezone.','.$datetime->ntp.','.$datetime->ntp_1.','.$datetime->ntp_2); update_date_and_time($user,$datetime); $returnMessage = 'The library date and time settings have been successfully modified.'; } ?>