Vous êtes sur la page 1sur 21

LAMPIRAN

1. Listing Program Aplikasi Absensi Berbasis SMS Gateway

Default.php
*{ margin: 0; padding: 0; } body { margin-top: 220px; background: #000000 url(images/img01.png) no-repeat center top; font: normal small Verdana, Arial, Helvetica, sans-serif; color: #999999; } h1, h2, h3 { color: #FFFFFF; } h2 { } h3 { } p, blockquote, ul, ol { margin-bottom: 1.4em; line-height: 1.8em; text-align: justify; } p{ } blockquote { margin-left: 2em;

Universitas Sumatera Utara

margin-right: 2em; font-style: italic; } ul { margin-left: 3em; } ul li { } ol { margin-left: 3em; } ol li { } a{ text-decoration: none; color: #FFFFFF; } a:hover { text-decoration: underline; } img { border: 4px solid #C4C2C2; } /* Boxed Style */ .boxed { margin-bottom: 20px; } .boxed .title { margin: 0;

Universitas Sumatera Utara

padding: 5px 0; background: url(images/img07.gif) repeat-x left bottom; font-size: 1em; } .boxed .content { padding: 15px; } /* Post */ .post { } .post .title { padding: 10px 0; background: url(images/img07.gif) repeat-x left bottom; font-size: 1.6em; font-weight: normal; } .post .date { padding-top: 5px; font-size: .8em; font-weight: normal; } .post .date .month { } .post .date .day { } .post .date .year {

Universitas Sumatera Utara

} .post .meta { padding-bottom: 10px; background: url(images/img07.gif) repeat-x left bottom; font-size: .8em; } .post .meta p { margin: 0; line-height: normal; } .post .story { padding: 20px; } /* Header */ #header { height: 30px; background: url(images/img02.gif) repeat-x; } /* Header > Logo */ #logo { width: 700px; height: 19px; margin: 0 auto; padding: 6px 0 0 0; } #logo h1, #logo h2 {

Universitas Sumatera Utara

text-transform: uppercase; letter-spacing: 1px; font-size: 11px; } #logo h1 { float: left; } #logo h2 { float: right; } #logo a { } /* Header > Menu */ #menu { width: 700px; height: 27px; margin: 0 auto; } #menu ul { margin: 0; padding: 7px 0 0 0; list-style: none; } #menu li { display: inline; }

Universitas Sumatera Utara

#menu a { display: block; float: left; height: 25px; margin: 0 5px 0 0; padding: 2px 25px 0 25px; background: url(images/img03.gif) repeat-x; border: 1px solid #222222; text-align: center; font-size: 9px; font-weight: bold; color: #FFFFFF; } #menu a:hover { background-image: url(images/img04.gif); text-decoration: none; } #menu .active a { background-image: url(images/img05.gif); } /* Wrapper */ #wrapper { background: url(images/img06.gif) repeat-x; } /* Content */ #content { width: 700px; margin: 0 auto;

Universitas Sumatera Utara

padding: 20px 0 0 0; } /* Content > Main */ #main { float: right; width: 100%; } /* Content > Main > Welcome */ #welcome { padding-top: 5px; } /* Content > Main > Example */ #example { } /* Content > Sidebar */ #sidebar { float: left; width: 220px; } /* Content > Sidebar > Support */ #support { padding: 20px 15px; color: #FF8A00; }

Universitas Sumatera Utara

#support h2 { margin: 0; font-size: 1.3em; color: #FF8A00; } #support h3 { margin: 0; font-size: 1em; color: #FF8A00; } /* Content > Sidebar > Login */ #login { } #login form { } #login fieldset { border: none; } #login legend { display: none; } #login label { font-size: x-small; font-weight: bold; }

Universitas Sumatera Utara

#login input { margin-bottom: 5px; padding: 2px 5px; border: 1px solid #385B88; font-family: Verdana, Arial, Helvetica, sans-serif; } #inputtext1, #inputtext2 { color: #385B88; } #inputsubmit1 { background: #385B88; color: #FFFFFF; } #login p { font-size: .8em; } /* Content > Sidebar > Updates*/ #updates { } #updates ul { margin: 0; list-style: none; } #updates h3 { margin: 0; font: bold x-small Verdana, Arial, Helvetica, sans-serif; }

