admin_users.php ?php
L-72
Universitas Kristen Maranatha
SQL_QUERY[] =
sintak; admin .= sintak . ; br;
} }
ref =
_POST[http_referer]; admin .= input type=hidden name=http_referer
value=.ref.; admin .= brbrinput type=submit name=submit value= YA
nbsp;nbsp;nbsp;input type=submit name=cancel value= Tidak ;
admin .= form; }
} if _GET[aksi] == delete_ok{
if isset _POST[cancel]{ session_unregister
SQL_QUERY; header location:._POST[http_referer].;
exit; }
if isset _POST[submit]{ if
is_array _SESSION[SQL_QUERY]{
session_register pesan_update;
pesan_update = array ; foreach _SESSION[SQL_QUERY] as k=v{
quer =
mysql_query v;
if quer{
pesan_update[] =
lifont color=redvfontli;
}else {
pesan_update[] = lifont color=redGAGAL fontli;
} }
header location:._POST[http_referer].;
exit; }
} }
if _GET[aksi] == truncate{ if isset _POST[submit]{
query = mysql_query TRUNCATE TABLE `._POST[table].`; if query {
ref = _SERVER[HTTP_REFERER]; header location:ref;
exit; }
} admin .= brfont color=redApakah anda ingin mengkosongkan tabel
b.cleanTEXT_GET[table].bfontbrbr; admin .= form method=POST action=;
admin .= input type=hidden name=table value=.cleanTEXT_GET[table].;
admin .= input type=submit value= YA name=submit; admin .= form;
} ?
1.10 admin_users.php ?php
my weblogs version 1.0
Author : Peter Vannes Email : peter_fuyahoo.com
L-73
Universitas Kristen Maranatha
File : navigasi.php
Last Modified : May 16, 2007 03:07:22 PM defined peter or die Direct Access to this location is not
allowed. ; if _SESSION[SES_PRIV][0] == all{
ssssssssssssssss = ok; }
elseifin_array basename__FILE__, _SESSION[SES_PRIV], true{ die Direct Access to this location is not allowed. ;
} if SES_TYPE == 0{
header location:admin.php; exit;
} include includeslogin.auth.lib.php;
SQL-connect1; filename = jsalert.txt;
fp = fopenfilename, r; admin.=
freadfp, filesizefilename;
fclosefp; if isset_GET[aksi] _GET[aksi] =;
admin .=h2Add Users h2; admin .= a href=?pilih=admin_usersHomea | a
href=?pilih=admin_usersaksi=addAdd Usera ; admin .=pnbsp;p;
if _GET[aksi] == delete{ hasilss = mysql_querySELECT FROM .GLOBALS[tabel][users].
WHERE id=id; data = mysql_fetch_array hasilss;
if data[username] = _SESSION[SES_USERNAME] data[type] = 1 {
hasil = mysql_queryDELETE FROM .GLOBALS[tabel][users]. WHERE id=id;
mysql_queryDELETE FROM .GLOBALS[tabel][calendar]. WHERE user=data[username];
} header location:?pilih=admin_users;
} if _GET[aksi] == edit{
hasilss = mysql_querySELECT FROM .GLOBALS[tabel][users]. WHERE id=id;
data = mysql_fetch_array hasilss; if data[username] = _SESSION[SES_USERNAME] data[type] = 1
{ if isset submit{
if is_array arr_priv{ foreach arr_priv as key=val{
priveleges .=
. val; }
} username,password,email,priv VALUES
username,password,email,priveleges password = peter_encryptpassword, GLOBALS[rahasia_password];
priveleges = substr priveleges, 1; cekuser = mysql_querySELECT FROM .GLOBALS[tabel][users].
WHERE username=username; if mysql_num_rowscekuser == 0{
hasil = mysql_queryUPDATE .GLOBALS[tabel][users]. SET username=username, password=password, email=email,
priv=priveleges WHERE id=id; }else {
L-74
Universitas Kristen Maranatha
hasil = mysql_queryUPDATE .GLOBALS[tabel][users]. SET password=password, email=email, priv=priveleges WHERE
id=id; }
header location:?pilih=admin_users; }else {
hasils = mysql_querySELECT FROM .GLOBALS[tabel][users]. WHERE id=id;
data = mysql_fetch_array hasils;
} data[password] = peter_decryptdata[password],
GLOBALS[rahasia_password]; admin .=
-- user cp content loaded here -- form action= method=post
div
style=text-align:center;background- color:EAE7E0;padding:3px;font-weight:bold;color:909590;Email amp;
Passworddiv table cellspacing=1 cellpadding=3 style=width:100
tr style=background-color:F0F0F0; td colspan=2For security reasons, please enter your current
password before continuing. Enter the new password if you want to change your password, otherwise leave the fields blank.td
tr tr style=background-color:FAFAFA;
tdUsername td tdinput
type=text name=username
value=data[username] maxlength=20td
tr tr style=background-color:F0F0F0;
tdNew Passwordtd tdinput
type=text name=password
value=data[password] maxlength=20td
tr style=background-color:FAFAFA; tdEmail Addresstd
tdinput type=text
name=email value=data[email]
maxlength=100 size=25td tr
tr style=background-color:F0F0F0; td valign=topPrivilegestd
td; databases = explode , data[priv];
ARR = globadmin.php; foreach ARR as key=filename {
foreach databases as finame{ if substr filename, 6 == finame{
admin .=
input type=\checkbox\
checked name=\arr_priv[]\ value=\.substr filename, 6.\.substr
filename, 12, -4.br; continue 2;
} }
admin .= input type=\checkbox\ name=\arr_priv[]\ value=\.substr filename, 6.\.substr filename, 12, -4.br;
} admin .=td
tr tr style=background-color:FAFAFA;
tdtd tdinput type=submit name=submit value=submit td
tr table
form
L-75
Universitas Kristen Maranatha
-- end user cp content -- ;
} }
if _GET[aksi] == add{
admin .= jav script type=textjavascript
function incrementfieldName {
document.getElementByIdfieldName.value++; }
all_checked = true; function checkallformName, boxName {
fori = 0; i document.getElementByIdformName.elements.length; i++
{ var formElement =
document.getElementByIdformName.elements[i]; ifformElement.type == checkbox formElement.name ==
boxName formElement.disabled == false {
formElement.checked =
all_checked; }
} all_checked = all_checked ? false : true;
} script
jav; if isset _POST[submit]{
if emptyusername{ hasil = mysql_querySELECT FROM .GLOBALS[tabel][users]. WHERE
username=username; data = mysql_fetch_arrayhasil;
if strtolowerusername == strtolowerdata[username]{ admin .=Username nya sudah ada;
} elseif password == password1{
admin .=Maaf Password Anda tidak sama; }else {
password = strtolowerpassword; password1 = strtolowerpassword1;
arr_priv = isset arr_priv ? arr_priv : array ; if password == password1 and emptyemail{
if is_array arr_priv{ priveleges = ;
foreach arr_priv as key=val{ priveleges .=
. val; }
} priveleges = isset priveleges ? substr priveleges, 1 : ;
password = peter_encryptpassword, GLOBALS[rahasia_password]; time_login = 3600;
hasil = mysql_queryINSERT INTO .GLOBALS[tabel][users]. username,password,email,priv,timelogin VALUES
username,password,email,priveleges,time_login; admin .=Account username sudah di add;
}else { admin .=Account username Gagal di add;
} }
}else { admin .=maaf Username tidak boleh kosong;
}
L-76
Universitas Kristen Maranatha
admin .=pnbsp;p; }
admin .= -- user cp content loaded here --
form action= method=post id=users div
style=text-align:center;background- color:EAE7E0;padding:3px;font-weight:bold;color:909590;Email amp;
Passworddiv table cellspacing=1 cellpadding=3 style=width:100
tr style=background-color:F0F0F0; td colspan=2For security reasons, please enter your current
password before continuing. Enter the new password if you want to change your password, otherwise leave the fields blank.td
tr tr style=background-color:FAFAFA;
tdUsername td tdinput
type=text name=username
value= maxlength=20td
tr tr style=background-color:F0F0F0;
tdNew Passwordtd tdinput
type=password name=password
value= maxlength=20td
tr tr style=background-color:F0F0F0;
tdConfirm Passwordtd tdinput
type=password name=password1
value= maxlength=20td
tr tr style=background-color:FAFAFA;
tdEmail Addresstd tdinput
type=text name=email
maxlength=100 size=25td
tr tr style=background-color:FAFAFA;
td valign=topPrivilegestd td;
ARR = globadmin.php; foreach ARR as key=filename {
admin
.= input
type=\checkbox\ name=\arr_priv[]\
value=\.substr filename, 6.\.substr filename, 12, -4.br; }
admin .= bra href=\javascript:checkallusers, arr_priv[]\ title=Select AllbCheck Allba;
admin .=td tr
tr style=background-color:FAFAFA; tdtd
tdinput type=submit name=submit value=submit td tr
table form
-- end user cp content -- ;
} if _GET[aksi] =={
if isset action[account]{ foreach userid as key=value{
hasil = mysql_queryUPDATE .GLOBALS[tabel][users]. SET status=userid[key] WHERE id=key;
} }
admin .=
L-77
Universitas Kristen Maranatha
form id=account action= method=post table style=width: 100
tr tdstrongIDstrongtd
tdstrongUsernamestrongtd tdstrongEmailstrongtd
tdstrongLast Loginstrongtd tdstrongStatusstrongtd
tr; numresult1 = mysql_querySELECT id FROM peter_users;
jmlrec = mysql_num_rowsnumresult1; if empty_GET[offset] and isset _GET[offset] {
offset = 0; }else {
offset = int_filter _GET[offset]; }
jml = 5; a = new paging jml;
hasil = mysql_querySELECT FROM .GLOBALS[tabel][users]. WHERE type=0 ORDER BY username LIMIT offset, jml;
no = 1; while data = mysql_fetch_array hasil{
if no 2 == 0 { style = style=background-color: F4F4F4;
}else {
style = style=background-color: white; }
ID =
data[id]; INFOLOG = explode |,data[lastlogin];
if data[status] == 0{ status = Closedinput type=radio name=userid[ID]
value=0 checked=checked Openinput type=radio name=userid[ID] value=1 ;
}elseif data[status] == 1 { status = Closedinput type=radio name=userid[ID]
value=0 Openinput type=radio name=userid[ID] value=1
checked=checked ; }
if array_key_exists1, INFOLOG INFOLOG[1] = ; admin .=tr style
tdnotd tddata[username]td
tddata[email]td td.date dmY, INFOLOG[1].td
tdstatus
a href=?pilih=admin_usersaksi=deleteid=ID
onclick=\return confirmLinkthis, DELETE FROM `data[username]` \deletea a
href=?pilih=admin_usersaksi=editid=IDEditatd tr;
no++; }
if isset _GET[pg],_GET[stg]{ pg
= 1;
stg =
1; }else {
pg =
int_filter_GET[pg]; stg
= int_filter_GET[stg];
} pager = a- getPagingjmlrec, pg, stg;
admin .= tr
td colspan=4.pager.
br input
type=submit value=Submit name=action[account] td
L-78
Universitas Kristen Maranatha
tr table
form ;
} ?
1.112.11 admin.php ?php
my weblogs version 1.0
Author : Peter Vannes Email : peter_fuyahoo.com
Last Modified : May 6, 2007 03:07:22 PM session_cache_limiternone;
session_nameLog; session_start;
ob_start; include includestemplate.php;
include includesconfig.php; include includesfungsi.php;
include includesHTTPauthen.php; include includesadmin.lib.php;
SQL = new SQL; SQL-connect1;
timer = new microTimer; timer-start;
include includesauthentication.php; ifauthen
{ session_destroy ;
headerlocation:login.php; exit;
} definepeter, Hello world.;
ws = ; admin= ;
SCRIPT = ; ifisset_GET[pilih]{
ws .= Welcome to Administration Peter Vannes Websites; ARR = globadmin.php;
IMG = glob admin.gif; if is_array ARR{
nn = 1; ws .= table border=\0\trtd width=50;
ws .= table border=\0\ width=100tr; foreach ARR as key=filename {
ifin_arraysubstr filename, 6, _SESSION[SES_PRIV], true or _SESSION[SES_PRIV][0] == all{
if preg_matchadmin_i, filename { ws .= tdtable class=album cellSpacing=1 cellPadding=0
border=0 tr
td table class=album1 cellSpacing=0 cellPadding=0 border=0
tr td width=70 height=60 align=centerimg src=admin.substr
filename, 6,-4..gifbra href=admin.php?pilih=.substr filename, 6,-4 .. substr filename, 12, -4.atd
tr
L-79
Universitas Kristen Maranatha
table td
tr table--star border--td;
if nn 4 == 0 { ws .= trtr;
} i++;
nn++; }
} }
ws .= trtable; INFOLOG = explode |,LASTLOGIN;
if array_key_exists1, INFOLOG INFOLOG[1] = ;
ws .= td td valign=top width=50-- user cp content loaded here --
div style=text-align:center;background-color:EAE7E0;padding:3px;font- weight:bold;color:909590;Account Informationdiv
table cellspacing=1 cellpadding=3 width=100 tr style=background-color:FAFAFA;
tdWelcometd td_SESSION[SES_USERNAME]
[a href=admin.php?pilih=admin_infoedita]td
tr tr style=background-color:F0F0F0;
tdEmail Addresstd td_SESSION[SES_EMAIL]td
tr tr style=background-color:FAFAFA;
tdLast Logintd td.date dmY H:i:s ,INFOLOG[1].td
tr tr
tr style=background-color:F0F0F0; tdIp Addresstd
tdINFOLOG[0]td tr
tr style=background-color:FAFAFA; tdTime remaintd
td . uptime int_SESSION[SES_TIME_LIMIT] - time + intGLOBALS[timeplus], true . td
tr tr style=background-color:F0F0F0;
tdQuery took logintd td. _SESSION[TOOK] .td
tr table;
warningggggggggggg ws .= brbr;
sql-connect1; num = sql-querySELECT id FROM .GLOBALS[tabel][link]. WHERE
public=0 ORDER BY id DESC; jumlah = sql-num_rows num;
if jumlah 0 ws .= liAda . jumlah . a href=?pilih=admin_linkaksi=incommingbLinkba yang belum di
Validasi;
result1 = sql-querySELECT FROM .GLOBALS[tabel][mod_lyrics]. WHERE public=0;
jumlah = sql-num_rows result1; if jumlah 0 ws .= liAda . jumlah . a
href=?pilih=admin_lyricsbLyricsba yang belum di Validasi; sql-close_db;
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 ?