Вход на сайт
Моя золотая мечта 05.01.2025
1315 просмотров
Перейти к просмотру всей ветки
в ответ uscheswoi_82 05.01.25 01:58
Я автор этой соцсети. Короче я буду непопорядку, и покажу не всё. Это чтобы вот так показывало сколько секунд назад был добавлен пост см.:

Вот код:
wall.js:
const GET_TIMES = 'get_times.php';
function ct(id) // count timer
{
$$.ajax(path + GET_TIMES, 'POST', 'pid=' + id, function(curr_time)
{
if(curr_time != '')
$('time_' + id).text(curr_time);
});
}
get_times.php:
<?php
require_once('./config/config.php');
require_once('./libs/core/mod_core.php');
require_once('./libs/core/mod_database.php');
require_once('./libs/core/mod_post.php');
require_once('./libs/core/mod_date.php');
require_once('./libs/i18n/mod_i18n.php');
session_start();
if(!isset($_SESSION['UserID']))
exit;
if(isset($_POST['pid'])) {
I18n_init();
I18n_lang('./i18n/' . core_get_current_language() . '_post.php', './i18n/en_post.php');
$int_pid = $_POST['pid'];
$arr_result = post_show_post_from_by_postid($int_pid);
if(count($arr_result) <= 0) exit;
$str_now = date("y-m-d H:i:s");
$str_datetime = strtotime($arr_result[0]['date']);
$str_db_dt = date("y-m-d H:i:s", $str_datetime);
$str_result = date_datediff($str_db_dt, $str_now, __('post.date'));
echo $str_result;
}
?>
Если я кому-то отвечаю, это не значит что я ему симпатизирую, каждый остаётся при своём мнении
Моя ФЛ Он и Она
Моя ФЛ Он и Она