-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.php
48 lines (43 loc) · 888 Bytes
/
utils.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
function checkFileSize($size, $max_size)
{
if ($size > $max_size) {
echo "<script>alert('File yang diupload harus kurang dari " . ($max_size/1000) . "KB')</script>";
return 0;
} else return 1;
}
function allowedFileType($file_type, $allowed_type)
{
$allowed = 0;
foreach ($allowed_type as $type) {
if ($file_type == $type) $allowed = 1;
}
if($allowed === 1) return 1;
else {
echo "<script>alert('Hanya menerima file ".implode(', ', $allowed_type)."')</script>";
return 0;
}
}
const BULAN_DALAM_INDONESIA = [
"Januari",
"Februari",
"Maret",
"April",
"Mei",
"Juni",
"July",
"Agustus",
"September",
"Oktober",
"November",
"Desember"
];
const HARI_DALAM_INDONESIA = [
"Minggu",
"Senin",
"Selasa",
"Rabu",
"Kamis",
"Jumat",
"Sabtu"
];