<?php
//ini_set('display_errors', 'On');
//error_reporting(E_ALL | E_STRICT);
require('functions.php');
include("countrydatabase.php");

$config = loadConfig();
unlock_all_files();

$months = array('0','0','0','0','0','0','0','0','0','0','0','0');
$years = array('0','0','0', '0', '0');
$days = array('0','0','0','0','0','0','0','0','0','0','0');
$actions_per_day = array("0","0","0","0","0","0","0","0","0","0");
$lastdays = array(date("d", time()), date("d", time())-1, date("d", time())-2, date("d", time())-3, date("d", time())-4, date("d", time())-5, date("d", time())-6, date("d", time())-7, date("d", time())-8, date("d", time())-9, date("d", time())-10);
$now = date("m.Y", time());

foreach(file('log.txt') AS $durchschnitt) {
$durchschnitt = explode(', ', $durchschnitt);
$date = strtotime(substr($durchschnitt[9], 0, -9));
if(strtotime($lastdays[0].".".$now)==$date) {
$days[0]++;
$actions_per_day[0] = $actions_per_day[0] + $durchschnitt[13];
}
if(strtotime($lastdays[1].".".$now)==$date) {
$days[1]++;
$actions_per_day[1] = $actions_per_day[1] + $durchschnitt[13];
}
if(strtotime($lastdays[2].".".$now)==$date) {
$days[2]++;
$actions_per_day[2] = $actions_per_day[2] + $durchschnitt[13];
}
if(strtotime($lastdays[3].".".$now)==$date) {
$days[3]++;
$actions_per_day[3] = $actions_per_day[3] + $durchschnitt[13];
}
if(strtotime($lastdays[4].".".$now)==$date) {
$days[4]++;
$actions_per_day[4] = $actions_per_day[4] + $durchschnitt[13];
}
if(strtotime($lastdays[5].".".$now)==$date) {
$days[5]++;
$actions_per_day[5] = $actions_per_day[5] + $durchschnitt[13];
}
if(strtotime($lastdays[6].".".$now)==$date) {
$days[6]++;
$actions_per_day[6] = $actions_per_day[6] + $durchschnitt[13];
}
if(strtotime($lastdays[7].".".$now)==$date) {
$days[7]++;
$actions_per_day[7] = $actions_per_day[7] + $durchschnitt[13];
}
if(strtotime($lastdays[8].".".$now)==$date) {
$days[8]++;
$actions_per_day[8] = $actions_per_day[8] + $durchschnitt[13];
}
if(strtotime($lastdays[9].".".$now)==$date) {
$days[9]++;
$actions_per_day[9] = $actions_per_day[9] + $durchschnitt[13];
}
if(strtotime($lastdays[10].".".$now)==$date) {
$days[10]++;
$actions_per_day[10] = $actions_per_day[10] + $durchschnitt[13];
}
}
$hours = visitors_at_hour(date("d.m.Y ", strtotime($_GET['day'])));
if(isset($_GET['day']) AND $_GET['graph']=="map" AND $_GET['id']==$config[19]) {
header("Content-Type: image/png");
$img = imagecreatefrompng("img/world-map.png");
imagestring($img,10,622,126,$continents["Europe"],imagecolorallocate($img,0,0,0));
imagestring($img,10,265,150,$continents["North America"],imagecolorallocate($img,0,0,0));
imagestring($img,10,390,400,$continents["South America"],imagecolorallocate($img,0,0,0));
imagestring($img,10,850,150,$continents["Asia"],imagecolorallocate($img,0,0,0));
imagestring($img,10,1050,420,$continents["Australia and Oceania"],imagecolorallocate($img,0,0,0));
imagestring($img,10,680,300,$continents["Africa"],imagecolorallocate($img,0,0,0));
imagesavealpha($img, true);
imagecolorallocate($img,255,255,255);
imagepng($img);
}
if(isset($_GET['day']) AND $_GET['graph']=="hours" AND $_GET['id']==$config[19]) {
header('Content-Type: image/png');
$img = imagecreate(1300,300);
imagecolorallocate($img,255,255,255);
imagefilledrectangle($img,1300,10,strlen(strval(max($hours))) * 8 + 4,10,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,1300,70,strlen(strval(max($hours) * 0.75)) * 8 + 4,70,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,1300,130,strlen(strval(max($hours) * 0.5)) * 8 + 4,130,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,1300,190,strlen(strval(max($hours) * 0.25)) * 8 + 4,190,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,75,10,75,250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,125,10,125,250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,175,10,175,250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,225,10,225,250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,275,10,275,250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,325,10,325,250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,375,10,375,250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,425,10,425,250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,475,10,475,250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,525,10,525,250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,575,10,575,250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,625,10,625,250,imagecolorallocate($img,190,190,1960));
imagefilledrectangle($img,675,10,675,250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,725,10,725,250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,775,10,775,250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,825,10,825,250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,875,10,875,250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,925,10,925,250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,975,10,975,250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,1025,10,1025,250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,1075,10,1075,250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,1125,10,1125,250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,1175,10,1175,250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,1225,10,1225,250,imagecolorallocate($img,190,190,190));
imagestring($img,4,2,3,strval(max($hours)),imagecolorallocate($img,190,190,190));
imagestring($img,4,2,63,strval(max($hours) * 0.75),imagecolorallocate($img,190,190,190));
imagestring($img,4,2,123,strval(max($hours) * 0.5),imagecolorallocate($img,190,190,190));
imagestring($img,4,2,183,strval(max($hours) * 0.25),imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,60, 250-240/max($hours)*$hours[0], 90, 250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,110, 250-240/max($hours)*$hours[1], 140, 250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,160, 250-240/max($hours)*$hours[2], 190, 250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,210, 250-240/max($hours)*$hours[3], 240, 250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,260, 250-240/max($hours)*$hours[4], 290, 250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,310, 250-240/max($hours)*$hours[5], 310, 250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,360, 250-240/max($hours)*$hours[6], 390, 250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,410, 250-240/max($hours)*$hours[7], 440, 250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,460, 250-240/max($hours)*$hours[8], 490, 250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,510, 250-240/max($hours)*$hours[9], 540, 250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,560, 250-240/max($hours)*$hours[10], 590, 250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,610, 250-240/max($hours)*$hours[11], 640, 250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,660, 250-240/max($hours)*$hours[12], 690, 250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,710, 250-240/max($hours)*$hours[13], 740, 250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,760, 250-240/max($hours)*$hours[14], 790, 250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,810, 250-240/max($hours)*$hours[15], 840, 250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,860, 250-240/max($hours)*$hours[16], 890, 250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,910, 250-240/max($hours)*$hours[17], 940, 250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,960, 250-240/max($hours)*$hours[18], 990, 250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,1010, 250-240/max($hours)*$hours[19], 1040, 250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,1060, 250-240/max($hours)*$hours[20], 1090, 250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,1110, 250-240/max($hours)*$hours[21], 1140, 250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,1160, 250-240/max($hours)*$hours[22], 1190, 250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,1210, 250-240/max($hours)*$hours[23], 1240, 250,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,0,250,1300,300,imagecolorallocate($img,255,255,255));
imagefilledrectangle($img,0,250,1300,250,imagecolorallocate($img,0,0,0));
imagestring($img,10,60,260,'0-1',imagecolorallocate($img,190,190,190));
imagestring($img,10,110,260,'1-2',imagecolorallocate($img,190,190,190));
imagestring($img,10,160,260,'2-3',imagecolorallocate($img,190,190,190));
imagestring($img,10,210,260,'3-4',imagecolorallocate($img,190,190,190));
imagestring($img,10,260,260,'4-5',imagecolorallocate($img,190,190,190));
imagestring($img,10,310,260,'5-6',imagecolorallocate($img,190,190,190));
imagestring($img,10,360,260,'6-7',imagecolorallocate($img,190,190,190));
imagestring($img,10,410,260,'7-8',imagecolorallocate($img,190,190,190));
imagestring($img,10,460,260,'8-9',imagecolorallocate($img,190,190,190));
imagestring($img,10,510,260,'9-10',imagecolorallocate($img,190,190,190));
imagestring($img,10,560,260,'10-11',imagecolorallocate($img,190,190,190));
imagestring($img,10,610,260,'11-12',imagecolorallocate($img,190,190,190));
imagestring($img,10,660,260,'12-13',imagecolorallocate($img,190,190,190));
imagestring($img,10,710,260,'13-14',imagecolorallocate($img,190,190,190));
imagestring($img,10,760,260,'14-15',imagecolorallocate($img,190,190,190));
imagestring($img,10,810,260,'15-16',imagecolorallocate($img,190,190,190));
imagestring($img,10,860,260,'16-17',imagecolorallocate($img,190,190,190));
imagestring($img,10,910,260,'17-18',imagecolorallocate($img,190,190,190));
imagestring($img,10,960,260,'18-19',imagecolorallocate($img,190,190,190));
imagestring($img,10,1010,260,'19-20',imagecolorallocate($img,190,190,190));
imagestring($img,10,1060,260,'20-21',imagecolorallocate($img,190,190,190));
imagestring($img,10,1110,260,'21-22',imagecolorallocate($img,190,190,190));
imagestring($img,10,1160,260,'22-23',imagecolorallocate($img,190,190,190));
imagestring($img,10,1210,260,'23-24',imagecolorallocate($img,190,190,190));
imagestring($img,100,600,280,'Uhrzeit in Stunden',imagecolorallocate($img,0,0,0));
imagesavealpha($img, true);
imagepng($img);
}
if(isset($_GET['day']) AND $_GET['graph']=="10days" AND $_GET['id']==$config[19]) {
header('Content-Type: image/png');
$img = imagecreate(1100,300);
imagecolorallocate($img,255,255,255);
//create array
$users_days = array();
for ($i = 0; $i <= 10; $i++) {
$users_array[] = visitors_per_day(date("d.m.Y",strtotime($_GET['day'])-($i*86400)));
}
for ($i = 1; $i <= 10; $i++) {
imagefilledrectangle($img,$i*100,10,$i*100,250,imagecolorallocate($img,190,190,190));
}
imagefilledrectangle($img,1300,10,strlen(strval(max($users_array))) * 8 + 4,10,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,1300,70,strlen(strval(max($users_array) * 0.75)) * 8 + 4,70,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,1300,130,strlen(strval(max($users_array) * 0.5)) * 8 + 4,130,imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,1300,190,strlen(strval(max($users_array) * 0.25)) * 8 + 4,190,imagecolorallocate($img,190,190,190));
imagestring($img,4,2,3,strval(max($users_array)),imagecolorallocate($img,190,190,190));
imagestring($img,4,2,63,strval(max($users_array) * 0.75),imagecolorallocate($img,190,190,190));
imagestring($img,4,2,123,strval(max($users_array) * 0.5),imagecolorallocate($img,190,190,190));
imagestring($img,4,2,183,strval(max($users_array) * 0.25),imagecolorallocate($img,190,190,190));
$counter = 0;
$users_array = array_reverse($users_array);
foreach($users_array AS $day) {
if($counter!=10) {
imagestring($img,10,1100-($counter*100+145),260,date("d.m.Y",strtotime($_GET['day'])-($counter*86400)),imagecolorallocate($img,190,190,190));
imagefilledrectangle($img,$counter*100-25,250-240/max($users_array)*$day,$counter*100+25,250,imagecolorallocate($img,190,190,190));
}
$counter++;
}
imagefilledrectangle($img,0,250,1300,250,imagecolorallocate($img,0,0,0));
imagestring($img,100,420,280,'Uebersicht ueber letzte 10 Tage',imagecolorallocate($img,0,0,0));
imagesavealpha($img, true);
imagepng($img);
}
$hours = visitors_at_hour(date("d.m.Y ", time()));
$hours_yesterday = visitors_at_hour(date("d.m.Y ", strtotime(intval(date("d",time())-1).date(".m.Y.",time()))));
$message = '<div style="width:100%;height:150px;background-color:#000;background-image:url(https://'.$_SERVER['SERVER_NAME'].'/opolytics/img/opolytics-beta.png);background-size:48%;background-repeat:no-repeat;" id="background_standard_layout"><div style="border-radius:200px 200px 200px 200px;position:relative;left:80%;top:35px;width:150px;background-color:#000;box-shadow:11px 10px 5px 0 rgba(0,0,0,0.22);color:#fff;text-align:center;width:200px;padding-bottom:40px;float:right;"><img style="width:200px;border-radius:200px 200px 200px 200px" src="https://'.$_SERVER['SERVER_NAME'].'/opolytics/opolytics.png"><br><br>@'.$_SERVER['SERVER_NAME'].'<br><a href="https://'.$_SERVER['SERVER_NAME'].'/opolytics/view.php" style="color:#fff">Zur Übersicht</a><br><a style="color:#fff" href="https://'.$_SERVER['SERVER_NAME'].'/opolytics/detail.php?view=tag&day='.date("d.m.Y",time()).'">Detaillierter Bericht</a></div></div><h1 class="titles">Tägliches Opolytics-Update</h1><p class="titles">Beim nachfolgenden Bericht handelt es sich um den täglichen Bericht vom '.date("d.m.Y",time()).' für die Seite '.$_SERVER['SERVER_NAME'].'.</p><h2>Nutzerzahlen</h2>';
if($days[9] < $days[0]) {
$message .= '<p>Sie haben seit 10 Tagen an Nutzern gewonnen.</p>';
}
if($days[9] > $days[0]) {
$message .= '<p>Sie haben leider über die letzten 10 Tage an Nutzern verloren.</p>';
}
if($days[9]==$days[0]) {
$message .= '<p>Sie haben über die letzten 10 Tage eine anhaltend gleiche Anzahl an Nutzern.</p>';
}
$hours = visitors_at_hour(date("d.m.Y", strtotime($_GET['day'])));
$message .= '<p><img src="https://'.$_SERVER['SERVER_NAME'].'/opolytics/opolyticsmessage.php?graph=10days&id='.$config[19].'&day='.date("d.m.Y",time()).'" width="90%"></p><p>Die höchste Anzahl an Nutzern am '.date("d.m.Y",time()).' in einer Stunden waren '.max($hours).' Nutzer.</p>';
$referrers_yesterday = referrers_at_day(intval(date("d",time())-1).date(".m.Y.",time()));
$referrers = referrers_at_day(date("d.m.Y",time()));
$countries_yesterday = countries_day(intval(date("d",time())-1).date(".m.Y.",time()));
$keywords = keywords_day(date("d.m.Y",time()));
$message .= '<p><img src="https://'.$_SERVER['SERVER_NAME'].'/opolytics/opolyticsmessage.php?graph=hours&id='.$config[19].'&day='.date("d.m.Y",time()).'" width="90%"></p><h3>Vergleich zu gestern</h3><table class="vergleich"><thead><td>Vergleich</td><td>Gestern</td><td>Heute</td></thead><tbody><tr><td>Anzahl Besucher</td><td>'.visitors_per_day(intval(date("d",time())-1).date(".m.Y.",time())).'</td><td>'.visitors_per_day(date("d.m.Y",time())).'</td></tr><tr><td>Höchste Anzahl Nutzer zum ersten Mal erreicht</td><td>'.array_search(max($hours_yesterday), $hours_yesterday).'</td><td>'.array_search(max($hours), $hours).'</td></tr><td></tr><tr><td>Populärster Referrer</td><td>'.array_search(max($referrers_yesterday),$referrers_yesterday).'</td><td>'.array_search(max(referrers_at_day(date("d.m.Y.",time()))),referrers_at_day(date("d.m.Y.",time()))).'</td></tr><tr><td>Populärstes Herkunftsland</td><td>'.array_search(max($countries_yesterday),$countries_yesterday).'</td><td>'.array_search(max(countries_day(date("d.m.Y.",time()))),countries_day(date("d.m.Y.",time()))).'</td></tr></tbody></table>';
$message .= '<h3>Das wurde heute gesucht</h3><table style="width:auto;min-width:90%"><tr><td><b>Suchmaschine</b></td><td><b>Angezeigter Titel</b></td><td><b>Angezeigte Beschreibung</b></td><td><b>Aufgerufene Seite</b></td><td><b>Suche</b></td><td><b>Aufrufe</b></td></tr>';
    $Search_Engine_zaehle = array_count_values($keywords);
    arsort($Search_Engine_zaehle);
    $Search_Engine_site = print_r($Search_Engine_zaehle, true);
    $Search_Engine_site = str_replace('Array', '', $Search_Engine_site);
    $Search_Engine_site = str_replace('(', '', $Search_Engine_site);
    $Search_Engine_site = str_replace(')', '</td></tr>', $Search_Engine_site);
    $Search_Engine_site = str_replace('Array', '', $Search_Engine_site);
    $Search_Engine_site = str_replace('[', '<tr><td>', $Search_Engine_site);
    $Search_Engine_site = str_replace(']', '', $Search_Engine_site);
    $Search_Engine_site = str_replace('=>', '</td> <td>', $Search_Engine_site);
    $Search_Engine_site = substr($Search_Engine_site, 0, -30); 
    $message.= str_replace('@opolyticswhitespace', ' ', $Search_Engine_site);
