Pages

Sunday, December 15, 2013

Script PHP Connect to MySQL


Berikut Ini Contoh Script PHP Connect to MySQL









Contoh 1:

<?php
$conn = mysql_connect('192.168.1.40', 'User', 'Password');
if (!$conn) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($conn);
?>



Contoh 2 :

<?php
// Create connection
$con=mysqli_connect("192.168.1.40","User","Password","Database");

// Check connection
if (mysqli_connect_errno())
  {
   echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
  else {
   echo "Connected successfully";
 }

?>


Thursday, December 12, 2013

Synchronize file dengan menggunakan rsync pada linux


Rsync ini melakukan transfer data dati satu server ke server lain dengan cukup menakjubkan,
anda dapat menggunakan aplikasi sync untuk keperluan backups server website , dan lebih daripada itu.
Aplikasi ini cepat dan tidak membutuhkan bandwidth yang tinggi hanya seperti  anda melakukan copy data secara normal .
saya pikir ini pilihan terbaik, Selamat datang pada dunia rsync yang luar biasa.

sebelumnya kita harus menyediakan 2 server linux, yang saya gunakan linux Centos 6.4 dan dengan linux ubuntu.
yang saya ininkan adalah data pada server centos di syngkronize dg server ubuntu.


Berikut ini Cata instalnya:

Settingan pada server linux tujian (centos):

install rsync :
# yum -y install rsync xinetd
# vi /etc/xinetd.d/rsync

Monday, December 9, 2013

List Perusahaan di Kawasan Industri MM2100

List Perusahaan di Kawasan Industri MM2100

No.
Block No.
Company Name


Business Type

Alamat Perusahaan di kawasan EJIP Cikarang


Berikut ini Alamat Perusahaan Di Kawasan EJIP Cikarang

PT. ABACUS KENCANA INDUSTRIES    
(stainless steel)
Kawasan EJIP - PLOT 4A, Cikarang Selatan, Bekasi, Jawa Barat 17550

PT. ADHI CIPTA AUTOBODY
(Repairing car)
Kawasan EJIP - PLOT 1F/4A, Cikarang Selatan, Bekasi, Jawa Barat 17550

PT. AISAN NASMOCO INDUSTRY
(Automotive parts)
Kawasan EJIP - PLOT 9L, Cikarang Selatan, Bekasi, Jawa Barat 17550

PT. AISIN INDONESIA          
(Automotive Components)
Kawasan EJIP - PLOT 5J, Cikarang Selatan, Bekasi, Jawa Barat 17550

PT. AJINOMOTO CALPIS BEVERAGE INDONESIA
(Beverage)
Kawasan EJIP - PLOT 7C, Cikarang Selatan, Bekasi, Jawa Barat 17550              

Sunday, December 8, 2013

install lynx : web browser berbasis text


Lynx merupakan web browser berbasis text (berjalan di terminal). Lynx menampilkan teks plain ASCII pada terminal anda, artinya Lynx tidak akan menampilkan foto atau konten multimedia, sehingga Lynx akan bekerja lebih cepat dibandingkan dengan browser lain. Anda dapat melakukan navigasi ke berbagai link dari halaman web dengan menggunakan tombol panah.


Cara instalnya :
$ sudo apt-get install lynx
atau dengan applikasi'synaptic package nmanager'

kemudian untuk mencobanya :
$ lynx www.detik.com


ket :
-berpindah dengan menggunakan tanda panah keyboad atas dan bawah.
-Enter menggunakan tombol arah kanan.
-kembali dengan menggunakan tombol arah ke kiri.



Berikut ini tampilanya :
lynx

Friday, December 6, 2013

Send email using GMail SMTP server from PHP with pear library


The first, please download pear library here
http://pear.php.net/


and then extract file and rename tobe "Pear_lib"


create file send_mail.php




<?php
// Pear Mail Library
require_once "Pear_lib/Mail.php";

$from = '<user@gmail.com>';
$to = '<user@yahoo.co.id>';
$subject = 'Hi!';
$body = "<html>Testing Email,<br>Test </html>";

$headers = array(
    'From' => $from,
    'To' => $to,
    'Subject' => $subject,
    'Content-Type'  => 'text/html; charset=UTF-8'
);

$smtp = Mail::factory('smtp', array(
        'host' => 'ssl://smtp.gmail.com',
        'port' => '465',
        'auth' => true,
        'username' => 'user@gmail.com',
        'password' => 'xxxxxxxxx'
    ));

$mail = $smtp->send($to, $headers, $body);

if (PEAR::isError($mail)) {
    echo('<p>' . $mail->getMessage() . '</p>');
} else {
    echo('<p>Message successfully sent!</p>');
}

?>


Thursday, December 5, 2013

Cara Membuat File .sh

Cara Membuat nya
Bisa dengan menggunakan terminal dengan editor vi  atau dengan Gedit

Dengan isi didahului oleh !/bin/bash






$vi /home/kusdi/cron/test.sh
isinya

#!/bin/bash

cp /home/kusdi/cron/test.txt /home/kusdi/cron/text_cron.txt
tar -zcf /home/kusdi/cron/test.tar.gz /home/kusdi/cron/


simpan  dengan cara Esc : wq

untuk menjalankan filenya :

$sh /home/kusdi/cron/test.sh


Chek hasilnya :

$ls /home/kusdi/cron/


Install cron / crontab pada ubuntu


cron job
Install Cron 

$sudo apt-get install cron

atau
boleh dari aplikasi  'Synaptic Package Manager'





Perintah yang yang di gunakan pada Crontab :
- crontab -e  : Berfungsi untuk mengubah dan membuat Crontab Baru
- crontab -l   : Berfungsi untuk melihat isi dari Crontab yang telah kita buat
- crontab -r  : Berfungsi untuk menghapus Crontab


membuat cron job

format penulisan job seperti dibawah ini :

*     *     *     *     *  command to be executed
-     -     -     -     -
|     |     |     |     |
|     |     |     |     +----- hari (0 - 6) (minggu=0)
|     |     |     +------- bulan (1 - 12)
|     |     +--------- tanggal (1 - 31)
|     +----------- jam (0 - 23)
+------------- menit (0 - 59)


Clear Console dan DOM Firebug dengan Jquery











Create Funcion :

function clearconsole() { 
 console.log(window.console);
  if(window.console || window.console.firebug) {
  //clear console
  console.clear();
  //clear DOM -> localstorage
  while (localStorage.length) localStorage.removeItem(localStorage.key(0));
 }
}


panggil funcionnya :

clearconsole()

Install Cron pada Linux Centos


Install package dan dependencies
cron job

#yum install vixie-cron

Enable service saat booting and start

# /sbin/chkconfig crond on

Start or restart Service

# /etc/init.d/crond start


menambahkan cron job :
# vim /etc/crontab 

tampilanya :
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name command to be executed


Tambahkan dibagian bawahnya :
30 10 * * * root rm /home/test/cron_data/test.txt


Simpan filenya = Esc +wq
Artinya : job ini bekerja setiap hari, setiap bulan, setiap tanggal 1-31 , jam 10 lebih 30 menit.


Reff lain silahkan baca :

http://kusprayitna.staff.uii.ac.id/2008/09/22/membuat-penjadwalan-di-linux-crontab/
http://blogbodi.wordpress.com/2012/02/19/crontab-auto-eksekusi-perintah-linux/
https://drupal.org/node/23714

Membuat cron job pada linux centos 6



Install package dan dependencies

#yum install vixie-cron

Enable service saat booting and start

# /sbin/chkconfig crond on

Start or restart Service

# /etc/init.d/crond start


menambahkan cron job :
# vim /etc/crontab 

tampilanya :
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name command to be executed


Tambahkan dibagian bawahnya :
30 10 * * * root rm /home/test/cron_data/test.txt


Simpan filenya = Esc +wq
Artinya : job ini bekerja setiap hari, setiap bulan, setiap tanggal 1-31 , jam 10 lebih 30 menit.


Reff lain silahkan baca :

http://kusprayitna.staff.uii.ac.id/2008/09/22/membuat-penjadwalan-di-linux-crontab/
http://blogbodi.wordpress.com/2012/02/19/crontab-auto-eksekusi-perintah-linux/
https://drupal.org/node/23714

Wednesday, December 4, 2013

Backup Incremental pada Linux Centos 6


Create Directory

# mkdir -p /mnt/backup/local/

# mkdir -p /home/test/data/

#touch /home/test/data/file{1..10}

# ls -l /home/test/data/



hasilnya :
total 0
-rw-r--r--. 1 root root 0 Dec  5 10:50 file1
-rw-r--r--. 1 root root 0 Dec  5 10:50 file10
-rw-r--r--. 1 root root 0 Dec  5 10:50 file2
-rw-r--r--. 1 root root 0 Dec  5 10:50 file3
-rw-r--r--. 1 root root 0 Dec  5 10:50 file4
-rw-r--r--. 1 root root 0 Dec  5 10:50 file5
-rw-r--r--. 1 root root 0 Dec  5 10:50 file6
-rw-r--r--. 1 root root 0 Dec  5 10:50 file7
-rw-r--r--. 1 root root 0 Dec  5 10:50 file8
-rw-r--r--. 1 root root 0 Dec  5 10:50 file9


Membuat File Backup pada Linux Centos 6


Create Directory

# mkdir -p /mnt/backup/local/

# mkdir -p /home/test/data/

#touch /home/test/data/file{1..10}

# ls -l /home/test/data/



hasilnya :
total 0
-rw-r--r--. 1 root root 0 Dec  5 10:50 file1
-rw-r--r--. 1 root root 0 Dec  5 10:50 file10
-rw-r--r--. 1 root root 0 Dec  5 10:50 file2
-rw-r--r--. 1 root root 0 Dec  5 10:50 file3
-rw-r--r--. 1 root root 0 Dec  5 10:50 file4
-rw-r--r--. 1 root root 0 Dec  5 10:50 file5
-rw-r--r--. 1 root root 0 Dec  5 10:50 file6
-rw-r--r--. 1 root root 0 Dec  5 10:50 file7
-rw-r--r--. 1 root root 0 Dec  5 10:50 file8
-rw-r--r--. 1 root root 0 Dec  5 10:50 file9


Friday, November 29, 2013

Update Libreoffice ke versi terbaru pada ubuntu

Tambahkan library libreoffice :

$sudo add-apt-repository ppa:libreoffice/ppa


update library ubuntu :

$sudo apt-get update

Install library from synaptic package manager :



Install library firebird untuk php 5.4 pada Centos 6.4


download libfbclient.so.2 pada alamat dibawah ini  :

http://pkgs.org/download/libfbclient.so.2
atau
http://dl.atrpms.net/el6-i386/atrpms/stable/

open foldernya install paketnya.

#yum install php-interbase.i686

restart apache :
#service httpd restart


Wednesday, November 27, 2013

Secure Copy (scp) pada Linux


Berikut ini beberapa cara copy file dengan menggunakan secure copy (scp)


Copy file "test.txt" dari remote komputer lain  ke local komputer :
$ scp your_username@remotehost_ip:homeserver/kusdi/test.txt /home/kusdi/directory


Copy file "test.txt" dari local komputer ke remote komputer lain :
$ scp  /home/kusdi/directory/test.txt your_username@remotehost_ip:/some/remote/directory

Copy file "test.txt" dari remote host "server1" ke remote host "server2" :
$ scp your_username@server1:/some/remote/directory/test.txt \
your_username@server2:/some/remote/directory/

Copying file "foo.txt" and "bar.txt" dari local host home directory dari remote host :
$ scp foo.txt bar.txt your_username@remotehost_ip:~


Copy file "test.txt" dari local host ke remote host dengan menggunakan port 2264 :
$ scp -P 2264 test.txt your_username@remotehost_ip:/some/remote/directory

Copy Data dengan Menggunakan Secure Copy (scp) pada Linux


Kita mau ngambil File yang ada pada komputer 192.9.18.10 dari komputer lain (OS Linux)
letaknya ada di /home/test/Downloads/test.txt

Berikut ini cara copy datanya dengan menggunakan "Syntax for Secure Copy (scp)" :

# scp root@192.9.18.10:/home/test/Downloads/test.txt /home/kusdi/Downloads/

Masukan password nya :
root@192.9.18.10's password: 

Tampilannya :
test.txt                                                                         100%   10     0.0KB/s   00:00    


# ls /home/kusdi/Downloads/
test.txt


Install Adobe Flash Player pada Centos 6


Open terminal dengan login SU

# rpm -ivh http://linuxdownload.adobe.com/adobe-release/adobe-release-x86_64-1.0-1.noarch.rpm

# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux

# yum install flash-plugin


Restart Komputer.

Tuesday, November 19, 2013

Membuat File Sharing tanpa password dengan Samba pada Centos 6


Make directory for sharing:
# mkdir -p /mnt/sharing_smb/

Make a file txt 
#cat > /mnt/sharing_smb/test.txt

fill this values

1   
2   
3   
4   
5   

save with  Ctrl + d

Backup smb.conf :
#cp /etc/samba/smb.conf /etc/samba/smb.conf.backup

Setting user access
#chcon -t shamba_share_t /mnt/sharing_smb/

Setting user access :
#chmod a+w /mnt/sharing_smb/


Sunday, November 17, 2013

Managiing Services On Centos 6

Check Services yang ada pada linux :

#chkconfig  --list

Tampilanya  :

NetworkManager 0:off 1:off 2:on 3:on 4:on 5:on 6:off
acpid           0:off 1:off 2:on 3:on 4:on 5:on 6:off
atd             0:off 1:off 2:off 3:on 4:on 5:on 6:off
auditd         0:off 1:off 2:on 3:on 4:on 5:on 6:off
autofs         0:off 1:off 2:off 3:on 4:on 5:on 6:off
blk-availability 0:off 1:on 2:on 3:on 4:on 5:on 6:off
bluetooth       0:off 1:off 2:off 3:on 4:on 5:on 6:off
cpuspeed       0:off 1:on 2:on 3:on 4:on 5:on 6:off
crond           0:off 1:off 2:on 3:on 4:on 5:on 6:off
cups           0:off 1:off 2:on 3:on 4:on 5:on 6:off
dhcpd           0:off 1:off 2:off 3:off 4:off 5:off 6:off
dhcpd6         0:off 1:off 2:off 3:off 4:off 5:off 6:off
dhcrelay       0:off 1:off 2:off 3:off 4:off 5:off 6:off
dnsmasq         0:off 1:off 2:off 3:off 4:off 5:off 6:off
fcoe           0:off 1:off 2:on 3:on 4:on 5:on 6:off
firstboot       0:off 1:off 2:off 3:off 4:off 5:off 6:off
haldaemon       0:off 1:off 2:off 3:on 4:on 5:on 6:off



untuk filternya  bisa menggunakan |grep
#chkconfig --list |grep httpd 
hasilnya :
httpd           0:off 1:off 2:on 3:on 4:on 5:on 6:off


Membuat File Sharing dengan NFS pada Centos 6


NFS adalah Service untuk file sharing khusus OS Linux.

Berikut ini Tutorial Cara membuatnya pada linux centos 6 / yang sedang saya gunakan versi 6.4.





Install Service NFS :
#yum install nfs


Crete Folder :
#mkdir -p /mnt/sharing_nfs/data

Create File txt :
# cat > /mnt/sharing_nfs/data/test.txt

isikan file nya:
1   
2   
3   
4   
5   
tekan ctrl + d untuk menyimpannya

Tuesday, November 12, 2013

Membuat alias pada terminal linux

Terkadang ketika kita melakukan restart service , kita dituntut untuk menghafal perintahnya.
nah sebetulnya ada trik untuk mempermudah pekerjaan tersebut yanitu dengan menggunakan Alias.

Berikut ini cara membuatnya : 


Contoh ketika kita mau restart Service Apache

Perintah nya :


#sudo /etc/init.d/apache2 restart

kemudian kita membuatkan aliasnya  :

#alias apache='sudo /etc/init.d/apache2 restart'

kemudian sekarang kita sudah bisa restart apache dengan menggunakan alias "apache"

#apache



Selamat Mencoba.



Sunday, November 10, 2013

Editor Nano pada linux / unix



Nano adalah text editor yang berjalan di system UNIX.  editor ini tak seperti editor kebanyakan yang berjalan di tampilan visual jendela melainkan pada tampilan terminal, nano tidak  berkerja  menggunakan moouse , tetapi masih memiliki banyak fitur yang sangat powerfull.  untuk menginstall nano pada Linux Fedora tinggal mengetikkan di shell dengan perintah

Cara install :

#yum install nano

Kebanyakan dari perintah nano, dipanggil dengan menekan tombol Ctrl (tombol kontrol), dan menekan salah satu kunci lainnya(tombol berikutnya). Dalam teks ini, kunci pengendalian menampilkan ^ . Sebagai contoh ^ X berarti, tahan tombol CTRL dan tekan kunci x .Sebagian besar perintah-perintah umum yang  penting tercantum di bagian bawah terminal anda.

nano         untuk memulai
^G              untuk bantuan


Install Nano pada Centos 6


Innstall Nano on Centos 6 :

#yum install nano

Merubah Repository Centos 6 ke Kambing UI Indonesia


Backup your repo with rename file :

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.orig




Create new file refo:

nano /etc/yum.repos.d/CentOS-Base.repo

Isi dengan :

# CentOS-Base.repo
# http://kambing.ui.ac.id/centos/6/

[Add Ons]
name=CentOS
baseurl=http://kambing.ui.ac.id/centos/6/addons/i386/
enabled=1
gpgcheck=1
gpgkey=http://kambing.ui.ac.id/centos/RPM-GPG-KEY-CentOS-6

[CentOS Plus]
name=CentOS
baseurl=http://kambing.ui.ac.id/centos/6/centosplus/i386/
enabled=1
gpgcheck=1
gpgkey=http://kambing.ui.ac.id/centos/RPM-GPG-KEY-CentOS-6

[Contrib]
name=CentOS
baseurl=http://kambing.ui.ac.id/centos/6/contrib/i386/
enabled=1
gpgcheck=1
gpgkey=http://kambing.ui.ac.id/centos/RPM-GPG-KEY-CentOS-6

[Extras]
name=CentOS
baseurl=http://kambing.ui.ac.id/centos/6/extras/i386/
enabled=1
gpgcheck=1
gpgkey=http://kambing.ui.ac.id/centos/RPM-GPG-KEY-CentOS-6

[Fasttrack]
name=CentOS
baseurl=http://kambing.ui.ac.id/centos/6/fasttrack/i386/
enabled=1
gpgcheck=1
gpgkey=http://kambing.ui.ac.id/centos/RPM-GPG-KEY-CentOS-6

[OS]
name=CentOS
baseurl=http://kambing.ui.ac.id/centos/6/os/i386/
enabled=1
gpgcheck=1
gpgkey=http://kambing.ui.ac.id/centos/RPM-GPG-KEY-CentOS-6

[Update]
name=CentOS
baseurl=http://kambing.ui.ac.id/centos/6/updates/i386/
enabled=1
gpgcheck=1
gpgkey=http://kambing.ui.ac.id/centos/RPM-GPG-KEY-CentOS-6



good luck



Thursday, October 31, 2013

Cara membuat SSL Certificate (httpd) pada Centos 6



SSL merupakan protokol standar web untuk mengenkripsi komunikasi data antara pengguna dengan site yang diakses. Lalu lintas data melalui sambungan SSL akan di enkripsi sehingga akan menghindari resiko sabotase atau pencurian data. Misalnya data username, password dll.






Berikut ini cara membuatnya :


1. Install Mod SSL

#yum install mod_ssl

2. Create a New Directory

#mkdir /etc/httpd/ssl

3. Create a Self Signed Certificate

#openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/httpd/ssl/apache.key -out /etc/httpd/ssl/apache.crt


Jawab Pertanyaanya 
Country Name :
Province Name :
Locality Name :
Organization Name :
Organizational Unit Name :
Common Name  :
Email Address :

untuk kode Country Name : bisa dilihat disini


Berikut ini contohnya :

Country Name (2 letter code) [XX]:ID
State or Province Name (full name) []:Jakarta
Locality Name (eg, city) [Default City]:Jakarta
Organization Name (eg, company) [Default Company Ltd]:jin
Organizational Unit Name (eg, section) []:system
Common Name (eg, your name or your server's hostname) []:CA
Email Address []:xxxxx@gmail.com    

4. Create Virtual Host with  Port 443


5. Set Up the Certificate

#vi /etc/httpd/conf.d/ssl.conf
Edit  Line berikut :

ServerName example.com:443
SSLEngine on
SSLCertificateFile /etc/httpd/ssl/apache.crt
SSLCertificateKeyFile /etc/httpd/ssl/apache.key

6. Restart Service Apache
#/etc/init.d/httpd restart


Apabila ada masalah tidak bisa diakes dari ip lain coba dicheck port 443 nya.

buka port 443 dengan cara :

vi /etc/sysconfig/iptables

Tambahkan line Berikut ini :

-A INPUT -p tcp --dport 443 -j ACCEPT








Membuka Port 80 (http) pada Linux Centos


berikut ini langkah untuk membuka port 80 (http) pada centos
supaya webserver kita bisa diakses dari luar.


# vi /etc/sysconfig/iptables

Tambahkan Script berikut ini :
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

Save and close the file. Restart iptables:

# /etc/init.d/iptables restart

Edito vi pada Unix/Linux

unix


Platform: Unix /Linux
Bagi yang mau belajar linux wajib mempelajari pelajaran ini,
awalnya memang aga ribet, tapi kalo sudah lama terbiasa juga.






Cursor Navigation (if your arrow keys dont work on that old Sun box....)
j = next line
k = previous line
h = left
l = right

shiftg bottom of document
gg = top of document
Fast Search / Search Term
n = next
N = previous


Wednesday, October 30, 2013

Menambahkan Akses Webmin untuk IP Lain


Agar Webmin Bisa di akses Dari IP lain :

- Open Terminal dengan login Root

#/etc/webmin/miniserv.conf


- Restart Service  webmin


#/etc/init.d/webmin restart








Tuesday, October 29, 2013

Menjalankan applikasi exe Delphi-SQL Server pada Ubuntu


Menjalankan applikasi exe Delphi-SQL Server pada Ubuntu

$ sudo add-apt-repository ppa:ubuntu-wine/ppa
$ sudo apt-get update
$ sudo apt-get install wine1.7
$ sudo apt-get install winetricks

kemudian agar SQL Server juga bisa berjalan harus di install mdac28 melalui winetricks.
setelah itu letakan file .exe dan ntwdblib.dll di satu folder didalam  /home/user/.wine/program file/





Insatall Wine Pada Ubuntu 13.04



Insatall Wine Pada Ubuntu 13.04


$ sudo add-apt-repository ppa:ubuntu-wine/ppa
$ sudo apt-get update
$ sudo apt-get install wine1.7
$ sudo apt-get install winetricks


Monday, October 28, 2013

Menambahkan User dan Group pada Centos


Add User :

# useradd --home /home/kusdi kusdi

change Password :

# passwd kusdi
Changing password for user kusdi.
New password:            
Retype new password:           


Delete User  :

#userdel kusdi


Create Group :

#groupadd jin_system

menambahkan user yang sudah ada kedalam group jin_system :

#usermod -G jin_system kusdi
atau
#usermod -G jin_system,jin kusdi

cara menghapus group :
#groupdel jin_system

ket :
-g Group ID for the group, which must be unique and greater than 499
-r Create a system group with a GID less than 500
-f When used with -g<gid> and <gid> already exists, groupadd will choose another unique <gid> for the group.




Saturday, October 26, 2013

Download Software Untuk Partisi Hardisk

Software Untuk  Partisi Hardisk :

1. EaseUS Partition Master
Easeus Partition Master merupakan software partisi hardisk produksi china. EaseUS Partition Master menawarkan beberapa versi yang bsia anda pilih dan anda gunakan sebagai software partisi hardisk. Dengan tampilan yang mirip Partition Magic EaseUS disebut-sebut sebagai alternatif pengganti software partisi hardisk Partition Magic terbaik. Ter dapat beberapa pilihan EaseUS partition master yang bisa anda coba yaitu EaseUS Partition Master Home Edition, EaseUS Partition Master Professional Edition, EaseUS Partition Master Server Edition, EaseUS Partition Master Unlimited Edition, dan EaseUS Partition Master Technician Edition. Untuk yang versi freeware dan gratis digunakan sebagai software partisi hardisk adalah EaseUS Partition Master Home Edition. Anda bisa mendownloadnya di URL berikut ini:

Friday, October 25, 2013

Restart networking service pada Ubuntu

Buka  terminal (command line) :

untuk restart networking service
$ sudo /etc/init.d/networking restart

Untuk start networking service, enter:
$ sudo /etc/init.d/networking start

Untuk stop networking service, enter:
$ sudo /etc/init.d/networking stop

Cara install Apache Server pada CentOS, RedHat, Linux


Apache HTTP Server merupakan aplikasi open-source HTTP server untuk operating systems medern termasuk UNIX and Windows NT.
untuk informasi lebih banyak tentang Apache HTTP Server, anda dapat mengunjungi websitenya httpd.apache.org.








Cara install Apache Server pada CentOS, RedHat, Linux

Install Apache HTTP Server :

yum install httpd


Configure Apache Server on CentOS, RedHat, Linux :

Set apache service pada saat start on boot

chkconfig --levels 235 httpd on


Restart the Apache HTTP Server daemon

service httpd restart

setelah itu satu hal  lagi yang harus kita lakukan yaitu membuka port http (80) agar webserver bisa diakses dari ip lain.

click disini cara membuka port http (80)

dan berikut ini panduan cara membaut virtual host seperti www.example.com 


 Selamat Mencoba


Thursday, October 24, 2013

Cara Install FTP Server Pada Centos 6


You can install vsftpd on Ubuntu / Debian, CentOS /Fedora and RHEL linux.

Installing vsftpd on Ubuntu or Debian

sudo apt-get install vsftpd

Installing vsftpd on CentOS / Fedora

yum install vsftpd



How to configure vsftpd:
Now that you’ve installed vsftpd, follow this procedure to configure it. These steps applies for both the linux variants.
Before you get started, stop the vsftpd by typing:

service vsftpd stop

Edit the vsftp.conf

In Ubuntu / Debian:

vim /etc/vsftpd.conf

In Red Hat / CentOS

vim /etc/vsftpd/vsftpd.conf

Make the following changes:
We don’t want anonymous login:

anonymous_enable=NO

Enable local users:

Uncomment the “local_enable=YES” line (else you’ll get an error like ’500 OOPS: vsftpd: both local and anonymous access disabled!’)

local_enable=YES

The ftpuser should be able to write data:

Uncomment the “write_enable=YES” line (else you’ll get an error like ’550 Permission denied.’ from your FTP client when you upload a file or create a directory)

write_enable=YES

Port 20 need to turned off, makes vsftpd run less privileged:

connect_from_port_20=NO

Chroot everyone:
Add a “chroot_local_user=YES” line. This will trap your FTP users in their own /home/username directory. Otherwise they will be able to see and update some files outside their home directory.

chroot_local_user=YES
ascii_upload_enable=YES
ascii_download_enable=YES


set umask to 022 to make sure that all the files (644) and folders (755) you upload get the proper permissions.

local_umask=022


Now that basic configuration is complete, now let us begin with locking / securing a directory to user.
#sudo useradd -d /var/www/path/to/your/dir -s /usr/sbin/nologin ftpuser

Setup a password for the user:
#sudo passwd ftpuser

In order to enable the ftpuser read and write the data in your home dir, change the permission and take ownership:

#sudo chown ftpuser  -R /var/www/path/to/your/dir
#sudo chmod 775 /var/www/path/to/your/dir

Create userlist file and add the user:
Ubuntu / Debian:
#vim /etc/vsftpd/vsftpd/vsftpd.userlist


CentOS / Fedora :
#vim /etc/vsftpd/vsftpd.userlist


and add the user:

ftpuser

save the file and open the vsftp.conf file again:

#vim /etc/vsftpd/vsftpd.conf

Add the following lines at the end of the file and save it:

# the list of users to give access

userlist_file=/etc/vsftpd/vsftpd.userlist

# this list is on

userlist_enable=YES

# It is not a list of users to deny ftp access

userlist_deny=NO

After completing all these procedures it is almost ready to use it, give it a try but you will get a “500 OOPS permission denied error”. To fix it you need to add a nologin to the shell set.

#vim /etc/shells

The file should look like this:

/bin/ksh

/usr/bin/rc

/usr/bin/tcsh

/bin/tcsh

/usr/bin/esh

/bin/dash

/bin/bash

/bin/rbash

Add this line at the end:

/usr/sbin/nologin



Now create a usergroup and add the ftpuser to it:

#sudo groupadd ftpusers

#sudo usermod -G ftpusers ftpuser


Now start the vsftpd:

#service vsftpd start


Running Service FTP automatically  :

# chkconfig vsftpd on

Check konfigurasi SELinux :

SELinux kalau tidak salah adalah mirip User Account Control  membatasi hak akses atau fungsi sebuah aplikasi atau daemon. Anda harus hati-hati dalam tahap ini karena jika salah dalam mengkonfigurasinya user ftp tidak akan bisa login ke home direktori mereka.

# getsebool -a | grep ftp
jika SELinux Disable maka rubah menjadi permissive
Edit file konfigurasi SELinux dengan perintah :

# vi /etc/selinux/config

This file controls the state of SELinux on the system.

#SELINUX= can take one of these three values:
#enforcing - SELinux security policy is enforced.
#permissive - SELinux prints warnings instead of enforcing.
#disabled - SELinux is fully disabled.
SELINUX=permissive
#SELINUXTYPE= type of policy in use. Possible values are:
#targeted - Only targeted network daemons are protected.
#strict - Full SELinux protection.
SELINUXTYPE=targeted

ket :
Edit SELINUX Menjadi
SELINUX=permissive

Reboot Computer :
# reboot

Edit ftp_home_dir menjadi on
# setsebool -P ftp_home_dir on
# iptables -F

Check getsebool :
# getsebool -a | grep ftp


allow_ftpd_anon_write --> off
allow_ftpd_full_access --> off
allow_ftpd_use_cifs --> off
allow_ftpd_use_nfs --> off
ftp_home_dir --> on
ftpd_connect_db --> off
ftpd_use_passive_mode --> off
httpd_enable_ftp_server --> off
tftp_anon_write --> off


Ref : linuxaway.net , http://kalpaz.blogspot.com




Wednesday, October 23, 2013

Membuat Temporary Tabel pada Database MySQL



Tidak hanya Sql server saja yang bisa membuat tabel temporary,
Database Gratisan ini(MySQL) juga bisa melakukanya :


Berikut ini contoh nya:





Create temporary table :


CREATE TEMPORARY TABLE Temp_employee
SELECT m.em_emplcode,
       m.em_emplname,
       m.em_sex,
       s.section_code
FROM master_employee m
INNER JOIN master_section s ON m.em_code = s.section_code
ORDER BY total ASC


Untuk melihat Hasilnya :


SELECT * FROM Temp_employee


Untuk Menghapus Table Temporary :


DROP TEMPORARY TABLE Temp_employee

Tuesday, October 22, 2013

Sejarah Linux CentOS


CentOS singkatan dari Community ENTerprise Operating System (Sistem Operasi Perusahaan buatan Komunitas / Masyarakat) adalah sistem operasi gratis yang dibuat dari source code Red Hat Enterprise Linux (RHEL). Proyek ini berupaya untuk 100% binari kompatibel dengan produk hulunya (RHEL). Dan tentu saja menggunakan paket RPM.
Karena CentOS dikompile dari SRPM RHEL maka CentOS 100% kompatible dengan RHEL, isi dari CentOS hampir sama dengan RHEL. Lalu, Bedanya pada CentOS semua atribute RHEL dibuang, contohnya README.TXT RHEL diganti menjadi README.TXT CentOS.

Sunday, October 20, 2013

Inventory IT Asset Management dengan OCS Inventory NG

OCS Inventory-Next Generation

Open Computer and Software Inventory Next Generation (OCS Invenrory NG) adalah sebuah aplikasi yang dirancang untuk membantu administrator jaringan untuk melacak konfigurasi komputer dan software yang terinstall pada jaringan komputer.


Dengan menggunakan OCS Inventory NG, maka dapat melakukan manajement hardware dan software secara terpusat. Hal ini dapat terjadi karena aplikasi OCS Inventory NG bersifat client-server, sehingga admin cukup mengakses informasinya dari OCS Inventory NG Server. Untuk melakukan komunikasi antara komputer klien dengan manajemen
server, OCS Inventory NG dibuat berbasiskan pada standar HTTP/HTTPS protokol, dan format data XML.

Manajement server OCS Inventory NG dapat berjalan di komputer yang menjalankan Apache/MySQL/PHP/PERL, baik di komputer yang menggunakan sistem operasi Linux maupun Windows. OCS Inventory NG juga dapat mendeteksi dan menampilkan informasi beragam hardware lain yang sedang aktif di dalam jaringan, seperti switch, router, network printer, dan sebagainya.


Tujuan :

-Membantu administrator jaringan untuk melacak konfigurasi komputer, software dan hardware yang diinstall pada tiap-tiap komputer.
-Menjaga kestabilan kinerja jaringan komputer dengan sistem perawatan berkala.


Dengan menggunakan software IT Asset Management, memungkinkan untuk memperoleh data inventori secara cepat dan terpusat, sehingga dapat menghemat waktu dalam pengerjaannya.
Beberapa kelebihan dalam menggunakan alternatif ini adalah sebagai berikut:

- Dapat menginventori software dan hardware secara otomatis yang terhubung dengan jaringan.
- Dapat memperoleh data inventori secara lengkap dan akurat.
- Bisa dapat berinteraksi langsung dengan administrator jika ada kerusakan pada komputer.





Wednesday, October 16, 2013

Cara Merubah Background Images pada Bloger


1. Masuk ke dashboard > Template
2. Klik Edit HTML
3. Arahkan dan klik kursor di dalam area template editor, lalu tekan Ctrl+F
 "html body"

kode awal :


html body .content-outer {
  min-width: 0;
  max-width: 100%;
  width: 100%;
}


Rubah kode cssnya dengan menambahkan   background:url(......)

Contoh  menjadi  :


html body .content-outer {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  background:url(https://lh3.googleusercontent.com/-MqFftDIOyVs/Ul49VP3EnbI/AAAAAAAAANs/HlXH-YRwVD8/w140-h140-p/wood4.jpg);
  background-position:top left;
  background-repeat: repeat-x repeat-y;
}

Tuesday, October 15, 2013

Install Driver Printer HP pada Ubuntu


Install library driver hp terlebih dahulu 

sudo apt-get install hplip


kemudian set ip nya dengan menjawab pertanyaan pertanyaanya :

kusdi@sys05:~$ sudo hp-setup -i


Thursday, October 10, 2013

Install Skype pada ubuntu 13.04


Anda dapat mendownload softwarenya di skype.com click disini ;


jika sudah selesai buka kefolder download install softwarenya dengan cara click kanan open with ubuntu software ceter

Install Driver Laserjet M1212nf MFP pada Ubuntu 13.04

Install Driver Laserjet M1212nf MFP pada Ubuntu 13.04


sudo apt-get install hplip

sudo hp-setup -i


Cara Merubah Password Root pada Ubuntu 13.14

Cara Merubah Password Root pada Ubuntu 13.14

Open terminal :


aemadmin@PC23:/$sudo passwd root

Enter new UNIX Password :

Retype new UNIX password :


regards

Wednesday, October 9, 2013

Mengatasi Error php "Notice: Undefined index: "



Undefined Index terjadi karena terdeteksi ada sebuah variable yang kosong.

Undefined Index ini hanya peringatan saja, anda bisa mengatasi masalah ini dengan merubah file php.ini yang ada pada server web anda.
agar error ini tidak lagi muncul.







1. Open php.ini

2. Rubah line berikut ini

error_reporting(E_ALL);

tambahkan  tanda ";" didepannya sehingga menjadi seperti dibawah ini

;error_reporting(E_ALL)

OR

bisa juga anda rubah menjadi seperti ini

error_reporting(E_ALL ^ E_NOTICE);


3. You can also supress notice errors by putting @ before the variable.

PHP Code:
@$variable = $_GET['va']; 

Setting permission file dengan "chmod"

Setting permission file dengan  "chmod"

Rumus :

chmod [option] [mode] files

Options :

Option Description
-R = Descend directory arguments recursively while setting modes.
-f = Suppress error messages if command fails.


Mode :

Mode Description
Who  : u=user, g=group, o=other, a=all (default)

Opcode: + means add permission
- means remove permission
= means assign permission and remove the permission of unspecified fields

Permission: r=Read, w=write, x=Execute, s=set uid bit, t=sticky bit
u=user, g=group, o=other, l=mandatory locking


Examples :

chmod 751 test
chmod u=rwx, g=rx, o=x test
chmod 777 test -R

Lihat hasilnya :

ls -l



Monday, October 7, 2013

Mengganti hak kepemilikan file pada ubuntu













Check directory secara lengkap :

root@sys05:/# ls –l /home
-rwxr-xr-x         1    root     root     juli 09 2013            /home/test

ket :
-rwxr-xr-x           =  hak akses dari suatu file
root                     =  user
root                     =  grup
juli 09 2013         =  tanggal pembuatan file
/home/file            =  letak file / nama file



Berikut ini  cara untuk merubah kepemilikan file dengan menggunakan perintah chown: 

root@sys05:/# ls –l /home
-rwxr-xr-x         1    root     root     juli 09 2013            /home/test
root@sys05:/# chown  kusdi  /home/test

root@sys05:/# ls –l /home
-rwxr-xr-x         1    kusdi       root     juli 09 2013            /home/test

ket : test yang dimiliki oleh user root berubah kepemilikan menjadi user kusdi.



Kemudian cara merubah kepemilikan grup adalah dengan menggunakan perintah chgrp : 


root@sys05:/# ls –l /home
-rwxr-xr-x         1    kusdi       root     juli 09 2013            /home/test
root@sys05:/# chgrp kusdi /home/test

root@sys05:/# ls –l /home
-rwxr-xr-x         1    kusdi       kusdi     juli 09 2013            /home/test

ket : file  test yang dimiliki oleh grup root berubah kepemilikan menjadi grup  kusdi.



Berikut ini langkah untuk merubah kepemilikan file dan grup secara bersamaan.

root@sys05:/# ls –l /home
-rwxr-xr-x         1    kusdi       kusdi     juli 09 2013            /home/test
root@sys05:/# chown  root.root /home/test

root@sys05:/# ls –l /home
-rwxr-xr-x         1    root     root     juli 09 2013            /home/test

ket : File  test yang dimiliki oleh user kusdi dan  grup kusdi berubah kepemilikan menjadi user root dan grup  root. Jika kadang dijumpai file yang tidak bisa terubah kepemilikannya bisa menggunakan perintah –R (recursive).

Contoh penggunaan sebagai berikut :

root@sys05:/# ls –l /home
-rwxr-xr-x         1    root     root     juli 09 2013            /home/test
root@sys05:/# chown -R kusdi.kusdi   /home/test

root@sys05:/# ls –l /home
-rwxr-xr-x         1    kusdi    kusdi    juli 09 2013            /home/test



Selamat Mencoba


Mounting hardisk otomatis pada ubuntu


Memang Ubuntu menyediakan kemudahan untuk mounting media baca tulis seperti hardisk misalnya, sayangnya untuk hardisk yang terpasang di Ubuntu seringkali harus di mount dengan cara di klik, dan sistem meminta password user. Hal ini tidak saja tidak praktis, namun juga menjengkelkan saat kita punya referensi file ke hardisk tersebut yang tidak segera bisa diakses karena harus di mounting dahulu.
Namun permasalahan itu bisa dipecahkan dengan mudah, dari hasil pencarian di google, maka dapat disimpulkan cara yang paling gampang sebagai berikut.

1. Mendapatkan informasi nama hardisk dan lokasinya, pada terminal ketik perintah:

sudo fdisk -l

2. Akan keluar seperti yang saya contohkan di dalam sistem saya:

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        6374    51199123+   7  HPFS/NTFS
/dev/sda2            6375       30401   192996877+   f  W95 Ext'd (LBA)
/dev/sda5            6375       25138   150721798+   7  HPFS/NTFS
/dev/sda6           25139       30180    40499833+  83  Linux
/dev/sda7           30181       30401     1775151   82  Linux swap / Solaris

Yang saya highlight adalah partisi yang hendak saya mounting secara otomatis, jadi pastikan kamu memilih mounting yang diinginkan.

3. Langkah selanjutnya membuat mount point (folder), hal ini perlu karena linux memperlakukan semua device (termasuk hardisk) sebagai folder.
Dalam hal ini saya membuat mount point dengan nama hardisk,
sebelumnya ubah direktori kerja ke /media, karena di situ letak semua mounting point device, ketik perintah:

cd /media

lalu buat folder mounting point dengan nama hardisk:

sudo mkdir hardisk

4. Edit file fstab agar nantinya dikenali secara otomatis oleh sistem:

sudo gedit /etc/fstab

akan terbuka file fstab, jangan diubah apapun isi yang ada, kita hanya perlu menambahkan satu baris di bagian paling bawah:

/dev/sda5 /media/hardisk ntfs-3g defaults,locale=en_US.UTF-8 0 0

Perhatikan bahwa saya memilih sda5 sebagai partisi yang akan dimounting secara otomatis pada folder mounting point hardisk, kebetulan saya menggunakan format NTFS, jika hardisk kamu format dengan EXT3 gunakan:

/dev/sda5 /media/hardisk ext3 defaults,errors=remount-ro,users,user_xattr,user 0 0

untuk EXT4 ganti ext3 dengan ext4. Atau jika kamu memakai FAT32, gunakan:

/dev/sda5 /media/hardisk vfat umask=000 0 0

simpan dan tutup jendela editornya.

4. Langkah terakhir, agar tidak menanyakan pasword, pastikan bahwa mounting point adalah milik user kamu, dengan perintah sebagai berikut:

sudo chown -R dhani:dhani /media/hardisk

dhani adalah username kamu di ubuntu.

Selesai dan coba restart komputer kamu, untuk membuktikan perubahannya

Reff : http://ravikhayyu.blogspot.com

Mounting USB Flash Drive in linux ubuntu


Buka terminal Menggunakan

Menu: Applications menu -> Accessories -> Terminal.

Keyboard Shortcut: Ctrl + Alt + T

sudo fdisk -l

hasilnya :

Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sda1   *      0+   3647-   3648-  29295616   83  Linux
/dev/sda2       3647+  35266-  31619- 253976577    5  Extended
/dev/sda3          0       -       0          0    0  Empty
/dev/sda4          0       -       0          0    0  Empty
/dev/sda5       3647+  34041-  30395- 244140032   83  Linux
/dev/sda6      34041+  34649-    608-   4881408   82  Linux swap / Solaris
/dev/sda7      34649+  35266-    617-   4953088   83  Linux

Disk /dev/sdb: 1022 cylinders, 61 heads, 62 sectors/track
Warning: The partition table looks like it was made
  for C/H/S=*/63/62 (instead of 1022/61/62).
For this listing I'll assume that geometry.
Units = cylinders of 1999872 bytes, blocks of 1024 bytes, counting from 0

Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sdb1          0+    989-    990-   1933244+   6  FAT16
start: (c,h,s) expected (0,2,12) found (0,2,10)
end: (c,h,s) expected (989,57,56) found (958,62,62)


kemudian ikuti langkah berikut ini

Untuk  NTFS file system:

anda bisa edit file fstab pada terminal.

sudo gedit /etc/fstab

tambahkan pada bagian paling bawah script berikut ini

/dev/sdb1       /media/Data ntfs-3g  defaults  0   0


Untuk  FAT 16/32 file system , anda bisa menjalankan script ini:

sudo mount -t vfat /dev/sdb1 /media/Datas -o uid=1000,gid=100,utf8,dmask=027,fmask=137


Note: Sebelumnya anda harus membuat directory untuk mountingnya :

sudo mkdir /media/Data


kemudian jalankan mountingnya:

sudo mount -a


untuk umountingnya :

sudo umount /media/Data




Edit File Linux lewat terminal

Mungkin anda perah merasakan kesulitan ketika anda merubah sebuah file melalui terminal

berikut ini tipsnya :



sudo gedit /etc/php5/apache2/php.ini


artinya  : kita menggunakan aplikasi Gedit untuk mengubah file php.ini



.


Sunday, October 6, 2013

Cara Menghapus Semua Data pada Tabel Oracle



Menghapus semua data pada  database  Oracle Ada dua cara,
yaitu dengan menggunakan perintah  "truncate" atau dengan delete :

Contoh dengan menggunakan "truncate" :

truncate table name_table;

Contoh dengan menggunakan "delete" :


delete from name_table;

Cara Crimping Kabel UTP


Siapkan terlebih dahulu perlengkapanya :

Kabel UTP
kabel UTP

Tang Crimping
tang crimping

Konektor  RJ-45
konektor RJ-45


LAN Tester :
lan tester

CARA MEMBUATNYA : 

1. Kupas kulit kabel selebar 2 cm.
2. Susun rapi delapan kabel yang terdapat didalam sesuai dengan gambar dibawah ini :
    Ada dua macam susunan kabel yaitu crossover dan straight
    lihat gambar dibawah ini :




3. Luruskan kabel yang masih kusut.
4. Ratakan ujung kabel dengan memotong nya menggunakan tang crimping.
5. Setelah yakin urutan warna benar dan ujung kabel sudah rata, masukan kabel kedalam konektor RJ-45 , pastikan ujung kabel menyentuh ujung RJ-45, dan jepitlah menggunakan Tang Crimping.
6. Setelah menyelesaikan kedua ujung kabel, uji menggunakan Lan tester, jika semua lampu menyala, berarti kabel tersebut telah di crimping dengan benar.

Selamat Mencoba.


Thursday, September 26, 2013

install library web server pada linux

Berikut ini list library yang harus di install ketika kita membangaun web server :






apt-get install php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl



check library yang sudah terinstall melalui phpinfo.php

/etc/php5/apache2/conf.d/curl.ini,
/etc/php5/apache2/conf.d/gd.ini,
/etc/php5/apache2/conf.d/imagick.ini,
/etc/php5/apache2/conf.d/imap.ini,
/etc/php5/apache2/conf.d/interbase.ini,
/etc/php5/apache2/conf.d/intl.ini,
/etc/php5/apache2/conf.d/mcrypt.ini,
/etc/php5/apache2/conf.d/memcache.ini,
/etc/php5/apache2/conf.d/ming.ini,
/etc/php5/apache2/conf.d/mssql.ini,
/etc/php5/apache2/conf.d/mysql.ini,
/etc/php5/apache2/conf.d/mysqli.ini,
 /etc/php5/apache2/conf.d/odbc.ini,
/etc/php5/apache2/conf.d/pdo.ini,
/etc/php5/apache2/conf.d/pdo_dblib.ini,
 /etc/php5/apache2/conf.d/pdo_mysql.ini,
/etc/php5/apache2/conf.d/pdo_odbc.ini,
/etc/php5/apache2/conf.d/pdo_sqlite.ini,
/etc/php5/apache2/conf.d/ps.ini,
/etc/php5/apache2/conf.d/pspell.ini,
/etc/php5/apache2/conf.d/recode.ini,
 /etc/php5/apache2/conf.d/snmp.ini,
/etc/php5/apache2/conf.d/sqlite3.ini,
 /etc/php5/apache2/conf.d/tidy.ini,
/etc/php5/apache2/conf.d/xmlrpc.ini,
/etc/php5/apache2/conf.d/xsl.ini


Wednesday, September 25, 2013

Cara membuat bilangan prima dengan PHP

berikut ini scriptnya :












<?php
for($i=1;$i<=100;$i++){
            $a = 0;
            for($j=1;$j<=$i;$j++){
                        if($i % $j == 0){
                                    $a++;
                        }
            }
            if($a == 2){
                    echo $i.'';
            }
}
<?



Cara Membuat Bilangan Genap dengan PHP

Berikut ini scriptnya :


  <?php
  for($i=1; $i<=100; $i++)
  {
    if($i%2==0)
        echo ("$i<br>");
  }
  ?>

Cara Membuat Bilangan Ganjil dengan PHP

Cara membuat bilangan ganjil dengan PHP

  <?php
  for($i=1; $i<=100; $i++)
  {
    if($i%2==1)
        echo ("$i<br>");
  }
  ?>


$i%2 ->> artinya  nilai $1 dibagi 2 maka sisanya berapa , jika sisa hasil bagi 1= Ganjil tapi jika  0= Genap .


Get date 14 hari yang lalu pada php

Get date 14 hari yang lalu pada php












Contoh: Dua minggu setelah September 10, 2010 (i.e. +14 hari):

 <?php
 $date = date("Y-m-d", mktime(0, 0, 0, 9, 10 + 14, 2010);
 ?>

 Untuk mendapatkan Date php saja tanpa time untuk dua minggu yang lalu (+14 hari) dari hari ini:
 <?php
 $date = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d")+14, date("Y")));
 ?>

 Dan yang ini cara mendapatkan Date time  dua minggu yang lalu (+14 hari) dari hari ini

 <?php
 $date = date("Y-m-d G:i:s", mktime(date("G"), date("i"), date("s"), date("m"), date("d")-2, date("Y")));
 ?>