Professional Documents
Culture Documents
Script
Script
php
<?php
include "config.php";
$password=$_POST[password];
$user=$_POST[username];
if ($ketemu > 0) {
session_start();
session_register("KDAO");
session_register("level");
$_SESSION[KDAO]=$r[KDACOUNTOFFICER];
$_SESSION[level]=$r[LEVEL];
header('location:index.php');
}
else {
header('location:login.php?err=Username atau Password Tidak
Cocok');
}
?>
2. Proses_data_ao.php
<?php
include_once("config.php");
include_once("pagination_class.php");
if(isset($_GET['starting'])){
$starting=$_GET['starting'];
}else{
$starting=0;
}
$recpage = 5;
$obj = new pagination_class($sql,$starting,$recpage);
$result = $obj->result;
?>
<div style=’overflow-y:scroll;overflow-x:scroll;padding:20px;scroll-
color:hidden;’>
<table id="tblao">
<tr><th>Aksi</th><th>Kode_Account_Officer</th><th>Nama_Lengkap_Account_Off
icer</th><th>Alamat_Lengkap_Account_Officer</th><th>Tempat_Lahir</th><th>T
anggal_Lahir_Account_Officer</th><th>No. Handphone</th></tr>
<?php
if(mysql_num_rows($result)!=0){
while($row = mysql_fetch_array($result)){
?>
<tr><td class="action"><a href="form_ao.php?action=update&id=<?php
echo $row['KDACOUNTOFFICER'];?>" class="edit">Ubah</a><a
href="proses_data_ao.php?action=delete&id=<?php echo
$row['KDACOUNTOFFICER'];?>" class="delete">Hapus</a></td>
<td><?php echo $row['KDACOUNTOFFICER']; ?></td><td><?php echo
$row['NAMAAO']; ?></td><td><?php echo $row['ALAMATAO']; ?></td><td><?php
echo $row['TEMPATLAHIR']; ?></td><td><?php echo $row['TGLLAHIR'];
?></td><td><?php echo $row['TELEPON']; ?></td></tr>
<?php } //end while ?>
<tr id="nav"><td colspan="7"><?php echo $obj->anchors;
?></td></tr>
<tr id="total"><td colspan="7"><?php echo $obj->total; ?></td></tr>
<?php }else{?>
<tr><td align="center" colspan="7">Data tidak ditemukan!</td></tr>
<?php }?>
3. Page_data_daftar.php
<?php
include_once("config.php");
include_once("pagination_class.php");
$recpage = 5;
$obj = new pagination_class($sql,$starting,$recpage);
$result = $obj->result;
?>
<div style=’overflow-y:scroll;overflow-x:scroll;padding:20px;scroll-
color:hidden;’>
<table id="tbldaftar">
<tr><th>Aksi</th><th>No_Pendaftaran</th><th>Kode_Account_Officer</th><th>N
ama_Lengkap_Pendaftar</th><th>Alamat_Lengkap_Pendaftar</th><th>Pekerjaan</
th><th>Jenis_Kelamin</th><th>Besar_Pinjaman</th><th>Besar_Bunga</th><th>An
gsuran</th><th>Lama_Angsuran</th><th>Tanggal_Pengajuan</th><th>Barang_Jami
nan</th><th>Harga</th></tr>
<?php
if(mysql_num_rows($result)!=0){
while($row = mysql_fetch_array($result)){
?>
<tr><td class="action"><a
href="form_daftar.php?action=update&id=<?php echo $row['NODAFTAR'];?>"
class="edit">Ubah</a><a
href="proses_data_daftar.php?action=delete&id=<?php echo
$row['NODAFTAR'];?>" class="delete">Hapus</a></td>
<td><?php echo $row['NODAFTAR']; ?></td><td><?php echo
$row['KDACOUNTOFFICER']; ?></td><td><?php echo $row['NAMAPENDAFTAR'];
?></td><td><?php echo $row['ALAMATPENDAFTAR']; ?></td><td><?php echo
$row['PEKERJAAN']; ?></td><td><?php echo $row['JENISKELAMIN'];
?></td><td><?php echo $row['BESARPINJAMAN']; ?></td><td><?php echo
$row['BESARBUNGA']; ?></td><td><?php echo $row['ANGSURAN'];
?></td><td><?php echo $row['LAMAANGSURAN']; ?></td><td><?php echo
$row['TGLPENGAJUAN']; ?></td><td><?php echo $row['NAMABARANG'];
?></td><td><?php echo $row['HARGA']; ?></td></tr>
<?php } //end while ?>
<tr id="nav"><td colspan="14"><?php echo $obj->anchors;
?></td></tr>
<tr id="total"><td colspan="14"><?php echo $obj->total; ?></td></tr>
<?php }else{?>
<tr><td align="center" colspan="14">Data tidak ditemukan!</td></tr>
<?php }?>
</table>
</div>
4. Proses_data_daftar.php
<?php
if(isset($_POST['action']) && $_POST['action']=="add")
{
$idao=$_SESSION['KDAO'];
$nama=$_POST['nama'];
$jk=$_POST['jk'];
$alamat=$_POST['alamat'];
$pinjaman=$_POST['pinjaman'];
$bunga=$_POST['bunga'];
$angsuran=$_POST['angsuran'];
$lama=$_POST['lama'];
$tglaju=$_POST['aju'];
$jaminan=$_POST['jaminan'];
$harga=$_POST['harga'];
$kerja=$_POST['kerja'];
$idjaminan=$hslj['IDJAMINAN'];
$nodaftar = buatID("pendaftaran","NSB");
mysql_query("INSERT INTO pendaftaran
(NODAFTAR,KDACOUNTOFFICER,IDJAMINAN,NAMAPENDAFTAR,JENISKELAMIN,ALAMATPENDA
FTAR,BESARPINJAMAN,BESARBUNGA,ANGSURAN,LAMAANGSURAN,TGLPENGAJUAN,PEKERJAAN
)
VALUES('$nodaftar','$idao','$idjaminan','$nama','$jk','$alamat','$pinjaman
','$bunga','$angsuran','$lama','$tglaju','$kerja')") or die ("data gagal
ditambahakan!");
echo '{"status":"1"}';
exit;
}
elseif(isset($_POST['action']) && $_POST['action']=="update")
$nodaftar=$_POST['idao'];
$idao=$_SESSION['KDAO'];
$idjaminan=$_POST['idjaminan'];
$nama=$_POST['nama'];
$jk=$_POST['jk'];
$alamat=$_POST['alamat'];
$pinjaman=$_POST['pinjaman'];
$bunga=$_POST['bunga'];
$angsuran=$_POST['angsuran'];
$lama=$_POST['lama'];
$tglaju=$_POST['aju'];
$jaminan=$_POST['jaminan'];
$harga=$_POST['harga'];
$kerja=$_POST['kerja'];
?>
5. Proses_data_survey.php
<?php
include_once("config.php");
function nilaitovariabel($x) {
$jmlk = mysql_num_rows(mysql_query("SELECT * FROM kriteria"));
if ($x == "Baik") {
$z = $baik;
return $z;
} elseif ($x == "Cukup") {
$z = $cukup;
return $z;
} elseif ($x == "Kurang"){
$z = $kurang;
return $z;
}
}
$no=$_POST['no'];
$kriteria=$hq1['IDKRITERIA'];
$var=$_POST["$hq1[IDKRITERIA]"];
$nilai=nilaitovariabel($var);
echo '{"status":"1"}';
exit;
}
elseif(isset($_POST['action']) && $_POST['action']=="update") {
$qry2 = mysql_query("select IDKRITERIA from kriteria");
while ($hq2 = mysql_fetch_array($qry2)) {
$no=$_POST['no'];
$kriteria=$hq2['IDKRITERIA'];
$var=$_POST["$hq2[IDKRITERIA]"];
$nilai=nilaitovariabel($var);
$test = mysql_query("UPDATE survey SET
NILAI='$nilai',VARIABEL='$var' WHERE NODAFTAR='$no' AND IDKRITERIA =
'$kriteria'") or die ("data gagal di-update!");
}
echo '{"status":"1"}';
exit;
}
elseif(isset($_GET['action']) && $_GET['action']=="delete") {
$no = $_GET['id'];
$test = mysql_query("delete from survey where NODAFTAR='$no'");
$break = mysql_query("UPDATE pendaftaran SET ISSURVEY = 0 WHERE
NODAFTAR = '$no'");
if(mysql_affected_rows() == 1){ //jika jumlah baris data yang dikenai
operasi delete == 1
echo '{"status":"1"}';
}else{
echo '{"status":"0"}';
}
exit;
}
?>
6. Proses_data_kriteria.php
<?php
include_once("config.php");
7. Proses.php
<?php
include 'fungsi_preferensi.php';
include 'config.php';
header('location:inisialisasi.php');
?>
8. Fungsi_preferensi.php
<?php
function preferensi($nilai1, $nilai2, $tipe) {
$x = $nilai1 - $nilai2;
if ($tipe == 1) {
if ($x <= 0 ) {
$z = 0;
} else {
$z = 1;
}
} elseif ($tipe == 2) {
if ($x <= 2.9 ) {
$z = 0;
} else {
$z = 1;
}
} elseif ($tipe == 3) {
if ($x < 0) {
$z = 0;
} elseif ($x >= 0 and $x <= 5.8) {
$z = $x / 5.8;
} elseif ($x >= 5.8) {
$z = 1;
}
} elseif ($tipe == 4) {
if ($x <= 2.9) {
$z = 0;
} elseif ($x > 2.9 and $x <= 5.8) {
$z = 0.5;
} elseif ($x > 5.8) {
$z = 1;
}
} elseif ($tipe == 5) {
if ($x <= 2.9) {
$z = 0;
} elseif ($x > 2.9 and $x <= 5.8) {
$z = ($x - 2.9) / (5.8 - 2.9);
} elseif ($x > 5.8) {
$z = 1;
}
}
return $z;
}
?>
9. Insialisasi.php
<div id="main">
<div style=�overflow-y:scroll;overflow-
x:scroll;padding:20px;scroll-color:hidden;�>
<?php
include 'config.php';
<div id="main">
<div style=�overflow-y:scroll;overflow-
x:scroll;padding:20px;scroll-color:hidden;�>
<?php
include 'config.php';
echo '<table id="in">
<tr><th></th>';
$b = mysql_query("SELECT DISTINCT K1 FROM
promethe");
while ($th = mysql_fetch_array($b)) {
?>
<th><?php echo "$th[K1]"; ?></th>
<?php
}
?>
<?php
$c = mysql_query("SELECT DISTINCT K1 FROM
promethe");
$m = mysql_num_rows($c);
$jn = 1;
while ($xc = mysql_fetch_array($c)) {
?>
<tr><td><?php echo $xc['K1']; ?></td>
<?php
$no = 0;
for ($jrow = 1; $jrow <= $m; $jrow++) {
$v = mysql_query("SELECT * FROM promethe
WHERE K1 = '$xc[K1]' ORDER BY promethe.K2 ASC LIMIT $no , 1");
$r=mysql_fetch_array($v);
if ($jn == $jrow) {
echo "<td></td>";
} else {
?>
<td><?php echo "$r[JUMLAH]"; ?></td>
<?php
$no++;
}
}
$jn++;
}
?>
11. Pdfrangking.php
<?php
include ('class.ezpdf.php');
include ('config.php');
$pdf = new Cezpdf();
$pdf->ezSetCmMargins(3, 3, 3, 3);
$pdf->selectFont('fonts/Helvetica.afm');
$all = $pdf->openObject();
$pdf->setStrokeColor(0, 0, 0, 1);
$pdf->addJpegFromFile('images/logo.jpg',40,525,100);
$pdf->closeObject();
$pdf->addObject($all, 'all');
$pdf->ezText("<b>Data Perangkingan</b>\n\n");
$pdf->ezTable($data1, '', '', '');
$pdf->ezStartPageNumbers(450, 15, 8);
$pdf->ezStream();
?>
12. Excelrangking.php
<?php
$tgl = date('YmD');
$namaFile = "report_rangking_$tgl.xls";
function xlsBOF() {
echo pack("ssssss", 0x809, 0x8, 0x0, 0x10, 0x0, 0x0);
return;
}
function xlsEOF() {
echo pack("ss", 0x0A, 0x00);
return;
}
function xlsWriteNumber($Row, $Col, $Value) {
echo pack("sssss", 0x203, 14, $Row, $Col, 0x0);
echo pack("d", $Value);
return;
}
function xlsWriteLabel($Row, $Col, $Value ) {
$L = strlen($Value);
echo pack("ssssss", 0x204, 8 + $L, $Row, $Col, 0x0, $L);
echo $Value;
return;
}
xlsWriteLabel(0,0,"NO");
xlsWriteLabel(0,1,"NAMA");
xlsWriteLabel(0,2,"ALAMAT");
xlsWriteLabel(0,3,"NO PENDAFTARAN");
xlsWriteLabel(0,4,"ENTERING FLOW");
xlsWriteLabel(0,5,"LEAVING FLOW");
xlsWriteLabel(0,6,"NET FLOW");
include_once 'config.php';
$query = "SELECT pendaftaran.NAMAPENDAFTAR,
pendaftaran.ALAMATPENDAFTAR, perangkingan.* FROM perangkingan INNER
JOIN pendaftaran ON perangkingan.NODAFTAR = pendaftaran.NODAFTAR ORDER
BY perangkingan.NETFLOW DESC";
$hasil = mysql_query($query);
$noBarisCell = 1;
$noUrut = 1;
xlsWriteNumber($noBarisCell,0,$noUrut);
xlsWriteLabel($noBarisCell,1,$data['NAMAPENDAFTAR']);
xlsWriteLabel($noBarisCell,2,$data['ALAMATPENDAFTAR']);
xlsWriteLabel($noBarisCell,3,$data['NODAFTAR']);
xlsWriteNumber($noBarisCell,4,$data['ENTERINGFLOW']);
xlsWriteNumber($noBarisCell,5,$data['LEAVINGFLOW']);
xlsWriteNumber($noBarisCell,6,$data['NETFLOW']);
$noBarisCell++;
$noUrut++;
}
xlsEOF();
exit();
?>
13. Proses_data_nasabah.php
<?php
include_once("config.php");
if(isset($_GET['action']) && $_GET['action']=="delete") {
$id = $_GET['id'];
$test = mysql_query("delete from nasabah where
NOREKENING='$id'");
if(mysql_affected_rows() == 1){ //jika jumlah baris data yang dikenai
operasi delete == 1
echo '{"status":"1"}';
}else{
echo '{"status":"0"}';
}
exit;
}
?>
14. Restore.php
$nama_file=$_FILES['datafile']['name'];
$ukuran=$_FILES['datafile']['size'];
if ($nama_file=="")
{
echo "Fatal Error";
}else{
$uploaddir='./restore/';
$alamatfile=$uploaddir.$nama_file;
if (move_uploaded_file($_FILES['datafile']['tmp_name'],$alamatfile))
{
$filename = './restore/'.$nama_file.'';
$templine = '';
$lines = file($filename);
foreach ($lines as $line)
{
if (substr($line, 0, 2) == '--' || $line == '')continue;
$templine .= $line;
the query
$templine = '';
}
echo "<center>Berhasil Restore Database, silahkan di cek.</center>";
}else{
}else{
unset($_POST['restore']);
}
?>
<?php
}
?>
15. Download_backup.php
<?php
if($mime_type==''){
$file_extension = strtolower(substr(strrchr($file,"."),1));
if(array_key_exists($file_extension, $known_mime_types)){
$mime_type=$known_mime_types[$file_extension];
} else {
$mime_type="application/force-download";
};
};
ob_end_clean();
if(ini_get('zlib.output_compression'))
ini_set('zlib.output_compression', 'Off');
if(isset($_SERVER['HTTP_RANGE']))
{
list($a, $range) = explode("=",$_SERVER['HTTP_RANGE'],2);
list($range) = explode(",",$range,2);
list($range, $range_end) = explode("-", $range);
$range=intval($range);
if(!$range_end) {
$range_end=$size-1;
} else {
$range_end=intval($range_end);
}
$new_length = $range_end-$range+1;
header("HTTP/1.1 206 Partial Content");
header("Content-Length: $new_length");
header("Content-Range: bytes $range-$range_end/$size");
} else {
$new_length=$size;
header("Content-Length: ".$size);
}
$chunksize = 1*(1024*1024);
$bytes_send = 0;
if ($file = fopen($file, 'r'))
{
if(isset($_SERVER['HTTP_RANGE']))
fseek($file, $range);
while(!feof($file) &&
(!connection_aborted()) &&
($bytes_send<$new_length)
)
{
$buffer = fread($file, $chunksize);
print($buffer);
flush();
$bytes_send += strlen($buffer);
}
fclose($file);
} else