// =============== ЗАПИСЬ СТАТИСТИКИ ОБЪЯВЛЕНИЯ // ------------- Проверка дублирования записи статистики $Etot_Moment = current_time ('mysql'); $args = array( 'post_type' => 'statistika', 'post_status' => 'draft', 'posts_per_page' => 10, 'orderby' => 'date', 'order' => 'DESC', ); $Qery_Stat = new WP_Query( $args ); if ($Qery_Stat -> have_posts()) : while ($Qery_Stat -> have_posts()) : $Qery_Stat -> the_post(); $Eta_Zapis_Statistiki = get_post ('', ARRAY_A ); $Interval = date_diff (date_create($Etot_Moment), date_create($Eta_Zapis_Statistiki ['post_date'])); $Interval_Chas = $Interval -> h; $Interval_Min = $Interval -> i + $Interval_Chas*60 ; $Interval_Sec = $Interval -> s + $Interval_Min * 60; if (($Interval_Sec <= 10) && ($_SERVER['REMOTE_ADDR'] == get_post_meta($post->ID, 'IP_Posetitelja')[0]) ) $Eto_Dubl = true; // ECHO "

Interval_Sec = ", $Interval_Sec; // ECHO "

IP = ", $_SERVER['REMOTE_ADDR']; // ECHO "

IP = ", get_post_meta($post->ID, 'IP_Posetitelja')[0]; endwhile; endif; wp_reset_postdata(); if (! $Eto_Dubl) { $ID_Stat_Post = wp_insert_post ($Zapis_Statistic, true); update_post_meta( $ID_Stat_Post, 'IP_Posetitelja', $_SERVER['REMOTE_ADDR']); update_post_meta( $ID_Stat_Post, 'Is_Mob_Posetitelja', wp_is_mobile()); } ?>
Today's statistics:

Page views: 1667
Visitors: 238


Translate »