htdocs/changetz.php
changeset 44 73f74d395f95
parent 10 a97bd37e43e9
equal deleted inserted replaced
43:ce2e9caf2dfa 44:73f74d395f95
     1 <?php
     1 <?php
     2 require('../timezone.php');
     2 require('../timezone.php');
       
     3 require('../stats-fe.php');
     3 $set_zone = false;
     4 $set_zone = false;
     4 if ( isset($_POST['tz']) )
     5 if ( isset($_POST['tz']) )
     5 {
     6 {
     6   if ( in_array($_POST['tz'], $zones) )
     7   if ( in_array($_POST['tz'], $zones) )
     7   {
     8   {
     9     $tz = $_POST['tz'];
    10     $tz = $_POST['tz'];
    10     date_default_timezone_set($_POST['tz']);
    11     date_default_timezone_set($_POST['tz']);
    11     $set_zone = str_replace('_', ' ', str_replace('/', ': ', $tz));
    12     $set_zone = str_replace('_', ' ', str_replace('/', ': ', $tz));
    12   }
    13   }
    13 }
    14 }
    14 ?><html>
    15 
    15   <head>
    16 $title = "$nick - set time zone";
    16     <title>Change time zone</title>
    17 require("./themes/$webtheme/header.php");
    17     <style type="text/css">
    18 
    18     select, option {
    19 echo '<br />';
    19       background-color: white;
    20 
    20     }
       
    21     option.other {
       
    22       color: black;
       
    23       font-weight: normal;
       
    24     }
       
    25     option.region {
       
    26       color: black;
       
    27       font-weight: bold;
       
    28     }
       
    29     option.area {
       
    30       color: black;
       
    31       font-weight: normal;
       
    32       padding-left: 1em;
       
    33     }
       
    34     option.country {
       
    35       color: black;
       
    36       font-weight: bold;
       
    37       padding-left: 1em;
       
    38     }
       
    39     option.city {
       
    40       color: black;
       
    41       font-weight: normal;
       
    42       padding-left: 2em;
       
    43     }
       
    44     div.success {
       
    45       border: 1px solid #006300;
       
    46       background-color: #d3ffd3;
       
    47       padding: 10px;
       
    48       margin: 10px 0;
       
    49     }
       
    50     </style>
       
    51   </head>
       
    52   <body>
       
    53     <?php
       
    54     if ( $set_zone )
    21     if ( $set_zone )
    55     {
    22     {
    56       $target = rtrim(dirname($_SERVER['REQUEST_URI']), '/') . '/';
    23       $target = rtrim(dirname($_SERVER['REQUEST_URI']), '/') . '/';
    57       echo '<div class="success">' . "Successfully set time zone to <b>{$set_zone}</b>. <a href=\"$target\">Return to the stats page</a>." . '</div>';
    24       echo '<div class="success">' . "Successfully set time zone to <b>{$set_zone}</b>. <a href=\"$target\">Return to the stats page</a>." . '</div>';
    58     }
    25     }
    93       ?>
    60       ?>
    94     </select>
    61     </select>
    95     <input type="submit" value="Save" /><br />
    62     <input type="submit" value="Save" /><br />
    96     <small>Make sure you have cookies enabled.</small>
    63     <small>Make sure you have cookies enabled.</small>
    97     </form>
    64     </form>
    98   </body>
    65   
    99 </html>
    66 <?php
       
    67 require("./themes/$webtheme/footer.php");
       
    68 ?>