Universitas Sumatera Utara

#updates p { margin-bottom: 1.4em; font-size: smaller; line-height: normal; } /* Content > Sidebar > Partners*/ #partners { } #partners .content { padding: 10px 0; } #partners ul { margin: 0; border-bottom: 1px solid #D1BC5C; list-style: none; line-height: normal; } #partners li { padding: 10px; border-top: 1px solid #D1BC5C; } /* Footer */ #footer { clear: both; padding: 20px 50px; border-top: 4px solid #393F4D;

Universitas Sumatera Utara

} #footer p { width: 1000px; margin: 0 auto; font-size: x-small; color: #FFFFFF; } #footer a { text-decoration: underline; color: #FFFFFF; } #footer a:hover { text-decoration: underline; } /* Footer > Legal */ #legal { } /* Footer > Links */ #links { }

Universitas Sumatera Utara

index.php

<html> <head> <title>CV. Utama Teknik Jaya</title> <link href="default.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="header"></div> <div id="wrapper" align="center"> <div align="center"><h2>Silahkan Isi Daftar Hadir Anda</h2></div><br> <form action="proses_absen.php" method="post"> <? if(isset($err1)){ echo "<table width=363 border=0 align=center><tr><td><blink>Data anda masih kosong</blink></div></td></tr></table>"; } else if (isset($err2)){ echo "<table><tr><td><blink>Password anda Salah</blink></div></td></tr></table>"; } else if (isset($err3)){ echo "<table><tr><td><blink>NIK anda Salah</blink></div></td></tr></table>"; } else if (isset($err4)){ echo "<table><tr><td><blink>Nama anda Salah</blink></div></td></tr></table>"; }

?><br> <table width="363" height="128" border="0" align="center"> <tr> <td width="140">NIK</td> <td width="7">:</td> <tdwidth="250" align="center"><input name="nik" type="text" id="nik" /></td>

Universitas Sumatera Utara

</tr> <tr> <td>Nama</td> <td>:</td> <td align="center"><input name="nama" type="text" id="nama" /></td> </tr> <tr> <td>Password</td> <td>:</td> <td align="center"><input name="password" type="password" id="password"/></td> </tr> <tr> <td>Status</td> <td>:</td> <td align="center"><select name="status" id="status"> <option value="DATANG">DATANG</option> <option value="PULANG">PULANG</option> </select> </td> </tr> <tr> <td colspan="3" align="center"><input type="submit" name="Submit" value="PROSES" /> <input type="reset" name="Submit2" value="RESET" /></td> </tr> </table> </form> </div> <div id="footer"> <p id="legal">Copyright &copy; 2012. All Rights Reserved. Designed by <a href="#">CV. UTAMA TEKNIK JAYA</a>.</p> </div> </body> </html>

koneksi.php
<?php $host="localhost"; $userdb="root"; $passdb=""; $namadb="absen1"; $sambung=mysql_connect($host,$userdb,$passdb); $db = new mysqli($host, $userdb, $passdb, $namadb); $tes=mysql_select_db($namadb,$sambung); ?>

Universitas Sumatera Utara

