= $_SERVER['REMOTE_ADDR']; // Mendapatkan IP komputer user
Universitas Sumatera Utara
$tanggal = date("Ymd"); // Mendapatkan tanggal sekarang $waktu = time(); // // Mencek berdasarkan IPnya, apakah user sudah pernah mengakses hari ini $s = mysql_query("SELECT * FROM counter WHERE ip='$ip' AND tanggal='$tanggal'"); // Kalau belum ada, simpan data user tersebut ke database if(mysql_num_rows($s) == 0){ mysql_query("INSERT INTO counter(ip, tanggal, hits, online) VALUES('$ip','$tanggal','1','$waktu')"); } else{ mysql_query("UPDATE counter SET hits=hits+1, online='$waktu' WHERE ip='$ip' AND tanggal='$tanggal'"); } $pengunjung = mysql_num_rows(mysql_query("SELECT * FROM counter WHERE tanggal='$tanggal' GROUP BY ip")); $totalpengunjung = mysql_result(mysql_query("SELECT COUNT(hits) FROM counter"), 0); $hits = mysql_fetch_assoc(mysql_query("SELECT SUM(hits) as hitstoday FROM counter WHERE tanggal='$tanggal' GROUP BY tanggal")); $totalhits = mysql_result(mysql_query("SELECT SUM(hits) FROM counter"), 0); $tothitsgbr = mysql_result(mysql_query("SELECT SUM(hits) FROM counter"), 0); $bataswaktu = time() - 300; $pengunjungonline = mysql_num_rows(mysql_query("SELECT * FROM counter WHERE online > '$bataswaktu'")); $path = "gambar/counter/"; $ext = ".png"; $tothitsgbr = sprintf("%06d", $tothitsgbr); for ( $i = 0; $i <= 9; $i++ ){ $tothitsgbr = str_replace($i, "", $tothitsgbr); } echo "
$tothitsgbr
Pengunjung hari ini : $pengunjung Total pengunjung : $totalpengunjung
Hits hari ini : $hits[hitstoday] Total Hits : $totalhits
Pengunjung Online: $pengunjungonline
Universitas Sumatera Utara
";
?>
5. class_paging.php
1) { $link_halaman .= " << First | "; } if (($halaman_aktif-1) > 0) { $previous = $halaman_aktif-1;
Universitas Sumatera Utara
$link_halaman .= "< Previous | "; } // Link halaman 1,2,3, ... for ($i=1; $i<=$jmlhalaman; $i++) { if ($i == $halaman_aktif) { $link_halaman .= "$i | "; } else { $link_halaman .= "$i | "; } $link_halaman .= " "; } // Link Next dan Last if ($halaman_aktif < $jmlhalaman) { $next=$halaman_aktif+1; $link_halaman .= " Next > "; } if (($halaman_aktif != $jmlhalaman) && ($jmlhalaman != 0)) { $link_halaman .= " | La st >> "; } return $link_halaman; } } ?>
6. cari.php
Untitled Document
Universitas Sumatera Utara
Pencarian Data
No. Induk
Judul Buku
Pengarang
Penerbit
Eksemplar
Klasifikasi
Koleksi
"; while ($row=mysql_fetch_array($query)) { echo "
"; Printf("
$row[nomor_induk]
$row[judul_buku]
$row[nama_pengarang]
$row[nama_penerbit]
$row[jumlah_tersedia]
$row[klasifikasi]
$row[id_koleksi]
"); } echo " "; ?>
7. fungsi_indotgl.php
Universitas Sumatera Utara
return $tanggal.' '.$bulan.' '.$tahun; } function getBulan($bln){ switch ($bln){ case 1: return "Januari"; break; case 2: return "Februari"; break; case 3: return "Maret"; break; case 4: return "April"; break; case 5: return "Mei"; break; case 6: return "Juni"; break; case 7: return "Juli"; break; case 8: return "Agustus"; break; case 9: return "September"; break; case 10: return "Oktober"; break; case 11: return "November"; break; case 12: return "Desember"; break; } } ?>
Universitas Sumatera Utara
8. koneksi.php
9. pengurangan_jlh_tersedia.php
10. tanggal_pinjam.php
0) { $denda=300*$selisih; } else{ $denda=0; }; $q="update peminjaman set tanggal_kembali='$tanggal_kembali', denda='$denda', status='0' where id_pinjam='$selisihnya[0]'"; $rs=mysql_query($q,$koneksi); if($rs) { $sedia=mysql_query("select jumlah_tersedia from buku where nomor_induk='$nomor_induk'",$koneksi);
Universitas Sumatera Utara
$sedia2=mysql_fetch_array($sedia); $sedia3=$sedia2[0]+1; $q="update buku set jumlah_tersedia='$sedia3' where nomor_induk='$nomor_induk'"; $rs_status=mysql_query($q,$koneksi); }; }; ?> 11. teslogin.php
background-image:url(gambar/smandu/002.jpg); left: 52px; top: -3px; } #menu{ width:1150px; height:50px; position:absolute; background-image:url(gambar/smandu/bk_002.jpg); left: 50px; top: 244px; } #nav{margin:0;padding:0;} #nav ul{float: left;list-style:none;margin:0;padding:0;} #nav li{list-style:none;margin:0;padding:0;} #nav li a, #nav li a:link, #nav li a:visited{color:#000000;display:block;texttransform:capitalize;margin:0;padding:12px 12px 12px;font-family: Lucida Calligraphy; font-weight:bold;} #nav li a:hover, #nav li a:active{background:#0033FF;color:#FFF;margin: 0;padding: 11px 9px 8px;text-decoration: none;border-right:1px solid #296204;borderbottom:1px solid #296204;border-left:1px solid #296204} #nav li li a, #nav li li a:link, #nav li li a:visited{background:#3399FF;width:200px;color:#fff;texttransform:capitalize;float:none;margin:0;padding:7px 10px;border-bottom:1px solid #0d2601;border-left:1px solid #0d2601;border-right:1px solid #0d2601;font: normal 14px Georgia, Times New Roman;} #nav li li a:hover, #nav li li a:active{background:#0033FF;color:#fff;padding:7px 10px;} #nav li{float:left;padding:0;} #nav li a.enclose, #nav li a.enclose:visited{border-top:1px solid #000;} #nav li ul{z-index: 9999;position:absolute;left:999em;height:auto;width:170px;margin:0;padding:0;} #nav li ul a{width: 140px;} #nav li ul ul{margin:-75px 0 0 171px;} #nav li:hover ul ul, #nav li:hover ul ul ul, #nav li.sfhover ul ul, #nav li.sfhover ul ul ul{left:-999em;} #nav li:hover ul, #nav li li:hover ul, #nav li li li:hover ul, #nav li.sfhover ul, #nav li li.sfhover ul, #nav li li li.sfhover ul{left:auto;} #nav li:hover, #nav li.sfhover{position:static;} .style1 {color: #000000}