Puji syukur kepada TUHAN,
Pada tanggal 28 Maret 2008 09.15 WITA Putra ke-2 kami KENZHI CHRISTIANO RICHARDO lahir dengan selamat dan sehat. Berat 2500g, panjang 46cm ditolong oleh Dokter R.B. Rattu, SPoG.
Minggu, Maret 30, 2008
KENZHI CHRISTIANO RICHARDO
Kamis, Maret 20, 2008
Gammu SMS Gateway Autorespon with PHP
- Pastikan anda sudah tahu mengenai PHP CLI, kalau belum anda wajib mengunjungi situs ini dulu http://www.php-cli.com/
- Pastikan anda tahu penggunakan Windows Task Schedule untuk pengguna Microsoft Windows dan Cron Job untuk pengguna Linux. Kalau belum ada sebaiknya kunjungi situs-situs berikut: - http://www.iopus.com/guides/winscheduler.htm - http://www.astahost.com/Cron-Jobs-Tutorial-t2324.html
- Selanjutnya pastikan anda tahu hubungan antara poin 1 & 2 diatas, kalau belum jangan malas untuk kunjungi situs berikut : http://www.devarticles.com/c/a/PHP/PHP-CLI-and-Cron/
- Pastikan juga anda sudah menguasai MySQL dasar & PHP dasar, pertanyaan mengenai penggunaan fungsi-fungsi build MySQL & PHP silahkan merujuk ke masing manual yang ada.
- Class PHP API for Gammu sudah siap digunakan, jadi kembangkan sesuai dengan kebutuhan anda, fungsi build dari class tersebut sudah cukup mengakomodir artikel ini.
- Anda kesulitan ??? sebaikanya anda tanya guru saya Mr. Goo....
*Win Path = 'C:\Program Files\httpd\www\sms' Jalankan Windows Command/CMD ketik: md C:\Program Files\httpd\www\sms *Nix Path = '/var/www/sms' mkdir /var/www/sms
CREATE DATABASE sms; USE sms; CREATE TABLE inbox ( id bigint(5) unsigned primary key auto_increment, mID varchar(80) unique, tanggal datetime default '0000-00-00 00:00:00', nomor varchar(40), pesan text, pstatus varchar(10) ); CREATE TABLE outbox ( id bigint(5) unsigned primary key auto_increment, mID varchar(80) unique, tanggal datetime default '0000-00-00 00:00:00', nomor varchar(40), pesan text, pstatus varchar(10) );
enable_sudo(0); //Set 0 for windows echo "Download SMS dari HP\n"; $data = $sms->Get(); //Download SMS dari HP //Simpan Inbox foreach ($data['Inbox'] as $inbox) { if (!mysql_query("INSERT IGNORE INTO inbox (mID, tanggal, nomor, pesan, pstatus) VALUES ('".$inbox['ID']."', '".$inbox['SentTime']."', '".$inbox['Number']."', '".$inbox['body']."', 'UnRead')")) { echo mysql_error(); } else { echo "[INBOX] ".$inbox['Number'].":".$inbox['body']."\n"; } } //Simpan Outbox foreach ($data['Outbox'] as $outbox) { if (!mysql_query("INSERT IGNORE INTO outbox (mID, tanggal, nomor, pesan, pstatus) VALUES ('".$outbox['ID']."', '".$outbox['SentTime']."', '".$outbox['Number']."', '".$outbox['body']."', '".$outbox['Status']."')")) { echo mysql_error(); } else { echo "[OUTBOX] ".$outbox['Number'].":".$outbox['body']."\n"; } } //Hapus SMS dari HP //Hilangkan tanda komentar '#' jika ingin menghapus # $sms->Del(1,$respon); //Hapus Inbox (Memory SIM) # echo "$respon\n"; # $sms->Del(2,$respon); //Hapus Outbox (Memory SIM) # echo "$respon\n"; # $sms->Del(3,$respon); //Hapus Inbox (Memory HP) # echo "$respon\n"; # $sms->Del(4,$respon); //Hapus Outbox (Memory HP) # echo "$respon\n"; sleep(5); echo "Memeriksa format SMS dari Inbox\n"; $query=mysql_query("select * from inbox where pstatus='UnRead'"); while($result=mysql_fetch_assoc($query)) { $text = explode(" ",$result['pesan']); if (strtoupper($text[0]) == "CEK" and strtoupper($text[1]) == "SALDO") { echo "FORMAT: CEK SALDO [ID_ANGGOTA]\n"; /* Kode Pemeriksaan Saldo Anggota disini jika valid berikut pesan otomatisnya */ $pesan="SALDO ANDA Rp. 123.456"; //Catatan: //Jumlah saldo diasumsikan telah dicari lewat database berdasarkan //ID_ANGGOTA = $text[2] mysql_query("INSERT INTO outbox (mID, tanggal, nomor, pesan, pstatus) VALUES ('".$result['mID']."', now(), '".$result['nomor']."', '".str_replace(array("\t","\r","\n")," ",$pesan)."', 'UnSent')"); echo "[OUTBOX] ".$result['nomor'].": $pesan\n"; } if (strtoupper($text[0]) == "REG") { echo "FORMAT: REG [NAMA] [KOTA]\n"; /* Kode Pendaftaran disini dan jika berhasil berikut pesan otomatisnya */ $pesan="Terima kasih, pendaftaran berhasil Nama: ".$text[1]." Alamat: ".$text[2]." "; mysql_query("INSERT INTO outbox (mID, tanggal, nomor, pesan, pstatus) VALUES ('".$result['mID']."', now(), '".$result['nomor']."', '".str_replace(array("\t","\r","\n")," ",$pesan)."', 'UnSent')"); echo "[OUTBOX] ".$result['nomor'].": $pesan\n"; } mysql_query("UPDATE inbox set pstatus='Read' where id='".$result['id']."'"); } sleep(5); echo "Mengirimkan SMS dari Outbox\n"; $query=mysql_query("select * from outbox where pstatus='UnSent'"); while($result=mysql_fetch_assoc($query)) { if ($sms->Send($result['nomor'],$result['pesan'],0,0,0,$respon)) { echo "[KIRIM] ".$result['nomor'].": ".$result['pesan']."\n"; echo $respon; mysql_query("UPDATE outbox set pstatus='Sent' where id='".$result['id']."'"); } else { echo $sms->Error; } } ?>
PATH\php.exe -c PATH\php_custom.ini PATH\autosms.phpCatatan: buatkan custom php.ini (beda dengan php.ini default) dan perhatikan extension_dir Kemudian tambahkan pada Windows Task Schedule lewat Command Line (Windows CMD/Command.com)
schtasks /CREATE /SC MINUTE /MO 5 /ST 12:00:00 /TN "AUTO SMS" /TR "PATH\sms.bat" /RU "System"*Nix/Linux Tambahkan pada cron job: crontab -e (Edit cront job with vi editor)
# Execute every 5 minutes */5 * * * * PATH/php PATH/autosms.phpSelamat Mencoba
Rabu, Maret 19, 2008
PHP Money Format
Sayangnya ini tidak bisa untuk Windows yang tidak memiliki C Lib. So untuk kasus ini terpaksa pake number_format :)
This the result test from manual sample
====
IDR1.234,56 Rp1.234,56 (Rp 1.234,57) (Rp********1.234,57) IDR****1234,56 The final value is IDR 1.234,5
====
Test on Linux Apache PHP5
This is php source from manual sample (edit for Indonesia Format)
<?php $number = 1234.56; // let's print the international format for the en_US locale setlocale(LC_MONETARY, 'id_ID'); echo money_format('%i', $number) . "\n"; // USD 1,234.56 // Italian national format with 2 decimals` setlocale(LC_MONETARY, 'id_ID'); echo money_format('%.2n', $number) . "\n"; // L. 1.234,56 // Using a negative number $number = -1234.5672; // US national format, using () for negative numbers // and 10 digits for left precision setlocale(LC_MONETARY, 'id_ID'); echo money_format('%(#10n', $number) . "\n"; // ($ 1,234.57) // Similar format as above, adding the use of 2 digits of right // precision and '*' as a fill character echo money_format('%=*(#10.2n', $number) . "\n"; // ($********1,234.57) // Let's justify to the left, with 14 positions of width, 8 digits of // left precision, 2 of right precision, withouth grouping character // and using the international format for the de_DE locale. setlocale(LC_MONETARY, 'id_ID'); echo money_format('%=*^-14#8.2i', 1234.56) . "\n"; // DEM 1234,56**** // Let's add some blurb before and after the conversion specification setlocale(LC_MONETARY, 'id_ID'); $fmt = 'The final value is %i (after a 10%% discount)'; echo money_format($fmt, 1234.56) . "\n"; // The final value is GBP 1,234.56 (after a 10% discount) ?>
money_format (PHP 4 >= 4.3.0, PHP 5)
money_format -- Formats a number as a currency string Description string money_format ( string format, float number )
money_format() returns a formatted version of number. This function wraps the C library function strfmon(), with the difference that this implementation converts only one number at a time.
Note: The function money_format() is only defined if the system has strfmon capabilities. For example, Windows does not, so money_format() is undefined in Windows.
Selasa, Maret 04, 2008
Nokia Unveils 'Morph' Concept Mobile Phone
Aplikasi Pengenalan Wajah menggunakan PHP
Meskipun PHP bukanlah bahasa yang paling umum digunakan untuk pengenalan wajah (Python dengan pustaka seperti OpenCV dan face_recognition le...