Proses_absen.php
<?php include "koneksi.php"; $nik=$_POST['nik']; $nama=$_POST['nama']; $password=$_POST['password']; $status=$_POST['status']; $sql=mysql_query("SELECT * from karyawan where NIK='$nik'"); $row=mysql_fetch_array($sql); if($nik=="" and $password=="") { header("location:index.php?err1"); } else if($nik!="$row[NIK]") { header("location:index.php?err3"); } else if($password!="$row[PASSWORD]") { header("location:index.php?err2"); } else if($nama!="$row[Nama]") { header("location:index.php?err4"); } else if($status=='DATANG') { $jam1=date("H"); $jam2=$jam1-1; $ms=date("is"); $jam=$jam2.$ms; if($jam<=80000) { mysql_query("INSERT INTO `absen1`.`absensi` (`NIK` ,`TANGGAL` ,`JAM_MASUK` ,`JAM_PULANG` ,`Nama`,TEPAT_WAKTU) VALUES ('$nik', CURDATE( ) , CURTIME( ) , '', '$nama','1');"); ?><script language="JavaScript">alert('Selamat Datang <? echo "$nama "; ?>dan Selamat Bekerja'); document.location='index.php?kategori=index'</script><? } else { mysql_query("INSERT INTO `absen1`.`absensi` (`NIK` ,`TANGGAL` ,`JAM_MASUK` ,`JAM_PULANG` ,`Nama`, TELAT) VALUES ('$nik', CURDATE( ) , CURTIME( ) , '', '$nama','1');"); ?><script language="JavaScript">alert('Selamat Datang <? echo "Bpk. $nama "; ?>dan Selamat Bekerja'); document.location='index.php?kategori=index'</script><? } } else if($status=='PULANG') {

Universitas Sumatera Utara

mysql_query("UPDATE `absen1`.`absensi` SET `JAM_PULANG` = CURTIME( ) WHERE CONVERT( `absensi`.`NIK` USING utf8 ) = '$nik' AND `absensi`.`TANGGAL` = CURDATE( ) AND (`absensi`.`Nama`)='$nama' LIMIT 1 ;"); ?><script language="JavaScript">alert('Sampai Jumpa'); document.location='index.php?kategori=index'</script><? } ?>

smsterjadwal.php
<html> <head> <title>SMS Terjadwal</title> <!-- refresh script setiap 10 detik --> <meta http-equiv="refresh" content="10; url=<?php $_SERVER['PHP_SELF']; ?>"> </head> <body> <h1> <? $jam1=date("H"); $jam2=$jam1-1; $ms=date("is"); $jam=$jam2.$ms; ?> Tanggal : <?=date("Y-m-d")?> Jam : <?=$jam?> SMS Absensi Pegawai Running...</h1> <?php // koneksi ke database mysql mysql_connect("localhost", "root", ""); $db=mysql_select_db("absen1"); $noSibos="+6281376596923"; // baca jam sekarang // cari data teman yang bulan lahir dan tanggal lahir sesuai pada current date $tgl=date("Y-m-d"); if($jam>=80000 && $jam<=80009) { $i=0; $query = "SELECT Nama, JAM_MASUK, TANGGAL from absensi where TEPAT_WAKTU='1' and TANGGAL='$tgl' order by Nama ASC"; $hasil = mysql_query($query); while($row=mysql_fetch_array($hasil)) { $isi[$i]="$row[Nama], Pukul : $row[JAM_MASUK]"; $i=$i+1; $tanggal="$row[TANGGAL]"; } $PesanSMS = "Pegawai Hadir Tepat Waktu Pukul 08.00 WIB Tanggal ".$tanggal." Atas Nama : ".$isi[0]." - ".$isi[1]." - ".$isi[2]." - ".$isi[3]." - ".$isi[4]." - ".$isi[5];

Universitas Sumatera Utara

= "insert into smsd.outbox values ('', '', '', NULL, '$noSibos','Default_No_Compression', NULL, -1, '$PesanSMS','','false',1,'','','','Gammu');"; mysql_query($query3); } else if($jam>=83000 && $jam<=83009) { $i=0; $query = "SELECT Nama, JAM_MASUK, TANGGAL FROM absensi where TELAT='1' and TANGGAL='$tgl' order by Nama ASC"; $hasil = mysql_query($query); while($row=mysql_fetch_array($hasil)) { $isi[$i]="$row[Nama], Pukul : $row[JAM_MASUK]"; $i=$i+1; $tanggal="$row[TANGGAL]"; } $PesanSMS = "Pegawai yang Terlambat Pukul 08.30 WIB Tanggal ".$tanggal." Atas Nama : ".$isi[0]." - ".$isi[1]." - ".$isi[2]." - ".$isi[3]." - ".$isi[4]." - ".$isi[5]; $query3 = "insert into smsd.outbox values ('', '', '', NULL, '$noSibos','Default_No_Compression', NULL, -1, '$PesanSMS','','false',1,'','','','Gammu');"; mysql_query($query3); } ?> </body> </html> $query3

