Archive for the ‘PHP’ Category

Menginstall XAMPP dan Joomla di Windows

Wednesday, May 28th, 2008

Sebenarnya postingan ini saya tujukan untuk anak - anak FIKOM UNTAR yang mengambil mata kuliah Aplikasi Komputer dan Praktikum Joomla dengan Asisten Rama, Irvan, dan Santo.

Ini modul untuk instalasi Joomla dan XAMPP. Silahkan unduh disini dan disini ( RapidShare, sori server penuh :-( ).

Pertama kita install dulu XAMPP. Tapi saya tidak ada tutorialnya jadi silahkan baca secara online di blog http://beni-santoso.blogspot.com/2008/02/tutorial-instalasi-xampp-di-windows.html

Sesudah XAMPP terinstall, langkah selanjutnya adalah menginstall Joomla ( dari http://sakuriw.wordpress.com/2008/02/21/xampp-dan-joomla/ )

Buat Portal Berita Dengan Joomla

Wednesday, May 14th, 2008

Hari ini (13/05/2008) saya bersama teman - teman asisten mahasiswa dan teknisi laboratorium UNTAR mulai mengajar praktikum Joomla untuk para mahasiswa/i Fakultas Ilmu Komunikasi UNTAR. Mereka adalah para mahasiswa/i yang mengambil mata kuliah Aplikasi Komputer ( Aplikom ) dengan dosen Bpk Dedi Trisnawarman - yang juga pembimbing skripsi saya - dan untuk praktikum ada pengantar database dan membuat web menggunakan joomla.

Kelas sendiri dibagi menjadi 2, kelas pagi dan kelas siang, tiap - tiap kelas menggunakan 2 ruangan lab yang berbeda karena kebetulan jadwal lab yang bebas hanya dua dan terpisah. Ketika kelas pagi dimulai jam 10.00, ternyata yang mengikuti kelas ini hampir 85% adalah wanita.. akibatnya Irvan dan Santo pun mulai jelalatan, hahaha. Ya setidaknya itu versi saya karena memang anak FIKOM UNTAR itu cantik2, including the guys.. *vomit*

Oke, sebenarnya saya menulis posting ini bukan untuk cerita, melainkan membagikan modul yang saya buat untuk praktikum hari ini dengan topik, Membuat Portal Berita Menggunakan Joomla. Terima kasih sudah membaca, dan silahkan diunduh disini ( Dokumen Word 2003 2.28 Mb ).

Modul ini adalah materi yang saya ajarkan pada pertemuan pertama, untuk minggu depan pastinya modul akan berbeda dengan materi yang akan lebih sulit.

Simple Post Method Using XML Http

Friday, April 11th, 2008

A couple of times ago, its quite hard for me to find a simple yet effective example of using POST method via XML request (also known as AJAX). After finally getting my hands on it and use it in one of my web projects, i decided to make one simple article of using POST method via AJAX.

What we’re going to make is a login form with username and password, but when the user is logging in they dont have to switch pages. First of all, the Javascript. This script is the script for opening connection using XML HTTP, sending a query for request, and catch the response. This request query for opening a XML HTTP connection is different for each browser, so this script tries 3 methods for IE, Mozilla, and other browser using the standard XML queries. You can put this code on a *.js file or insert it inside the HTML file you’re about to execute.

function nigol(u,p)
{
document.getElementById("mnlgn").innerHTML='<input type="button" name="Submit" value="Logging In.." disabled>';
var xmlHttp;
try
{
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4) // if xmlHttp connection succeeded
{
document.getElementById("mnlgn").innerHTML=xmlHttp.responseText;
}
}
kue = "user="+u+"&pass="+p;
xmlHttp.open("POST","log-me-in.php?"+kue,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", kue.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(kue);
}

For POST method, we have to use extra queries : SetHeader. According to the RFC , POST method requires additional meta data such as Content-type,and Length. We send this using .setHeaderRequest similar to Header() function in PHP.

Inside the HTML file, we have to make a login form but dont bother.. i already made one :

<div class="item" id="mnlgn">
<h2 id="verybig" align="left" style="font-size:2em;">e-LOGIN</h2>
<form name="frmLogin">
<label>Username</label>
<input name="username" type="text" style="border:1px solid #CCC;">
<label>Password</label>
<input name="pas" type="password" style="border:1px solid #CCC;">
<input class="button" type="submit" value="Login >>" onclick="nigol(document.frmLogin.username.value,document.frmLogin.pas.value);">
</form>
</div>

Now, this is pretty much it.. next thing you should is making a normal PHP/ASP page for processing the username and password. Just in case you didn’t get that, here’s an example of a PHP login script compatible to the ajax script above.

file : log-me.in.php

<?
include(”db_connection.php”);

$login_query = mysql_query(”SELECT * FROM users WHERE username=’”.$_POST[’username’] .”‘ AND password =’”.md5($_POST[’pas’]).”‘”);

if(mysql_num_rows($login_query)==”1″)
{
echo(”Login success”);
}
?>

Well thats about it.. any questions? Leave a comment.. =)

Tawaran Kerja dari Trippert Labs

Tuesday, April 1st, 2008

“…. I came across your website at http://www.rampok.org/blog/about and thought of getting in touch with you regarding an interesting opportunity that we currently have with us. We are looking for Senior PHP developers for working from Indonesia….”

Saya benar2 terkejut dengan email yang dikirim ke saya pagi ini oleh seseorang dari trippertlabs.com menawari saya kerja jadi Senior PHP Developer. Trippert Labs ini merupakan owner dari Trippert , GopherNow, dan sepertinya sedang melakukan banyak recruitment para developer PHP di Indonesia. Yang saya bingung, kenapa banyak sekali posting di forum maupun blog dari orang - orang Indonesia yang sudah bekerja di Trippert Labs, mengenai job seperti senior PHP Developer atau Flash Developer tapi diharuskan mengirimkan CV + Resume berbahasa Inggris ke alamat yang berbeda - beda. Alamat email yang digunakan adalah alamat mereka sendiri…

Dan mereka pasti memasukkan alamat url profile entah dari Linkedin, Friendster, atau dalam kasus saya adalah halaman about dari blog ini. Ternyata saya cukup appealing ya untuk mereka hehehe…

Saya jadi bimbang.. tapi kayaknya memang tidak dulu deh. Saya mau ngurus proyek2 di startup saya sendiri =) . Lagian juga nyambi skripsi nih!

