set_time_limit if isset _GET year year _GET year path stat clearstatca

 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
31
32
33
34
35
<?
set_time_limit(0);
if (isset($_GET['year'])) {
$year = $_GET['year'];
$path = "stat/";
clearstatcache();
if(!file_exists($path.$year))
{
mkdir($path.$year, 0777);
for ($i=1;$i<=12;$i++) {
if ($i>=1 and $i<=9) $month = "0".$i;
/*else*/ $month = $i;
mkdir($path.$year."/".$month, 0777);
for ($j=1;$j<=31;$j++) {
//if ($j>=1 and $j<=9) $day = "0".$j;
/*else*/ $day = $j;
mkdir($path.$year."/".$month."/".$day, 0777);
for ($k=0;$k<=23;$k++) {
/*if ($k>=0 and $k<=9) $hour = "0".$k;*/
/*else*/ $hour = $k;
mkdir($path.$year."/".$month."/".$day."/".$hour, 0777);
//mkdir($path.$year."/".$month."/".$day."/".$hour."/click_uniq", 0777);
//mkdir($path.$year."/".$month."/".$day."/".$hour."/click_raw", 0777);
//mkdir($path.$year."/".$month."/".$day."/".$hour."/uniq", 0777);
//mkdir($path.$year."/".$month."/".$day."/".$hour."/raw", 0777);
}
}
}
echo "Директории созданы";
}
else {
echo "Директория уже существует";
}
}
?>