Universitas Sumatera Utara

Listing Program Laporan bulanan absensi pegawai CV. Utama Teknik Jaya <?php // isi $excel akan bernilai true apabila ditemukan parameter get dengan nama 'excel' $excel = isset($_GET['excel']); if($excel): // buat nama file unique untuk di download $filename = 'export-'.date('YmdHis'); // dengan perintah di bawah ini akan memunculkan dialog download di browser anda header("Content-type: application/x-msdownload"); // perintah di bawah untuk menentukan nama file yang akan di download header("Content-Disposition: attachment; filename=".$filename.".xls"); else: // tag header di html disembuyikan apabila sedang convert html to excel ?> <html> <head> <style type="text/css"> /* setting format tabel */ table { font-family: Verdana; font-size: 8pt; border-width: 1px;

Universitas Sumatera Utara

border-style: solid; border-color: #ccd2d2; border-collapse: collapse; background-color: #f9f9f9; } th { color: #f00; font-size: 8pt; text-transform: uppercase; text-align: center; padding: 0.5em; border-width: 1px; border-style: solid; border-color: #000; border-collapse: collapse; background-color: #000; } td { padding: 0.1em; color: #272727; vertical-align: top; border-width: 1px; border-style: solid; border-color: #000; border-collapse: collapse;

Universitas Sumatera Utara

font-size: 8pt; } </style> <title>Report Excel Laporan Bulanan Absensi Pegawai</title> </head> <body> <?php endif; ?> <?php if(!$excel): ?> <!-- Tombol di bawah dan penutup html hanya akan dipanggil apabila dalam kondisi melihat data, tapi ketika menampilkan file excel tombol ini disembunyikan --> <div align="left" style="margin-top:15px"> <input type="button" onClick="document.location='?excel=1'" value="Export to Excel" /> </div> <br> <?php endif; ?> <?php //setting koneksi anda $server = "localhost"; $username = "root"; $password = ""; $db = "absen1"; $tbl = "absensi";

$koneksi = mysql_connect($server,$username,$password);

Universitas Sumatera Utara

mysql_select_db($db, $koneksi) or die("Cannot connect to database..");

// create tabel dengan php echo "Laporan Bulanan ABSENSI PEGAWAI CV.Utama Teknik Jaya "; echo "Tanggal =" , gmdate("d-m-Y H:i:s", time()+60*60*7); echo "<div align='left' style='color='#ff0000'><strong>DATA ABSENSI PEGAWAI </strong>"; echo "<table border='1'>"; echo " <tr bgcolor='#cccccc'>"; echo " <th>NO</th>"; echo " <th>Nik</th>"; echo " <th>Nama</th>"; echo " <th>Hadir</th>"; echo " <th>Telat</th>"; echo " <th>Tidak Hadir</th>"; echo " </tr>";

$str = " SELECT * FROM ".$db.".".$tbl. " order by NIK desc "; $query = mysql_query($str); if($query && mysql_num_rows($query) > 0){ $no = $posisi+1; while($row = mysql_fetch_object($query)){ //if($bgcolor=='#f1f1f1'){$bgcolor='#ffffff';} //else{$bgcolor='#f1f1f1';} echo "<tr bgcolor=$bgcolor>";

Universitas Sumatera Utara

echo " <td align='center' height='18'><strong>$no</strong></td>"; echo " <td>{$row->NIK}&nbsp;</td>"; echo " <td>{$row->Nama}&nbsp;</td>"; echo " <td>{$row->TEPAT_WAKTU}&nbsp;</td>"; echo " <td>{$row->TELAT}&nbsp;</td>"; echo " <td>{$row->TIDAK_HADIR}&nbsp;</td>"; $no++; } } //echo $str; echo " </tr>"; echo "</table>"; echo "</div>"; ?> </body> </html>

Universitas Sumatera Utara

Vous aimerez peut-être aussi