-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
30 lines (26 loc) · 955 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0,2);
// write to logfile
$date = str_replace(".", "_", date('Y.m.d'));
createDirIfNotExists("./logs/logfiles_".str_replace(".", "_", date('Y.m')));
$logfile = fopen("./logs/logfiles_".str_replace(".", "_", date('Y.m'))."/logfile_$date.txt", "a");
$date = date('H:i:s');
fwrite($logfile, "$date - $lang\n");
fclose($logfile);
if($lang == "de") {
header("Location: ./de/");
} else if($lang == "fr") {
header("Location: ./fr/");
} else if($lang == "es") {
header("Location: ./es/");
} else {
// Default language
header("Location: ./en/");
}
exit;
//--------------------------------------------------------------------Funktionen--------------------------------------------------------------------
function createDirIfNotExists($path) {
if(!file_exists($path)) return mkdir($path, 0777, true);
return false;
}
?>