install.php ? KESIMPULAN DAN SARAN
L-80
Universitas Kristen Maranatha
ws .= -- end user cp content --td trtable;
} }else {
iffile_existsadmin . _GET[pilih] . .php isset _GET[mod]{
include adminpilih.php; }elseif file_existsmod . _GET[pilih] . .php isset
_GET[mod]{ include modpilih.php;
} else {
ws .= Welcome to Administration Peter Vannes Websites; }
} ws .= admin;
fotter = nl2br bukafile txtfooter.txt; load = str_replace {browser}, , fotter;
load = str_replace {online}, , load; load = str_replace {time}, Execute time . timer-stop .
Detik, load; hasil akhir
define = array header = ws, isi = ,
tanggal = tanggal GLOBALS[timeplus], fotter = load,
script = SCRIPT ;
tpl = new template themesadminadmin.html; tpl- define_tagdefine;
tpl-cetak; ?
1.12 install.php ?
raw = phpversion; listv_Upper,v_Major,v_Minor = explode.,raw;
if v_Upper == 4 v_Major 1 || v_Upper 4 { _FILES = HTTP_POST_FILES;
_ENV = HTTP_ENV_VARS; _GET = HTTP_GET_VARS;
_POST = HTTP_POST_VARS; _COOKIE = HTTP_COOKIE_VARS;
_SERVER = HTTP_SERVER_VARS; _SESSION = HTTP_SESSION_VARS;
_FILES = HTTP_POST_FILES; }
if ini_getregister_globals { whilelistkey,value=each_FILES GLOBALS[key]=value;
whilelistkey,value=each_ENV GLOBALS[key]=value; whilelistkey,value=each_GET GLOBALS[key]=value;
whilelistkey,value=each_POST GLOBALS[key]=value; whilelistkey,value=each_COOKIE GLOBALS[key]=value;
whilelistkey,value=each_SERVER GLOBALS[key]=value; whilelistkey,value=each_SESSION GLOBALS[key]=value;
foreach_FILES as key = value{ GLOBALS[key]=_FILES[key][tmp_name];
foreachvalue as ext = value2{
L-81
Universitas Kristen Maranatha
key2 = key . _ . ext; GLOBALS[key2] = value2;
} }
} cetak .=
html head
titleDump mysql :: Database ::title style
BODY {
FONT-SIZE: 10px; FONT-FAMILY: Verdana, Helvetica; TEXT- DECORATION: none
} TD {
FONT-SIZE: 10px; FONT-FAMILY: Verdana, Helvetica }
TH { FONT-SIZE: 10px; FONT-FAMILY: Verdana, Helvetica
} P {
FONT-SIZE: 10px; FONT-FAMILY: Verdana,Helvetica }
SPAN { FONT-SIZE: 10px; FONT-FAMILY: Verdana,Helvetica
} DIV {
FONT-SIZE: 11px; FONT-FAMILY: Verdana,Helvetica }
INPUT { BORDER-TOP-WIDTH: 1px; BORDER-LEFT-WIDTH: 1px; FONT-SIZE: 10px;
BORDER-LEFT-COLOR: 000000; BORDER-BOTTOM-WIDTH: 1px; BORDER-BOTTOM- COLOR: 000000; BORDER-TOP-COLOR: 000000; FONT-FAMILY:
Verdana,Helvetica; BORDER-RIGHT-WIDTH: 1px; BORDER-RIGHT-COLOR: 000000 }
TEXTAREA {
BORDER-TOP-WIDTH: 1px; BORDER-LEFT-WIDTH: 1px; FONT-SIZE: 10px; BORDER-LEFT-COLOR: 000000; BORDER-BOTTOM-WIDTH: 1px; BORDER-BOTTOM-
COLOR: 000000; BORDER-TOP-COLOR: 000000; FONT-FAMILY: Verdana,Helvetica; BORDER-RIGHT-WIDTH: 1px; BORDER-RIGHT-COLOR: 000000
} SELECT {
BORDER-TOP-WIDTH: 1px; BORDER-LEFT-WIDTH: 1px; FONT-SIZE: 10px; BORDER-LEFT-COLOR: 000000; BORDER-BOTTOM-WIDTH: 1px; BORDER-BOTTOM-
COLOR: 000000; BORDER-TOP-COLOR: 000000; FONT-FAMILY: Verdana,Helvetica; BORDER-RIGHT-WIDTH: 1px; BORDER-RIGHT-COLOR: 000000
} FORM {
FONT-SIZE: 10px; FONT-FAMILY: Verdana,Helvetica }
style head
body ;
function remove_commentsoutput {
lines = explode\n, output; output = ;
try to keep mem. use down linecount = countlines;
in_comment = false; fori = 0; i linecount; i++ {
if preg_match\\, preg_quotelines[i] { in_comment = true;
L-82
Universitas Kristen Maranatha
} if in_comment {
output .= lines[i] . \n; }
if preg_match\\, preg_quotelines[i] { in_comment = false;
} }
unsetlines; return output;
} remove_remarks will strip the sql comment lines out of an uploaded sql
file function remove_remarkssql
{ lines = explode\n, sql;
try to keep mem. use down sql = ;
linecount = countlines; output = ;
for i = 0; i linecount; i++ { if i = linecount - 1 || strlenlines[i] 0 {
if lines[i][0] = { output .= lines[i] . \n;
} else { output .= \n;
} Trading a bit of speed for lower mem. use here.
lines[i] = ; }
} return output;
} split_sql_file will split an uploaded sql file into single sql
statements. Note: expects trim to have already been run on sql.
function split_sql_filesql, delimiter {
Split up our string into possible SQL statements. tokens = explodedelimiter, sql;
try to save mem. sql = ;
output = array; we dont actually care about the matches preg gives us.
matches = array; this is faster than calling countoktens every time thru the
loop. token_count = counttokens;
for i = 0; i token_count; i++ { Dont wanna add an empty string as the last thing in the
array. if i = token_count - 1 || strlentokens[i] 0 {
This is the total number of single quotes in the token. total_quotes = preg_match_all, tokens[i], matches;
Counts single quotes that are preceded by an odd number of backslashes,
which means theyre escaped quotes. escaped_quotes
= preg_match_all?\\\\\\\\\\\\\\\\, tokens[i], matches;
unescaped_quotes = total_quotes - escaped_quotes; If the number of unescaped quotes is even, then the
delimiter did NOT occur inside a string literal. if unescaped_quotes 2 == 0 {
L-83
Universitas Kristen Maranatha
Its a complete sql statement. output[] = tokens[i];
save memory. tokens[i] = ;
} else { incomplete sql statement. keep adding tokens until we
have a complete one. temp will hold what we have so far.
temp = tokens[i] . delimiter; save memory..
tokens[i] = ; Do we have a complete statement yet?
complete_stmt = false; for j = i + 1; complete_stmt j
token_count; j++ { This is the total number of single quotes in the
token. total_quotes = preg_match_all, tokens[j],
matches; Counts single quotes that are preceded by an odd
number of backslashes, which means theyre escaped quotes.
escaped_quotes
= preg_match_all?\\\\\\\\\\\\\\\\, tokens[j], matches;
unescaped_quotes = total_quotes - escaped_quotes; if unescaped_quotes 2 == 1 {
odd number of unescaped quotes. In combination with the previous incomplete
statements, we now have a complete statement. 2 odds always make an even
output[] = temp . tokens[j]; save memory.
tokens[j] = ; temp = ;
exit the loop. complete_stmt = true;
make sure the outer loop continues at the right point.
i = j; } else {
even number of unescaped quotes. We still dont have a complete statement.
1 odd and 1 even always make an odd temp .= tokens[j] . delimiter;
save memory. tokens[j] = ;
} } for..
} else }
} return output;
} function bukafilefilename{
fp = fopenfilename, r; sizeof = filesizefilename == 0 ? 1 : filesizefilename;
return freadfp, sizeof; fclosefp;
} if isset submit{
mysql_connecthost, username, password or die Koneksi ke MySQL gagal;
mysql_select_dbdbname;
L-84
Universitas Kristen Maranatha
output = bukafile file; echo remove_commentsoutput;
output = remove_remarksoutput; data = split_sql_fileoutput, ;;
for i=0; icountdata; i++{ data[i] = str_replace prefixdatasql_,_POST[prefix],data[i];
q = mysql_query data[i];
echo data[i]; if q {cetak .= h3Berhasil Dump SQLh3 . data[i] . br;}
else { cetak .= h3Gagal Dump SQLh3 . data[i] . br; }
} cetak .=Berhasil dump file;
} cetak .=
form method=post action= table border=0 cellpadding=3 style=border-collapse: collapse
bordercolor=111111 width=100 tr
td width=26Hosttd td width=2:td
td width=72input type=text name=host size=29td tr
tr td width=26Usernametd
td width=2:td td width=72input type=text name=username size=29td
tr tr
td width=26Passwordtd td width=2:td
td
width=72input type=password
name=password size=29td
tr tr
td width=26Database nametd td width=2:td
td width=72input type=text name=dbname size=29td tr
tr td width=26Prefixtd
td width=2:td td
width=72input type=text
name=prefix size=29
value=data_td tr
tr td width=26File sql to dumptd
td width=2:td td width=72select size=1 name=file
option selected------option ;
option selected------option arr = glob.sql;
if is_array arr{ foreach arr as filename {
echo filename size . filesizefilename . \n; cetak .=option value=filenamefilenameoption;
} }
cetak .= selecttd
tr tr
L-85
Universitas Kristen Maranatha
td width=26nbsp;td td width=2nbsp;td
td width=72nbsp;td tr
tr td width=26nbsp;td
td width=2nbsp;td td
width=72input type=submit
value=Submit name=submittd
tr table
form body
html ;
cetak .= pp font color=redKeterangan :
brbr silahkan dump file sql anda
brsetelah itu edit files config.php di folder includesconfig.phpbr parameter yang bisa diedit :
brbr ---- konfigurasi untuk databasebr
dbs[\host\][\1\]=localhost;br dbs[\user\][\1\]=root;br
dbs[\password\][\1\]=;br dbs[\dbname\][\1\]=data;br
brbr tabel untuk data basebr
tab_prefix = \kudel_\; font
; echo cetak;
? 1.132.13 login.php
?php my weblogs
version 1.0 Author : Peter Vannes
Email : peter_fuyahoo.com Last Modified : May 6, 2007 03:07:22 PM
session_nameLog; session_start;
if _GET[aksi] == logout{ session_destroy ;
} include includestemplate.php;
include includesconfig.php; include includesfungsi.php;
timer = new microTimer; timer-start;
SQL = new SQL; ws =h2Login Administrationh2;
if isset _POST[submit]{
include includeslogin.auth.lib.php; GLOBALS[rahasia_password]
username = _POST[username]; password = peter_encrypt_POST[password],
GLOBALS[rahasia_password];
L-86
Universitas Kristen Maranatha
timer = new microTimer; timer-start;
SQL-connect1; query = mysql_querySELECT FROM .GLOBALS[tabel][users]. WHERE
username=username AND password=password AND status=1; SQL-close;
data = mysql_fetch_arrayquery; USERNAME = data[username];
PASSWORD = data[password]; lastlogin=data[lastlogin];
Email = data[email]; times_login = data[timelogin];
querytook = timer-stop; if username == USERNAME AND password == PASSWORD AND
emptypassword AND emptyusername {
jam
= dateH:i:s;
mnt =
dateh; SPASS
=md5PASSWORD; session_registerSES_USERNAME;
session_registerSES_PASSWORD; session_registerLASTLOGIN;
session_registerSES_EMAIL; session_registerSES_TYPE;
session_registerSES_PRIV; session_registerSES_THEME_CAL;
session_registerSES_TIME_LIMIT; session_registerTOOK;
TOOK = querytook; SES_TIME_LIMIT = time + GLOBALS[timeplus] + times_login;
SES_THEME_CAL = data[theme]; SES_USERNAME = USERNAME;
SES_PASSWORD = SPASS;
LASTLOGIN =lastlogin; SES_EMAIL = Email;
SES_TYPE = data[type]; SES_PRIV = array ;
privs = explode , data[priv]; if is_array privs{
foreach privs as key=val{ SES_PRIV[] = val;
} }
loginter =_SERVER[REMOTE_ADDR] .|. time + GLOBALS[timeplus]; SQL-connect1;
query = mysql_queryUPDATE .GLOBALS[tabel][users]. SET lastlogin=loginter WHERE username=username;
SQL-close; header location:admin.php;
} else{
ws .= font color=redPassword anda salahfont; }
} ws .=
form method=post action= name=login table border=0 cellpadding=2 cellspacing=1 style=border-collapse:
collapse bordercolor=111111 width=100 tr
td width=29Usernametd td width=2:td
td width=69input type=text name=username size=20td tr
tr
L-87
Universitas Kristen Maranatha
td width=29Passwordtd td width=2:td
td width=69input
type=password name=password
size=20td tr
tr td width=29nbsp;td
td width=2nbsp;td td width=69nbsp;td
tr tr
td width=29nbsp;td td width=2nbsp;td
td
width=69input type=hidden
value=Submit name=submitinput type=submit value=Submit name=B1td
tr table
form ;
fotter = nl2br bukafile txtfooter.txt; load = str_replace {time}, Execute time . timer-stop . Sec,
fotter; hasil akhir
define = array header = ws, isi = ,
tanggal = , fotter = load
; tpl = new template themesadminerror.html;
tpl- define_tagdefine; tpl- cetak;
? 1.14 online.php
? my weblogs
version 1.0 Author : Peter Vannes
Email : peter_fuyahoo.com file : index.php
Last Modified : May 6, 2007 03:07:22 PM include includesconfig.php;
include includestemplate.php; include includesfungsi.php;
timer = new microTimer; timer-start;
SQL = new SQL; SQL-connect 1;
include includesmenu.php; content
content = ; content .= -- content ................................. --
DIV id=content; content .= h2User Onlineh2;
content .= div class=normal_sekali; content .=style
L-88
Universitas Kristen Maranatha
.tabel { background-color: 999999; border: 0px d8d8c4 solid; } .blockmonthon {
font-weight: bold;
BACKGROUND-COLOR: efefef;cursor:hand
} .blockmonthoff {
BACKGROUND-COLOR: f6f6eb;
} style;
function navigasi { cetak =div align=center class=tiny;
cetak .= [ a href=\?view=now\Online Nowa ] |; cetak .= [ a href=\?view=day\Online This Daya ] |;
cetak .= [ a href=\?view=month\Online This Montha ]; cetak .=divp;
return cetak; }
function GetOnline tipe, pg, stg, offset{
if tipe == now{ tabel = 1;
judul = sekarang; view = now;
}elseif tipe == day{ tabel = 2;
judul = Hari Ini; view = day;
}else { tabel = 3;
judul = Bulan Ini;
view = month; }
cetak = table width=100 cellspacing=0 cellpadding=0trtd align=leftimg
src=imagesnama.gifnbsp;nbsp;.judul.tdtdnbsp;tdtrtabl e;
cetak .= table width=100 cellspacing=0 cellpadding=1 class=albumtrtd;
cetak .= table width=100 cellspacing=2 cellpadding=2 class=album1trtd;
cetak .= table width=100 border=0 cellspacing=1 cellpadding=2
tr class=albumtd width=30bVisitor IPbtdtd width=55bHostbtdtd width=15bLast
visitbtdtr; was = mysql_query SELECT id FROM .GLOBALS[tabel][online]. WHERE
type=tabel; jumlah = mysql_num_rows was;
if emptyoffset and isset offset { offset = 0;
} limit = 20;
a = new paging limit; rs=mysql_queryselect from .GLOBALS[tabel][online]. WHERE
type=tabel ORDER BY timevisit DESC LIMIT offset, limit; while ro=mysql_fetch_arrayrs{
IP_V = ro[visitor]; md5 = ro[mdhash];
Pecahan = explode |, IP_V; cetak .= tr bgcolor=efefef
onmouseover=\this.style.backgroundColor=CCFFCC;\ onmouseout=\this.style.backgroundColor=;\ style=\cursor:hand\
title=.transCAL ro[timevisit], true. Ip Address : Pecahan[1]
L-89
Universitas Kristen Maranatha
Ip Proxy : Pecahan[0] Host : Pecahan[2]
Proxy : Pecahan[3] ro[info]
onclick=\javascript:location.href=?view=detailid=ro[id];\td width=30.Pecahan[0].tdtd width=55.limitTXT
Pecahan[2],45.tdtd width=15.dateH:i,ro[timevisit].tdtr;
} cetak .= table;
cetak .= table; cetak.= tdtrtable;
cetak.= a- getPagingjumlah, pg, stg; return cetak;
} function Getdetail id{
id = int_filter id; rs=mysql_queryselect from .GLOBALS[tabel][online]. WHERE
id=id; ro=mysql_fetch_arrayrs;
if mysql_num_rows rs 0{ IP_V = ro[visitor];
md5 = ro[mdhash]; Pecahan = explode |, IP_V;
halaman = array ;
halaman = explode , ro[halaman]; halaman_2 = ;
foreach halaman as k=v{ halaman_2 .= v . br;
} cetak = pnbsp;p;
cetak .= table border=0 cellspacing=1 width=100 tr
td width=25bWaktu kunjunganbtd td width=2:td
td width=73.transCAL ro[timevisit], true.td tr
tr td width=25bIp Addressbtd
td width=2:td td width=73Pecahan[1]td
tr tr
td width=25bIp Proxybtd td width=2:td
td width=73Pecahan[0]td tr
tr td width=25bHost btd
td width=2:td td width=73Pecahan[2]td
tr tr
td width=25bProxybtd td width=2:td
td width=73Pecahan[3]td tr
tr td width=25bOperation Sistembtd
td width=2:td td width=73 . GetOs ro[info] . td
tr tr
td width=25bBrowserbtd
L-90
Universitas Kristen Maranatha
td width=2:td td width=73 . GetBrowser ro[info] . td
tr tr
td width=25 valign=topbHalaman btd td width=2 valign=top:td
td width=73 valign=tophalaman_2td tr
table; return cetak;
}else { return Tidak ada;
} }
if isset pg,stg,offset{ pg = 1;
stg = 1; offset = 0;
} content .= navigasi;
if isset view{view = ;} switchview {
case now: content .= GetOnline now, pg, stg, offset;
break; case detail:
content .= Getdetail id; break;
case day: content .= GetOnline day, pg, stg, offset;
break; case month:
content .= GetOnline month, pg, stg, offset; break;
default: content .= GetOnline now, pg, stg, offset;
break; }
content .= div; content .= DIV-- content --;
define = array menu = menu,
content = content, navigasi
= navigasi,
online = link_online , title = GLOBALS[title],
tanggal = tanggal GLOBALS[timeplus], exec = Execute time . timer-stop
. Sec ; SQL-close;
tpl = new template GLOBALS[themes][index]; tpl- define_tagdefine;
tpl- cetak; ?
3.1 about.php ?