$message .= '</td></tr></table><h3>Besucherkarte</h3><table><td width="70%"><img src="https://'.$_SERVER['SERVER_NAME'].'/opolytics/opolyticsmessage.php?graph=map&id='.$config[19].'&day='.date("d.m.Y",time()).'" width="90%"></td><td><table style="margin:0px;box-shadow:none;max-height:300px;"><tr><td><b>Land</b></td><td><b>Aufrufe</b></td></tr>';
    $zaehle = countries_day(date("d.m.Y",time()));
    arsort($zaehle);
    $search = print_r($zaehle, true);
    $search = str_replace('Array', '', $search);
    $search = str_replace('(', '', $search);
    $search = str_replace(')', '</td></tr>', $search);
    $search = str_replace('Array', '', $search);
    $search = str_replace('[', '<tr><td>', $search);
    $search = str_replace(']', '', $search);
    $search = str_replace('=>', '</td><td>', $search);
    $message .=$search;
$message .='</table><table style="margin:0px;box-shadow:none;max-height:300px;"><tr><td><b>Region</b></td><td><b>Aufrufe</b></td></tr>';
    $zaehle = regions_day(date("d.m.Y",time()));
    $search = print_r($zaehle, true);
    $search = str_replace('Array', '', $search);
    $search = str_replace('(', '', $search);
    $search = str_replace(')', '</td></tr>', $search);
    $search = str_replace('Array', '', $search);
    $search = str_replace('[', '<tr><td>', $search);
    $search = str_replace(']', '', $search);
    $search = str_replace('=>', '</td><td>', $search);
    $message .=$search;