Sorry, Mr Priyanka.

Rampok WP Link Filter Plugin

Sunday, March 30th, 2008

Rampok Link Filter plugin for Wordpress 0.1

Description:
This plugin automatically convert phrases with domain url and email formats
into links. But these links are only for display, it does not alter the entry’s
database.

How To Use:
To use this plugin, first you have to activate Rampok Link Filter in the plugin
page inside WP’s Administrator Menu. After activated, you have to alter your
template’s pages. The pages that needed to be updated :

1. index.php
2. page.php
3. single.php

On each pages above, you must replace “the_content” with “rampok”.
Usually, the format would look something like this :

<? the_content(__('(more...)')); ?>

or

<?php the_content('<p class="serif">Read the rest of this page »</p>'); ?>

And you have to change it to :

<? rampok(__('(more...)')); ?>

or

<?php rampok('<p class="serif">Read the rest of this page »</p>'); ?>

Well.. that’s about it and you’re ready to go. If you found bugs, please report
to me via email rmamuaya{at}gmail.com or leave comments here

NOTE : Developers are welcome to help me =)

Download : rampok-link-filter-ir.zip

Sneak Peak on Wordpress 2.5 RC2

Friday, March 28th, 2008

untitled-1.jpgWith all the buzz on everybody’s blog about the release of Wordpress 2.5 RC2 get me all hype on getting my fingers on it. So i searched from the official wordpress website but i cant seem to find the download link. And of course, that doesnt stop me so i googled it and find a link for a download. I immediately installed it at my laptop and i start travelling in new world of wordpress.

The first thing to notice (but not really important) is the login page that looks like this

Of course this module dont get much alteration. But the new form design for this page is quite interesting, it has more subtle color than the old version. Carry on…

untitled-2.jpg

The first dashboard view is newly designed with a different navigation structure for administration process. As you can see the “Write”, “Manage”, “Design”, “Comments” menu are separated with the “Setting”, “Plugins”, and “Users”.

