-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconn.php
More file actions
32 lines (26 loc) · 878 Bytes
/
conn.php
File metadata and controls
32 lines (26 loc) · 878 Bytes
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
<?php
$db_name = "if0_34822554_db_perpuspro";
mysql_connect("sql301.infinityfree.com","if0_34822554","5uMKDV7dErYl");
mysql_select_db("if0_34822554_db_perpuspro");
//fungsi format rupiah
/**function format_rupiah($rp) {
$hasil = "Rp." . number_format($rp, 0, "", ".") . ",00";
return $hasil;
}**/
//fungsi pinjaman buku terlambat
function terlambat($tgl_dateline, $tgl_kembali) {
$tgl_dateline_pcs = explode ("-", $tgl_dateline);
$tgl_dateline_pcs = $tgl_dateline_pcs[2]."-".$tgl_dateline_pcs[1]."-".$tgl_dateline_pcs[0];
$tgl_kembali_pcs = explode ("-", $tgl_kembali);
$tgl_kembali_pcs = $tgl_kembali_pcs[2]."-".$tgl_kembali_pcs[1]."-".$tgl_kembali_pcs[0];
$selisih = strtotime ($tgl_kembali_pcs) - strtotime ($tgl_dateline_pcs);
$selisih = $selisih / 86400;
if ($selisih>=1) {
$hasil_tgl = floor($selisih);
}
else {
$hasil_tgl = 0;
}
return $hasil_tgl;
}
?>