Answer the question
In order to leave comments, you need to log in
Can't change the time zone in one of the .php pages?
Good afternoon! The problem is the following, I do not understand how to change the time zone on the page with notifications.
Now I will give an example with a chat, where the time zone works adequately + 4 hours. where is the $date variable, the string is called time in the database
<?php
ULogin(1);
date_default_timezone_set('Europe/Samara');
$date = date("Y-m-d G:i:s");
if ($_POST['enter'] and $_POST['text']) {
$_POST['text'] = FormChars($_POST['text']);
mysqli_query($CONNECT, "INSERT INTO `chat` VALUES ('', '$_POST[text]', '$_SESSION[USER_LOGIN]', '$date')");
exit(header('location: /chat'));
}
Head('Чат');
?>
<?php
date_default_timezone_set('Europe/Samara');
$date = date("Y-m-d G:i:s");
include_once 'setting.php';
session_start();
function SendNotice($p1, $p2) {
global $CONNECT;
$Row = mysqli_fetch_assoc(mysqli_query($CONNECT, "SELECT `id` FROM `users` WHERE `login` = '$p1'"));
if (!$Row['id']) echo 'Error';
mysqli_query($CONNECT, "INSERT INTO `notice` VALUES ('', '$Row[id]', 0, '$date', '$p2')");
}
if (!$Module or $Module == 'notice') {
$Param1 = "SELECT `id`, `status`, `date`, `text` FROM `notice` WHERE `uid` = $_SESSION[USER_ID] ORDER BY `id` DESC LIMIT 0, 5";
$Param2 = "SELECT `id`, `status`, `date`, `text` FROM `notice` WHERE `uid` = $_SESSION[USER_ID] ORDER BY `id` DESC LIMIT START, 5";
$Param3 = "SELECT COUNT(`id`) FROM `notice`";
$Param4 = "/notice/?page=";
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question