File koneksi.php File smarty.php File ExportToExcel.class.php

L - 4 tb_circuit=circuit; tb_router=router; view per halaman page_news=5; page_atm=10; page_cabang=10; array error error = array Login Error A01 = Password Salah, A02 = Login Gagal, A03 = Hak Anda Tidak Cukup, Admin Error B01 = Kota Gagal Disimpan, B02 = Kota Gagal Diupdate, B03 = Kota Gagal Dihapus, B04 = Hak Gagal Disimpan, B05 = Hak Gagal Diupdate, B06 = Hak Gagal Dihapus, B07 = User Gagal Disimpan, B08 = User Gagal Diupdate, B09 = User Gagal Dihapus, B10 = System Gagal Disimpan, B11 = System Gagal Diupdate, B12 = System Gagal Dihapus, B13 = Modem Gagal Disimpan, B14 = Modem Gagal Diupdate, B15 = Modem Gagal Dihapus, B16 = Type Router Gagal Disimpan, B17 = Type Router Gagal Diupdate, B18 = Type Router Gagal Dihapus, Profile Error C01 = Profile Gagal Diupdate, News Error D01 = News Gagal Disimpan, D02 = News Gagal Diupdate, D03 = News Gagal Dihapus, ATM Error E01 = ATM Gagal Disimpan, E02 = ATM Gagal Diupdate, E03 = ATM Gagal Dihapus, E04 = Media ATM Gagal Disimpan, E05 = Media ATM Gagal Diupdate, E06 = Media ATM Gagal Dihapus, Cabang Error F01 = Cabang Gagal Disimpan, F02 = Cabang Gagal Diupdate, F03 = Cabang Gagal Dihapus, F04 = Media Mainlink Gagal Disimpan, F05 = Media Mainlink Gagal Diupdate, F06 = Media Mainlink Gagal Dihapus, F07 = Media Backuplink Gagal Disimpan, F08 = Media Backuplink Gagal Diupdate, F09 = Circuit Gagal Disimpan, F10 = Circuit Gagal Diupdate, F11 = Circuit Gagal Dihapus, F12 = Router Gagal Disimpan, F13 = Router Gagal Diupdate, F14 = Router Gagal Dihapus, Lain2 Z01 = Other Error ; ?

3. File koneksi.php

File ini mendifinisikan koneksi ke database MySQL. Script file koneksi.php adalah sebagai berikut. L - 5 ?php name : koneksi.php mulai : selasa, 8 jan 2008 copyright : sigit riyanto email : sigit.rcsmcom.com project : Web Database Jaringan NCS Niaga connect to database dbconnect = mysql_connectdbhost, dbuser, dbpass; if dbconnect { headerlocation: offline.php?em=Error+Koneksi+Ke+MySQL; die; } dbselect = mysql_select_dbdbname; if dbselect { headerlocation: offline.php?em=Error+Memilih+Database; die; } ?

4. File smarty.php

Berfungsi untuk me-load fungsi smarty template engine. Script file smarty.php adalah sebagai berikut. ?php name : smarty.php no direct access if eregismarty.php, _SERVER[PHP_SELF] { headerlocation: ..offline.php?em=Hacking+Attemp; die; } if file_existslibsSmarty.class.php { headerlocation: offline.php?em=Error+Load+Template; die; } else { include_oncelibsSmarty.class.php; } smarty= new Smarty; smarty-debugging = TRUE; smarty-template_dir=templates; smarty-assigntemplates,smarty-template_dir; smarty-register_functionstopwatch, stopwatch, false; assign time now=datej F Y, H:i:s; smarty-assignnow,now; time smarty-assignem,em; error smarty-assignuserdata,userdata; userdata ?

5. File ExportToExcel.class.php

Berfungsi untuk me-load fungsi excel agar record dapat di simpan dalam bentuk file excel .xls. Script file ExportToExcel.class.php adalah sebagai berikut. L - 6 ?php Author: Raju Mazumder email:rajuniitgmail.com Class:A simple class to export mysql query and whole html and php page to excel,doc etc class ExportToExcel { function exportWithPagephp_page,excel_file_name { this-setHeaderexcel_file_name; require_once php_page; } function setHeaderexcel_file_namethis function used to set the header variable { headerContent-type: applicationoctet-stream;A MIME attachment with the content type applicationoctet-stream is a binary file. Typically, it will be an application or a document that must be opened in an application, such as a spreadsheet or word processor. headerContent-Disposition: attachment; filename=excel_file_name;with this extension of file name you tell what kind of file it is. headerPragma: no-cache;Prevent Caching headerExpires: 0;Expires and 0 mean that the browser will not cache the page on your hard drive } function exportWithQueryqry,excel_file_name,connto export with query { tmprst=mysql_queryqry,conn; header=centertable border=1pxthPersonal Detailsth; num_field=mysql_num_fieldstmprst; whilerow=mysql_fetch_arraytmprst,MYSQL_BOTH { body.=tr; fori=0;inum_field;i++ { body.=td.row[i].td; } body.=tr; } this-setHeaderexcel_file_name; echo header.body.table; } } ? L - 7

B. File Utama