Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jan 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to change time

    Can somebody tell me how to add one hour to this Gmt time
    I live i Oslo an get wrong time - one hour less.
    Please help
    My code :
    <?php
    extract($HTTP_GET_VARS);
    extract($HTTP_POST_VARS);
    header("Expires: ".gmdate("D, d M Y H:i:s", time() + 3600)." GMT");
    header("Cache-Control: no-cache, must-revalidate");
    header("Pragma: no-cache");
    ?>
    <?php

    /* Modified for Flashkit by swissLyons: http://www.flashbuilder.ch based on

    the http://www.peopleforfun.com version */
    /* Original script by Nicola Delbono <key5@key5.com> */
    ?>

    <?php
    $nickname = str_replace ("\n"," ", $nickname);
    $nickname = str_replace ("<", " ", $nickname);
    $nickname = str_replace (">", " ", $nickname);
    $nickname = stripslashes ($nickname);
    $p=gmdate("d M H:i");

    ?>

    &output=
    <?php
    $chat_file = "shout.txt";
    $chat_lenght = 360;
    $max_single_msg_lenght = 100000;
    $max_file_size = $chat_lenght * $max_single_msg_lenght;
    $file_size= filesize($chat_file);
    if ($file_size > $max_file_size) {
    $lines = file($chat_file);
    $a = count($lines);
    $u = $a - $chat_lenght;
    for($i = $a; $i >= $u ;$i--){
    $msg_old = $lines[$i] . $msg_old;
    }
    $deleted = unlink($chat_file);
    $fp = fopen($chat_file, "a+");
    $fw = fwrite($fp, $msg_old);
    fclose($fp);
    }
    $msg = str_replace ("\n"," ", $message);
    $msg = stripslashes ($msg);
    if ($msg != ""){
    $fp = fopen($chat_file, "a+");
    $fw = fwrite($fp, "<b>$nickname$p)<br></b>$msg\n");
    fclose($fp);}
    $lines = file($chat_file);
    $a = count($lines);
    $u = $a - $chat_lenght;
    for($i = $a; $i >= $u ;$i--){
    echo $lines[$i];
    }

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,266
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Put this at the top of the script

    PHP Code:
    putenv("TZ=Europe/Oslo"); 

  • #3
    New to the CF scene
    Join Date
    Jan 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thank but it did not work

    Thank yoy
    I put the code at the top, but I still have one hour early

  • #4
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,266
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Ahh, just noticed why. Change

    $p=gmdate("d M H:i");

    to

    $p=date("d M H:i");

    That should also fix it

  • #5
    New to the CF scene
    Join Date
    Jan 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Change of time

    Hello Nightfire

    Thank you !!!
    The problem is solved


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •