function send_file($name)
{
    OB_END_CLEAN();
    $path = $name;
    //"../temp/".$name;
    if (!IS_FILE($path) or CONNECTION_STATUS() != 0) {
        return FALSE;
    }
    HEADER("Cache-Control: no-store, no-cache, must-revalidate");
    HEADER("Cache-Control: post-check=0, pre-check=0", FALSE);
    HEADER("Pragma: no-cache");
    HEADER("Expires: " . GMDATE("D, d M Y H:i:s", MKTIME(DATE("H") + 2, DATE("i"), DATE("s"), DATE("m"), DATE("d"), DATE("Y"))) . " GMT");
    HEADER("Last-Modified: " . GMDATE("D, d M Y H:i:s") . " GMT");
    HEADER("Content-Type: application/octet-stream");
    HEADER("Content-Length: " . (string) FILESIZE($path));
    HEADER("Content-Disposition: inline; filename={$name}");
    HEADER("Content-Transfer-Encoding: binary\n");
    if ($file = FOPEN($path, 'rb')) {
        while (!FEOF($file) and CONNECTION_STATUS() == 0) {
            print FREAD($file, 1024 * 8);
            FLUSH();
        }
        FCLOSE($file);
    }
    return CONNECTION_STATUS() == 0 and !CONNECTION_ABORTED();
}
示例#2
0
 function getTimeDiff($dtime, $atime)
 {
     $dtime = substr($dtime, 0, 5);
     $atime = substr($atime, 0, 5);
     $nextDay = $dtime > $atime ? 1 : 0;
     $dep = EXPLODE(':', $dtime);
     $arr = EXPLODE(':', $atime);
     $diff = ABS(MKTIME($dep[0], $dep[1], 0, DATE('n'), DATE('j'), DATE('y')) - MKTIME($arr[0], $arr[1], 0, DATE('n'), DATE('j') + $nextDay, DATE('y')));
     $hours = FLOOR($diff / (60 * 60));
     $mins = FLOOR(($diff - $hours * 60 * 60) / 60);
     $secs = FLOOR($diff - ($hours * 60 * 60 + $mins * 60));
     if (STRLEN($hours) < 2) {
         $hours = "0" . $hours;
     }
     if (STRLEN($mins) < 2) {
         $mins = "0" . $mins;
     }
     if (STRLEN($secs) < 2) {
         $secs = "0" . $secs;
     }
     return $hours . ':' . $mins . ':' . $secs;
 }
示例#3
0
 function getHourDiff($firstHour, $secondHour)
 {
     $dtime = substr($firstHour, 0, 5);
     $atime = substr($secondHour, 0, 5);
     $nextDay = $dtime > $atime ? 1 : 0;
     $dep = EXPLODE(':', $dtime);
     $arr = EXPLODE(':', $atime);
     $diff = ABS(MKTIME($dep[0], $dep[1], 0, DATE('n'), DATE('j'), DATE('y')) - MKTIME($arr[0], $arr[1], 0, DATE('n'), DATE('j') + $nextDay, DATE('y')));
     $hours = FLOOR($diff / (60 * 60));
     $mins = FLOOR(($diff - $hours * 60 * 60) / 60);
     $secs = FLOOR($diff - ($hours * 60 * 60 + $mins * 60));
     if (STRLEN($hours) < 2) {
         $hours = "0" . $hours;
     }
     if (STRLEN($mins) < 2) {
         $mins = "0" . $mins;
     }
     if (STRLEN($secs) < 2) {
         $secs = "0" . $secs;
     }
     $temp = floatval($mins / 60);
     $temp += $hours;
     return $temp;
 }
示例#4
0
     if ($positiontime >= $glb_time) {
         $dtime = substr($globalwaketime, 0, 5);
         $flagtime = strtotime($theExactTime . " " . $this->config->item('flagtime'));
         if ($flagtime < $glb_time) {
             $this->config->set_item('flagtime', $globalwaketime);
         }
     }
 }
 ///////////////////////////////
 if (isset($dtime)) {
     ///////////////////////////////////////////////////////
     $atime = substr($time->time, 0, 5);
     $nextDay = $dtime > $atime ? 1 : 0;
     $dep = EXPLODE(':', $dtime);
     $arr = EXPLODE(':', $atime);
     $diff = ABS(MKTIME($dep[0], $dep[1], 0, DATE('n'), DATE('j'), DATE('y')) - MKTIME($arr[0], $arr[1], 0, DATE('n'), DATE('j') + $nextDay, DATE('y')));
     $hours = FLOOR($diff / (60 * 60));
     $mins = FLOOR(($diff - $hours * 60 * 60) / 60);
     $secs = FLOOR($diff - ($hours * 60 * 60 + $mins * 60));
     if (STRLEN($hours) < 2) {
         $hours = "0" . $hours;
     }
     if (STRLEN($mins) < 2) {
         $mins = "0" . $mins;
     }
     $hours += $mins / 60;
     ///////////////////////////////////////////
     if ($flagw == 1 && $hours > 3 || $flagw == 0 && $hours >= 0.5) {
         $timedata['currenttime'] = $time->time;
         $timedata['flagw'] = $flagw;
         $timedata['type'] = "Snack";
function DiffBetweenDates( $start, $end )
{
$month 	= date( "m", strtotime( $start ) );
$day 		= date( "d", strtotime( $start ) );
$year 	= date( "Y", strtotime( $start ) );
$month2 	= date( "m", strtotime( $end ) );
$day2 	= date( "d", strtotime( $end ) );
$year2 	= date( "Y", strtotime( $end ) );

$first_date = MKTIME( 12, 0, 0, $month, $day, $year);
$second_date = MKTIME( 12, 0, 0,$month2, $day2, $year2);
 
$offset = $second_date - $first_date;
  
return FLOOR( $offset/60/60/24 );
}