function formcraft_basic_new_view($form_id)
{
    global $fcb_meta, $forms_table, $submissions_table, $views_table, $wpdb;
    if (!strpos($_SERVER["REQUEST_URI"], '?preview=true') && ctype_digit($form_id)) {
        if (!isset($_COOKIE["fcb_" . $form_id])) {
            /* 30 min window for counting another view by same user */
            setcookie("fcb_" . $form_id, true, time() + 1800, '/');
            $time = date('Y-m-d 00:00:00', time() + fcb_offset());
            if ($wpdb->get_var("SELECT COUNT(*) FROM {$views_table} WHERE views_date = '{$time}' AND form = {$form_id}")) {
                $existing = $wpdb->get_var("SELECT views FROM {$views_table} WHERE views_date = '{$time}' AND form = {$form_id}");
                $wpdb->update($views_table, array('views' => $existing + 1), array('form' => $form_id, 'views_date' => $time));
            } else {
                $rows_affected = $wpdb->insert($views_table, array('form' => $form_id, 'views' => 1, 'views_date' => $time));
            }
        }
    }
}
<?php

defined('ABSPATH') or die('Cheating, huh?');
global $fcb_version, $forms_table, $submissions_table, $views_table, $wpdb;
$forms = $wpdb->get_results("SELECT id,name,modified FROM {$forms_table}");
$time = date('Y-m-d 00:00:00', time() + fcb_offset());
$total_subs = $wpdb->get_var("SELECT COUNT(*) FROM {$submissions_table}");
$today_subs = $wpdb->get_var("SELECT COUNT(*) FROM {$submissions_table} WHERE created > '{$time}'");
$today_views = $wpdb->get_var("SELECT SUM(views) FROM {$views_table} WHERE views_date = '{$time}'");
$today_views = $today_views == null ? 0 : $today_views;
$today_subs = $today_subs == null ? 0 : $today_subs;
$total_subs = $total_subs == null ? 0 : $total_subs;
$total_forms = count($forms) == 0 ? '0' : count($forms);
?>
<style>
	#toast-container
	{
		top: 10px;
	}
</style>
<div class='formcraft-css'>
	<div class='row'>
		<div class='large-12 column fcb-brand-header'>
			<h1>FormCraft <span>Basic</span></h1>
			<p class='sub-header'> designed by <a target='_blank' href='http://ncrafts.net?ref=formcraft_basic'>nCrafts</a></p>
		</div>
	</div>
	<div class='row' style='position: relative; z-index: 101'>
		<div class='large-12 column'>
			<div id='form_options' class='block'>
				<div class='row fcb-header'>