<?php
ini_set('display_errors','1');
error_reporting (E_ALL);
session_start();
setlocale (LC_ALL, 'de_DE');
setlocale (LC_TIME, 'de_DE');
header('Content-Type: text/html; charset=utf-8');
include('includes/function/database.php');
include('includes/function/helper.php');
include('includes/function/secure.php');


if (is_file('dbopen.php')) {
	include('dbopen.php');
	$conn = database_connect($db);
	if ($conn == NULL) {
		print "Datenbank verbindung nicht m&ouml;glich!!!";
		die();
	}
}

if (!isset($_GET['token']) OR $_GET['token'] != cron_token()) {
	http_response_code(403);
	exit('Access denied');
}

if (is_file('cron/seo.php')){
	file_put_contents('cron/seo_heartbeat.log', time());
	include('cron/seo.php');
}

if (is_file('cron/newsletter.php')){
	file_put_contents('cron/newsletter_heartbeat.log', time());
	include('cron/newsletter.php');
}

if (is_file('cron/encrypt.php')){
	file_put_contents('cron/encrypt_heartbeat.log', time());
	include('cron/encrypt.php');
}