Secure Web
Secure Web
Secure Web
Abstract
Web Base Application this moment has consider by company, specifically for company who having more than one
branch or more. With presence application web bases, data can save as centrally. The other thing become
consideration for company is the expense belong to cheap, because we can hire the server at provider. There are
many Internet Service Provider in Indonesia, with the result they are competing within thing price. However there
are cause of why they afraid that is to say complication data safety.
Key words
Web Application, Security, SQL Injection, PDF Report
….
… Figure 4.
?>
This is has most secure. If you worry somebody 2.3. Is it application having good accessibility ?
change parameter on browser and may effect to your How fast it to find data using search engine facility
database. ? How fast your application ? It’s most the important
one, if you want to build an application web base.
e. About Cookies
The problem, while use cookies. Hijacking cookie a. Fast while accessing the web page.
(S’to, 2004). If some body know your cookies code at On this cases, be sure to minimize using query
another computer and set this code at their computer command at every page. If necessary don’t use query
by Opera browser, automaticly they has login as your anymore. I mean, be sure that every page would be
account. access by visitor has be a HTML file. So when does the
So, for cekses.php need additional function to application should execute query database ? The
check user IP and User Agent. If these attributes not solution is : Query should be done after saving data.
same while user log on, the system need to reject And don’t forget to save the result as html file.
access for user.
Algorithm :
input data
2.2. Is it application user friendly or easy to use? click submit
On every page accessed, need some instructions save data to database by insert command
to help the user step by step how to run the application. do query command to read database and generated
information page as html file.
Help instructions to find data.
How to save data as html or as php file?
<?php
//genfile.php
$sv=”
<?php
\$harga = 100;
\$jumlah = 20; \$tot = \$harga*\$jumlah;
Echo \“Total :\“.\$tot;
Figure 3. ?>”;
$namafile="coba.php";
if (file_exists($namafile)) {
unlink($namafile);
}
$handle= fopen($namafile,'a');
fputs($handle, $sv);
?>
include "db.inc.php";
$sql= "select npm,nama,jurusan,
ta,kelas,tanggal,jumlah,terbilang,nomor_kwi,opr from
kwitansi_bayaran where npm='$vnpm' and
tanggal='$gtanggal'";
if (!$res=mysql_query($sql,$dbh)) {
echo mysql_error();
exit;
}
if ($row=mysql_fetch_row($res)) {
$vnpm = $row[0];
Figure 5. $vnama = $row[1];
$vjurusan = $row[2];
2.4 Is it application can generated a good report ? $vta = $row[3];
In PHP we can generated a report to PDF using $vtanggal = $row[5];
Class. There are two file class needed, to run report. $vjumlah = $row[6];
The file is class.ezpdf.php and class.Cpdf.php. Both $vterbilang = $row[7];
file, you can download it in $vnomor_kwi = $row[8];
www.sinergypro.com/murdan/class.zip. Example : How $vopr = $row[9];
to print Acquittance for student and Payment Report ? }
/////
include "db.inc.php";
$sql= "select \$pdf->addText(200,\$brs,14,'<b>TANDA
kode_pembayaran,jenis_pembayaran,keter,jumlah,sks PENERIMAAN</b>');
from tr_bayaran where npm='$vnpm' and \$all = \$pdf->openObject();
tanggal='$vtanggal' order by kode_pembayaran"; \$pdf->saveState();
if (!$res=mysql_query($sql,$dbh)) { \$pdf->restoreState();
echo mysql_error(); exit; } \$pdf->closeObject();
$n=0; $tjumlah = 0; \$pdf->addObject(\$all,'all');
while ($row=mysql_fetch_row($res)) { \$brs=\$brs-12;
$n++; \$pdf->ezSetDy(-60);
$xkode_pembayaran[$n] = $row[0]; \$data = array($sude);
$xjenis_pembayaran[$n] = $row[1]; \$cols = array('Kode'=>'Kode','Jenis
$xketer[$n] = $row[2]; Pembayaran'=>'Jenis
$xjumlah[$n] = $row[3]; Pembayaran','Jumlah'=>'Jumlah');
$xsks[$n] = $row[4]; \$pdf->ezTable(\$data,\$cols,'',
$tjumlah = $tjumlah+$xjumlah[$n]; array('xPos'=>110,'xOrientation'=>'right','','cols'=>array(
} 'Kode'=>array('width'=>45,'justification'=>'center'),
'Jenis Pembayaran'=>array('width'=>260),
$koma_vjumlah = "".number_format($tjumlah,0,'.',','); 'Jumlah'=>array('width'=>65,'justification'=>'right')
///// )));
\$pdf->ezSetDy(-14);
//$sude="array('Kode'=>'','Jenis \$pdf->ezText('Terbilang : <b>$vterbilang</b>',12);
Pembayaran'=>'','Jumlah'=>''),"; \$pdf->ezSetDy(-14);
$i = 0; \$pdf->ezText('Nama : <b>$vnama</b>',9);
while ($i<$n) { \$pdf->ezSetDy(-6);
$i++; \$pdf->ezText('NPM : <b>$vnpm</b>',9);
$fiel1 = $xkode_pembayaran[$i]; \$pdf->ezSetDy(-6);
$keterangan=""; \$pdf->ezText('Jurusan : <b>$vjurusan</b>',9);
if ($xketer[$i]) { \$pdf->ezSetDy(-6);
$keterangan=" $xketer[$i]"; \$pdf->ezText('Kelas : <b>$vkelas</b>',9);
} \$pdf->ezSetDy(50);
$fiel2 = $xjenis_pembayaran[$i].$keterangan; \$pdf->ezText('Tanggal <b>$vtanggal</b>',9);
$fiel3 = $xjumlah[$i]; \$pdf->ezSetDy(-6);
$c_fiel3 = "".number_format($fiel3,0,'.',','); \$pdf->ezText('Yang Menerima',9);
$sude=$sude. "array('Kode'=>'$fiel1','Jenis \$pdf->ezSetDy(-6);
Pembayaran'=>'$fiel2','Jumlah'=>'$c_fiel3'),"; \$pdf->ezText(' ',9);
} \$pdf->ezSetDy(-6);
$sude=$sude. "array('Kode'=>'','Jenis \$pdf->ezText(' <b>$vopr</b>',9);
Pembayaran'=>'Total:','Jumlah'=>'<b>$koma_vjumlah< ?>
/b>')"; ";
$namafile="cetak/kwi.php";
$sude="<?php if (file_exists($namafile)) {
\$brs=807; unlink($namafile);
\$pdf->addText(400,\$brs,9,' NOMOR'); }
\$brs=\$brs-12; $handle= fopen($namafile,'a');
\$pdf->addText(400,\$brs,9,'KWITANSI'); fputs($handle, $sude);
\$brs=\$brs-12; unset($sude);
\$pdf->addText(400,\$brs,12,' <b>$vnomor_kwi</b>'); echo
\$pdf- "<script>location.href='gene_report.php?namafile=$na
>addJpegFromFile('images/stiemp.jpg',90,780,50); mafile'</script>";
\$brs=810; exit;
\$pdf->addText(146,\$brs,15,'<b>STIE MULIA ?>
PRATAMA</b>');
\$brs=\$brs-12; Script gene_report.php:
\$pdf->addText(146,\$brs,9,'Program Sarjana Strata 1 <?php
(S1)'); //gene_report.php
\$brs=\$brs-11; include getcwd().'/class.ezpdf.php';
\$pdf->addText(146,\$brs,9,'Program Studi o $pdf =& new Cezpdf("a4");
Manajemen o Akuntansi'); $pdf->selectFont(getcwd().'/fonts/Helvetica.afm');
\$brs=\$brs-26; $pdf->openHere('Fit');
$pdf -> ezSetMargins(30,40,20,20);
$c_tjumlah = "".number_format($tjumlah,0,'.',',');
include "kwi.php"; $sude=$sude."array('TANGGAL'=>'$fiel2','NPM'=>'
$pdf->ezStream(); $fiel1','KODE PEMBAYARAN'=>'$fiel3', 'JENIS
?> PEMBAYARAN'=>'$fiel4','SKS'=>'$fiel5','JUMLAH'=
>'$c_fiel6','NO. KWITANSI'=>'$fiel7'),\n";
}
$sude=$sude."array('TANGGAL'=>'','NPM'=>'','KODE
PEMBAYARAN'=>'','JENIS
PEMBAYARAN'=>'<b>Total:</b>','SKS'=>'','JUMLAH'=
>'<b>$c_tjumlah</b>','NO. KWITANSI'=>'')\n";
\$brs=807;
Figure 7. \$pdf-
>addJpegFromFile('images/stiemp.jpg',55,780,50);
To print Payment Report: \$brs=811;
//gener_pembayaran.php?bt=08.2009 \$pdf->addText(120,\$brs,15,'<b>STIE MULIA
<?php PRATAMA</b>');
//gener_daftar_bayaran.php?bt= \$brs=\$brs-12;
$bt=$_GET["bt"]; \$pdf->addText(120,\$brs,8,'Program Sarjana Strata 1
(S1)');
\$brs=\$brs-11;
include "db.inc.php"; \$pdf->addText(120,\$brs,8,'Program Studi o
$sql="select Manajemen o Akuntansi');
npm,tanggal,kode_pembayaran,jenis_pembayaran,kete \$brs=\$brs-36;
r,sks,jumlah,nomor_kwi,opr from tr_bayaran where \$pdf->addText(180,\$brs,14,'<b>DAFTAR
right(tanggal,7)='$bt'order by nomor_kwi PEMBAYARAN $bt</b>');
DESC,kode_pembayaran"; \$all = \$pdf->openObject();
if (!$res=mysql_query($sql,$dbh)) { echo \$pdf->saveState();
mysql_error(); exit; } \$pdf->restoreState();
\$pdf->closeObject();
$z=0; \$pdf->addObject(\$all,'all');
while ($row=mysql_fetch_row($res)) { \$brs=\$brs-12;
$z++; \$pdf->ezSetDy(-80);
$vnpm[$z] = $row[0]; \$data = array($sude);
$vtanggal[$z] = $row[1]; \$cols =
$vkode_pembayaran[$z] = $row[2]; array('TANGGAL'=>'TANGGAL','NPM'=>'NPM','KODE
$vjenis_pembayaran[$z] = $row[3]; PEMBAYARAN'=>'KODE PEMBAYARAN', 'JENIS
$vsks[$z] = $row[5]; PEMBAYARAN'=>'JENIS PEMBAYARAN',
$vjumlah[$z] = $row[6]; 'SKS'=>'SKS','JUMLAH'=>'JUMLAH','NO.
$vnomor_kwi[$z] = $row[7]; KWITANSI'=>'NO. KWITANSI');
//echo "$vnpm[$z]<br>"; \$pdf->ezTable(\$data,\$cols,'',
} array('xPos'=>55,'xOrientation'=>'right','','cols'=>array(
'TANGGAL'=>array('width'=>70,'justification'=>'left'),
$i = 0; 'NPM'=>array('width'=>50,'justification'=>'left'),
while ($i<$z) { 'KODE
$i++; PEMBAYARAN'=>array('width'=>80,'justification'=>'left'
$fiel1 = $vnpm[$i]; ),
$fiel2 = $vtanggal[$i]; 'JENIS
$fiel3 = $vkode_pembayaran[$i]; PEMBAYARAN'=>array('width'=>130,'justification'=>'lef
$fiel4 = $vjenis_pembayaran[$i]; t'),
$fiel5 = $vsks[$i]; 'SKS'=>array('width'=>38,'justification'=>'right'),
$fiel6 = $vjumlah[$i]; 'JUMLAH'=>array('width'=>68,'justification'=>'right'),
$fiel7 = $vnomor_kwi[$i]; 'NO.
$tjumlah = $tjumlah + $fiel6; KWITANSI'=>array('width'=>75,'justification'=>'left')
$c_fiel6 = "".number_format($fiel6,0,'.',','); )));
References
?> A. Good, Nathan. 2008. Seven habits for writing secure
"; PHP applications.
$namafile="daftar_bayaran.php"; http://www.ibm.com/developerworks/opensource/lib
if (file_exists($namafile)) { rary/os-php-secure-apps/index.html (Access 15
unlink($namafile); October, 2009).
}
$handle= fopen($namafile,'a'); Hakim, Lukmanul. 2008. Membongkar Trik Raksasa
fputs($handle, $sude); para Master PHP. Jakarta : Lokomedia.
echo
"<script>location.href='gene_daftar_bayaran.php'</scri Peranginangin, Kasiman. 2006. Aplikasi Web dengan
pt>"; PHP dan MySql. Yogyakarta : Andi Publisher.
exit;
?> Rahmat, Putra. 2009. Panduan Lengkap Hacking PC.
Jakarta : Kawan Pustaka.
Script gene_daftar_bayaran.php:
<?php Ricky, Anselmus. 2009. On The Spot Hacking. Jakarta :
//gene_daftar_bayaran.php PT. Elex Media Komputindo.
include getcwd().'/class.ezpdf.php';
$pdf =& new Cezpdf("a4"); Sartain, Julie, 2007, Tips For Better Security &
$pdf->selectFont(getcwd().'/fonts/Helvetica.afm'); Compliance.
$pdf->openHere('Fit'); http://www.processor.com/articles/PDFMagazine/G
$pdf -> ezSetMargins(30,40,20,20); ood/P___2913.PDF?GUID= (Access 15 October,
include "daftar_bayaran.php"; 2009).
$pdf->ezStream();
?> S’to. 2009. CEH Certified Ethical Hacker 100% Illegal.
Conclusion Jakarta: Jasakom.
There are four focus to developt a web application :
1. Application must be secure. Thalib, Abdul. 2003. Keamanan pada Aplikasi Web
a. User must be using strong Password dengan PHP.
b. Secure while login (push off SQL Injection) and http://www.cert.or.id/~budi/courses/ec7010/dikmen
c. Check IP and User Agent. ur/thalib-report.pdf (Access 15 October, 2009).
d. Secure while Update Data.
Only the user who was login can update data. W. Purbo, Onno & Akhmad Daniel S. 2005.
Every doing update, need to log some Membangun Web e-commerce. Jakarta : PT. Elex
information such as username, date and time, Media Komputindo.
username, and what data has changed.
To optimal your application security, you can
protect each your page with this script:
<?php
Include “cekses.php”;
If (!$userOK) {
Echo “You are not Authorize!”;
Exit;
}
?>
For Additional , the application need also having
backup system, because data is critical assets
(Sartain, 2007).
2. Application must be user friendly and easy to use.
Need Help File showing at every page (Give
instruction step by step for user)
3. Application must be fast.
a. Fast searching data (minimize table and use
index).
b. Fast query and showing data (use index).
4. Application must be can generated Good Report
Use ClassPDF