The word “Design” has been evolving since wordpress first developed. It has change from “Themes”, to “Presentation”, and now “Design”. I honestly curious about what this “evolution” is all about though. But, never mind..

In the bottom content, the dashboard page has 4 RSS section from Recent Comments, Incoming Links (backlinks from other web), RSS from wordpress development forum, and RSS for plugins.

untitled-3.jpg

The “Write Post” page is also experiencing major tune-up as we can see from the image on the left. In the old wordpress, the form is build vertically which can be seen from the “submit” button in the bottom section. But in WP2.5 RC2, the submit button is positioned on the right sidebar along with other frequently used options. While under the textarea is placed “Tags”, “Categories”, “Excerpt”, etc using like a “click to expand” DOM-Menu.

untitled-9.jpg

The other thing you may notice is the “Add media” menu on the top the textarea, next to “HTML” and “Visual” tab. We’ll.. this new feature is quite a major change for the new WP. From this window, we are able to upload any media file (image, video, audio) from our local computer and organized in “Gallery” tab, but there’s a catch. After you upload a file, make sure you click the “Save Changes” button, or else you file wont be saved in the “Gallery”. And i also find a bug from this new feature, the “Gallery” menu actually wont work using my Opera browser. In other browser (Mozilla, Safari) i can click on media item and it rolls down to show the details, but somehow this fails on my Opera.

untitled-8.jpg

Another new feature is a feast for the admins. The new WP now provide “Admin Color Scheme” for the whole administration section. Well, they actually give out the same color scheme, but the first one has more contrast, and the other one is more soft. Can we actually add new schemes? Add our own color? I dont know that yet…

There’s actually another difference that WP2.5 have is on the TinyMCE textarea. I dont really know who developed this, Wordpress or TinyMCE.. but its a good idea and very usefull. When you use the TinyMCE textarea for posting or editing, you can try CTRL+V (Paste) and it will respond by opening a new window for inserting you Pasted items as Plain text or as text Object like HTML, or from Office pages.

Another bug that i just found is on the permalinks. When i changed the permalink structure with %post-name% in it, it failed to work. Instead of displaying %post-name% it displays the post-id.

Well thats just about it. I Know this post is so far from enough, but i’ll try to post a new review on this matter in a short while. And, one more thing.. if you’re having problem on finding a download link for Wordpress 2.5 RC2, just download here. Its my own copy of the zipped file, and i swear i didnt do anything to it. =).

But if you can find a download link from the official website, good for you and happy blogging.

Gunakanlah Pengaman MD5 One-Way Hashing Encryption

Wednesday, March 26th, 2008

Saya kemarin dimintai tolong oleh beberapa kolega saya untuk me-review / meng-audit program skripsi mereka sebelum disidangkan 2 minggu kemudian. 5 orang yang membuat web ecommerce, dan 2 orang membuat sistem informasi berbasis web ( semua menggunakan PHP ). Dari 7 buah skripsi teman saya tersebut ternyata tak satupun yang menggunakan pengamanan / enkripsi dalam database khususnya untuk username dan password yang plaintext gitu aja. Padahal fungsi md5() sudah capek2 ditulis untuk membantu.. hehe. Yah begini contoh penggunaan beserta penjelasannya :

MD5 sendiri merupakan algoritma enkripsi satu arah ( hampir tidak mungkin untuk brute force decryption ). Caranya adalah dengan mengacak string yang akan dienkripsi menjadi md5 hash ( hasil enkripsi ). Nah untuk mecocokkannya cukup mudah yaitu dengan mengenkripsi password yang diinput saat login kembali menjadi hash untuk kemudian dicocokkan dengan hash password pada database sesuai dengan login username tersebut.

Code

Tabel user: user_id INT(5) PK, login VARCHAR(10), pass VARCHAR(8).

skrip untuk insert record user baru ke db :

$hash_pass = md5($password);

$kueri = mysql_query(”INSERT INTO user VALUES(23425,’userbaru’,’$hash_pass’)”);

skrip untuk login

$hash_pass = md5($password);

$kueri = mysql_query(”SELECT * FROM user WHERE login=’$username’ AND pass=’$hash_pass’”);

if(!$kueri){

die(”login gagal”);

}

dengan begini password yang disimpan dalam database tidak dalam bentuk plain text which is so dangerous. Peace.