$message .='</table></td></table><p>Vorsicht. Manche Nutzer werden auf der Karte möglicherweise doppelt angezeigt, da ihr Land auf zwei Kontinenten liegt und es nicht ganz klar ist, in welchem sie sich befinden.</p><h3>Weitere Informationen</h3><p>Wenn Sie noch weitere Informationen wünschen, so besuchen Sie doch Ihre Opolytics-Installation und sehen Sie sich den dortigen ausführlicheren Bericht <a href="https://'.$_SERVER['SERVER_NAME'].'/opolytics/detail.php?view=tag&day='.date("d.m.Y",time()).'" title="Opolytics Tagesbericht vom '.date("d.m.Y",time()).'">hier</a> an. Sofern Sie derzeit dort nicht eingeloggt sind, müssen Sie möglicherweise einen kleinen Umweg über die <a href="https://'.$_SERVER['SERVER_NAME'].'/opolytics/login.php">Anmeldungsseite</a> nehmen.</p><p style="font-color:grey"><i>Bei dieser E-Mail handelt es sich um einen automatisch täglich generierten Bericht. Bitte antworten Sie nicht auf diese Email.</i></p><style>
@media only screen and (min-width: 640px){.titles{margin-right:325px}}h1,h2,h3,p,table{margin-left:40px;border-radius:100px;background-color:#fff;box-shadow:9px 10px 29px 4px rgba(0,0,0,0.68);text-align:center;padding:25px 10px 25px 30px}thead td{border-bottom:1px solid #000;background-color:#DFDEDE;height:40px;font-size:15pt}thead td:first-child{border-radius:20px 0 0 0}thead td:last-child{border-radius:0 20px 0 0}.vergleich tbody tr td:first-child{font-weight:300}table{width:95%}body{font-family:Arial}#background_standard_layout{width:100%;height:150px;background-color:#000;background-image:url(https://'.$_SERVER['SERVER_NAME'].'/opolytics/img/opolytics-beta.png);background-size:48%;background-repeat:no-repeat}#background_standard_layout div img{width:200px;border-radius:200px 200px 200px 200px;float:left;}#background_standard_layout div{border-radius:200px 200px 200px 200px;position:relative;left:80%;top:35px;width:150px;background-color:#000;box-shadow:11px 10px 5px 0 rgba(0,0,0,0.22);color:#fff;text-align:center;width:200px;padding-bottom:40px;float:left !important;}#background_standard_layout div a{color:#fff}a{color:#000}
</style>';

if($_GET['OPOLYTICS-MAIL-ID']==$config[19]) {
$headers = "From: Opolytics <opolytics@".$_SERVER['SERVER_NAME'].">\n";
$headers .= "Content-type: text/html; charset=utf-8\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "X-Mailer: Opolytics (powered by PHP)\r\n";
$headers .= "Reply-To: No-Reply\r\n";
mail($config[3], "Täglicher Opolytics-Bericht", $message, $headers);
}
?>