1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
  $ext = ".svg"; //記得改副檔名
  if(isset($_GET['date']) && isset($_GET['d'])) {
    date_default_timezone_set("Asia/Taipei");
    $startdate = strtotime(date("Y-m-d"));
    $enddate = strtotime($_GET['date']);
    $days = round(($enddate - $startdate) / 3600 / 24);
    if($days >= 0) {
      switch ($_GET['d']) {
        case 1:
          header("Location: ./" . $days % 10 . $ext); exit;
        case 2:
          header("Location: ./" . floor($days % 100 / 10) . $ext); exit;
        case 3:
          header("Location: ./" . floor($days / 100) . $ext); exit;
        default:
          header("Location: ./0" . $ext); exit;
        }
    } else {
      header("Location: ./0" . $ext); exit;
    }
  } else {
    header("Location: ./0" . $ext); exit;
  }
?>