Senin, 19 Desember 2011

How To Create Array to XML with PHP

Tidak ada komentar:
How to Create Array to XML with PHP

Extensible Markup Language (XML) is a markup language which defines a set of rules for encoding documents in a format which is both human-readable and machine-readable. It is defined in the XML 1.0 Specification produced by the W3C, and several other related specifications, all  open standards.

<?php
$data = array(
  'name' => array(
    'first' => 'Randy',
    'last' => 'Septian'
  ),
  'phone' => array(
    'personal' => array(
      'mobile' => '085687xxxxx',
      'home' => '0217788xxxx'
    ),
    'office' => array(
      'fax' => '0217788xxxx'
    )
  ),
  'gender' => 'male'
);

$xml = new XmlWriter();
$xml->openMemory();
$xml->startDocument('1.0', 'UTF-8');
$xml->startElement('root');

function write(XMLWriter $xml, $data){
    foreach($data as $key => $value){
        if(is_array($value)){
            $xml->startElement($key);
            write($xml, $value);
            $xml->endElement();
            continue;
        }
        $xml->writeElement($key, $value);
    }
}
write($xml, $data);
$xml->endElement();
echo $xml->outputMemory(true);
?>

Minggu, 11 Desember 2011

Get Date Yesterday in PHP

Tidak ada komentar:
 How to get date of yesterday in php ??
$yesterday = date("Y-m-d",strtotime("-1 day"));

echo $yesterday;

Selasa, 06 Desember 2011

Mami Kamada performe di Lagu Pembuka "Shakugan no Shana III"

Tidak ada komentar:


Mami Kawada dikonfirmasi di akun Twitter-nya hari ini bahwa dia akan melakukan pembukaan baru tema untuk Shakugan no Shana III (Final)anime.
Single baru, berjudul "serment" (bahasa Perancis untuk "sumpah"), akan dijual 1 Februari. Sebelumnya, Kawada telah melakukan beberapa tema lagu untuk dua seri anime sebelumnya dan pro.
Shakugan no Shana Yuji Sakai berikut, seorang anak muda sekolah tinggi yang menjadi terlibat dalam perang antara kekuatan keseimbangan dan ketidakseimbangan dalam keberadaan. Dia segera berteman seorang gadis muda bernama Shana yang berjuang untuk menyeimbangkan kekuatan.

Kamis, 24 November 2011

How To Insert and View Vietnam Font To Mysql And PHP

Tidak ada komentar:
Later I 've got problem with Vietnam Font when I insert Vietnam font on my web, can't save on Mysql, then i change colation with utf8_general_ci


ALTER TABLE `table-name` CHANGE  `table-name`. `field_name` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL

Jumat, 18 November 2011

Download Calendar One Piece 2012

Tidak ada komentar:

One piece Calendar 2012 Download From Mediafire

PHP Error Logging Reporting Handler

Tidak ada komentar:
PHP Error, Logging, Reporting and Handler 


1. error_get_last()
example:
echo $testing;print_r(error_get_last());?>
Output :
Array([type] => 8[message] => Undefined variable: testing[file] => C:\webfolder\test.php[line] => 2)



2. error_log(error,type,destination,headers)
ParameterDescription
errorRequired. The error message to log
typeOptional. Specifies the error log type.
Possible log types:
  • 0 - Default. The error is sent to the servers logging system or a file, depending on how the error_log configuration is set in the php.ini file
  • 1 - The error is sent by email to the address in the destination parameter. This message type is the only one that uses the headers parameter
  • 2 - The error is sent through the PHP debugging connection. This option is only available in PHP 3
  • 3 - The error is added to the file destination string
destinationOptional. Specifies where to send the error message. The value of this parameter depends on the value of the "type" parameter
headersOptional. Only used if the "type" parameter is "1". Specifies additional headers, like From, Cc, and Bcc. The additional headers should be separated with a CRLF (\r\n).Note: When sending an email, it must contain a From header. This can be set with this parameter or in the php.ini file.
example:
$test=2;
if ($test>1){error_log("A custom error has been triggered",1,"someone@example.com","From: webmaster@example.com");}?>
Output:
A custom error has been triggered


3. error_reporting(report_level)
ValueConstantDescription
1E_ERRORFatal run-time errors. Errors that can not be recovered from. Execution of the script is halted
2E_WARNINGNon-fatal run-time errors. Execution of the script is not halted
4E_PARSECompile-time parse errors. Parse errors should only be generated by the parser
8E_NOTICERun-time notices. The script found something that might be an error, but could also happen when running a script normally
16E_CORE_ERRORFatal errors at PHP startup. This is like an E_ERROR in the PHP core
32E_CORE_WARNINGNon-fatal errors at PHP startup. This is like an E_WARNING in the PHP core
64E_COMPILE_ERRORFatal compile-time errors. This is like an E_ERROR generated by the Zend Scripting Engine
128E_COMPILE_WARNINGNon-fatal compile-time errors. This is like an E_WARNING generated by the Zend Scripting Engine
256E_USER_ERRORFatal user-generated error. This is like an E_ERROR set by the programmer using the PHP function trigger_error()
512E_USER_WARNINGNon-fatal user-generated warning. This is like an E_WARNING set by the programmer using the PHP function trigger_error()
1024E_USER_NOTICEUser-generated notice. This is like an E_NOTICE set by the programmer using the PHP function trigger_error()
2048E_STRICTRun-time notices. PHP suggest changes to your code to help interoperability and compatibility of the code
4096E_RECOVERABLE_ERRORCatchable fatal error. This is like an E_ERROR but can be caught by a user defined handle (see also set_error_handler())
8191E_ALLAll errors and warnings, except level E_STRICT (E_STRICT will be part of E_ALL as of PHP 6.0)
example:
//Disable error reportingerror_reporting(0);
//Report runtime errorserror_reporting(E_ERROR | E_WARNING | E_PARSE);
//Report all errorserror_reporting(E_ALL);?>


4. restore_error_handler()
example:
//custom error handler functionfunction customError($errno, $errstr, $errfile, $errline)  {  echo "Custom error: [$errno] $errstr
";
  echo " Error on line $errline in $errfile
";
  }
//set user-defined error handlerset_error_handler("customError");
$test=2;
//trigger errorif ($test>1)  {  trigger_error("A custom error has been triggered");  }
//restore built-in error handlerrestore_error_handler();
//trigger error againif ($test>1)  {  trigger_error("A custom error has been triggered");  }?>
Output
Custom error: [1024] A custom error has been triggeredError on line 14 in C:\webfolder\test.php
Notice: A custom error has been triggered in C:\webfolder\test.php on line 21

Senin, 14 November 2011

Useragent Addon for Browser Firefox

Tidak ada komentar:
Useragent Addon for Browser Firefox


If u want check for view of your web or wap on some device or other browser u can using some addon in   Firefox like User Agent Switcher or UAControl.


User Agent SwitcherThe User Agent Switcher extension adds a menu and a toolbar button to switch the user agent of a browser.install addon user agent switcher for firefox hereDownload xml device list here




UAControllerUser agent switcher addon changes the user agent globally (for every site). If you want to just change the user agent on a site-by-site basis, install the UA Control addoninstall addon user agent switcher for firefox here

Rabu, 09 November 2011

How to Disappear Home Button in Blogspot

Tidak ada komentar:

Please folow the instruction bellow :
1.  Log In to your blogger account
2. select layout design then Edit HTML
3. Do not forget to download the full template first, in case there is an error
4. check Expand Template Widget
5. Search Code bellow :
to make easy push Ctrl+F then entring thas code and ENTER.
6. when u found it delete and save
7. Done
---------------------------------------------------------------------------------------------------------
Silahkan ikuti petunjuk di bawah ini :
1. Seperti biasa Log In dulu ke akun blog
2. Pilih Rancangan lalu pilih Edit HTML
3. Jangan lupa download template lengkap dahulu, berjaga-jaga bila ada kesalahan
4. Centang Expand Template Widget
5. Carilah Kode di bawah ini :
Untuk memudahkan pencarian Tekan Ctrl+F lalu masukkan kode di atas dan tekan ENTER.
6. Setelah ketemu tinggal hapus kodenya. lalu klik Simpan Template
7. Selesai

Sabtu, 05 November 2011

Where IDM Stores Download Temporary Files

Tidak ada komentar:
Where IDM Stores Download Temporary Files ??


Im Using IDM for download files, and sometime when my download progres only few minute and.. thats stoped mybe bcause internet connection or download server and it can't resume, thats so bad :(

and i don't want lose  parts that have been downloaded


if u using windows 7 u can find your download temp files on :
C:\Users\AppData\Roaming\IDM\DwnlData

Jumat, 04 November 2011

Case Studies on PHP Website Security from XSS Attack and Sql Injection

Tidak ada komentar:
XSS (Cross Side Scripting) is a way to enter tag/script HTML  (injection) in to website for disrupt thats website.
Example attack with XSS: entered HTML or Javascript Code in some form, such like Comment Form. entered comment like this

I want to enter comment with  <script>alert('this xss attack'); </scipt>

if thats website don't have XSS filtering, when the comment appear, the alert script will working.
In PHP there are so many function, where we can use for xss attack filtering, and we can combine to make own xss filtering function



function xss_filtering($text) {
     $f = stripslashes (strip_tags (htmlspecialchars ($text, ENT_QUOTES)));
    return $f;
}
$text_comment = xss_filtering($_POST['comment']);



SQL Injection is a technic for manipulation sql command ..
Example Sql Injection in login form with " 'OR 1=1;//     " , thats logic will like this

SELECT * FROM user_table WHERE username=' ' OR 1=1;// ' AND password ='anything';

the logic is true, and whos ever can enter, ok lets make anti sql injection with PHP.

function sql_injection_filtering($data){
    $filter = mysql_real_escape_string($data);
     return $filter;
}
$username = sql_injection_filtering($_POST['username']);
$password = sql_injection_filtering($_POST['password']);
if (!ctype_alnum($username) OR !ctype_alnum($password)){
    echo "Only alpha numeric";
} else {
    echo "Login Succes";
}

Selasa, 01 November 2011

Cara Cek Pulsa Operator Indonesia

Tidak ada komentar:
Cara Cek Pulsa

Berikut ini nomor untuk cek pulsa untuk masing-masing operator.
Simpati (0812, 0813, 0811)
Cek pulsa *888#

As (0852, 0853)
Cek pulsa *888#

Mentari (0815, 0816, 0858)
Cek Pulsa *555#
Paket SMS, GPRS *555*1#

Im3 (0856, 0857)
Cek Pulsa *388#
Paket SMS, GPRS *388*1#

XL (0817, 0818, 0819, 0859, 0878)
Cek Pulsa *123#

Three (0896, 0897, 0898, 0899)
Cek pulsa *111#

Axis (0831, 0838)
Cek Pulsa *888#

Fren (0885, 0886, 0887, 0888)
Cek Pulsa 999

Smart (0881, 0882, 0883, 0884)
Cek Pulsa *999*

Flexi
Cek Pulsa *99#

Star One
Cek Pulsa *555#

Esia
Cek Pulsa *955

Hepi
Cek Pulsa 999

Minggu, 09 Oktober 2011

Disable / Enable Flashdrive on Windows 7

Tidak ada komentar:
How to Disable or Enable Flashdrive or Flashdisk on Windows 7


Start  >>  Control Panel  >> Hardware and Sound






Click Device Manager



Then Click Right on USB Mass Strorage Device and Click Disable / Enable


Kamis, 06 Oktober 2011

How to install PHP PCNTL

Tidak ada komentar:

How to install PHP-PCNTL




Create directory to your home folder or wherever you want
Ex.
me@ubuntu:# mkdir /home/me/php
Navigate to that directory.
me@ubuntu:# cd /home/me/php


Download source.
Issue command as root.
me@ubuntu:/home/me/php# sudo apt-get source php5
me@ubuntu:/home/me/php# cd php5(Release Version)/ext/pcntl
me@ubuntu:/home/me/php/php5(version)/ext/pcntl# sudo phpize
me@ubuntu:/home/me/php/php5(version)/ext/pcntl# sudo ./configure
me@ubuntu:/home/me/php/php5(version)/ext/pcntl# sudo make
me@ubuntu:/home/me/php/php5(version)/ext/pcntl# sudo make install
Copy pcntl.so to /usr/lib/php5/200***(your version)/

Ex.
me@ubuntu:/home/me/php/php5(release_version)/ext/pcntl# cp /modules/pcntl.so /usr/lib/php5/200***(your version)/

Plus:
me@ubuntu:# echo "extension=pcntl.so" > /etc/php5/conf.d/pcntl.ini
If pcntl.ini doesn't exist, create it and issue the command written above.


Manual PCNTL

Jumat, 30 September 2011

JQuery Plugin for Create Map

Tidak ada komentar:
jVectorMap

jVectorMap is a jQuery plugin employed to show vector maps and visualize data on HTML pages. It uses SVG in all modern browsers like Firefox 3 or 4, Safari, Chrome, Opera, IE9, while legacy support for older versions of IE from 6 to 8 is provided with VML.
jVectorMap


Gmap3
Gmap

Rabu, 28 September 2011

List of Famous Social Networking

Tidak ada komentar:

Badoo.com
Bebo.com
Digg.com
Douban.com
Facebook.com
Fark.com
Flickr.com
Flixster.com
Foursquare.com
Friendster.com
Gather.com
Habbo.com
Hi5.com
Hyves.nl
Identi.ca
Imvu.com
IndianPad.com
Kaixin001.com
Last.fm
Linkedin.com
Livejournal.com
Meetup.com
Metafilter.com
Mixi.jp
Mixx.com
Multiply.com
Myspace.com
Netlog.com
Newsvine.com
Ning.com
NK.pl
Odnoklassniki.ru
Plaxo.com
Plurk.com
qq.com
Reddit.com
Renren.com
Reunion.com
Skyrock.com
Sonico.com
Stumbleupon.com
Tagged.com
Taringa.net
Tribe.net
Tuenti.com
Tumblr.com
Twitter.com
Vkontakte.ru
Wayn.com
Weibo.com
Wer-kennt-wen.de
Xanga.com
Yelp.com
YouTube.com

Is REFRESH button on the Computer Really Works Improve Computer Speed​​?

Tidak ada komentar:
Most computer users, especially computer with Windows Operating System output once or even often pressing the Refresh button Right Click on the Desktop or use its shortcut keys on the keyboard function keys F5. What worries of them, probably because they do not know the real reason why they hit this button. Worse yet, those who have a strong reason why they are pressing this button actually believe in the myth is wrong about the function of the refresh button.
Keep in mind different from a desktop refresh on page refresh or reload the page in a browser. Sometimes due to heavy Internet traffic, there are Internet pages that can not be loaded completely. Refresh the browser function is to reload the page failed to load before. Meanwhile, refresh the desktop has a different function with the refresh button contained in the browser. Most new computer users or laymen, such as the author himself, at first believed that the refresh function to update or renew the standby (idle) the computer after a change and delete the previous command from the RAM, so we use a computer that will run more smoothly and faster. However, as has been previously disclosed, are a mere myth.

Desktop Refresh button functions are actually Refresh the desktop is actually used to update the display or reproduce the look of the desktop after a change. Refresh the desktop does not work to renew the condition of RAM, and do not clean your computer or your computer refreshing. Therefore, do not refresh the desktop also donate any performance improvements in computer performance.

To further facilitate you in understanding the explanation of the function of a desktop refresh button, then consider the following illustration. Sometimes when you make changes on the shortcut on the desktop, the changes do not appear instantly. In this case, then you need to do a refresh on your desktop to display the changes that have been done on the desktop.

For example, you have set the shortcut on the desktop to its name in alphabetical order. When you add a new shortcut on the desktop, new shortcut will not be directly sorted in alphabetical order, but will be at the very bottom of the list of shortcuts. If you hit the refresh button the desktop, all the shortcuts will be reset again and a new shortcut that will occupy the position corresponding abjadnya. This is a function of the actual desktop refresh button. In addition, the refresh also have the same function in Windows Explorer.

So, if you have a habit of doing refresh on your desktop many times without knowing the actual purpose and function of this button, then you should stop the habit.Because you are just wasting time and your attention to do the actual work in vain.

Senin, 26 September 2011

Running a Case Sensitive Query Select String in MySql

Tidak ada komentar:
contoh / example :
I have data in table user structure like this :
_ _ _ _ _ _ _ _ _
| ID  |  Name |
-------------------
| 1    |  Andre |
-------------------
| 2    |  andre  |
----------------------

when i using Select `ID`,`Name` from user where name = 'andre';
result is 2 row in set but i just need name 'andre' not 'Andre' , so you need case sensitive string

solution :

Select `ID`,`Name` from user where binary name = 'andre';
result is 1 row in set

Sabtu, 24 September 2011

Insert Into Mysql Using PHP Array Post

Tidak ada komentar:
Form.html

<html>
    <head><title>Tambah Blog</title></head>
<body>
<form action="insert.php" method="POST">
<table >
    <tr><td>Judul</td><td><input type="text" name="title" /></td></tr>
<tr><td>Text</td><td><input type="text" name="text" /></td></tr>
<tr><td></td><td><input type="submit" value="Save" /></td></tr>
</form>
</body>
</html>

Important !!! name of filed in database must same as form field name


insert.php


<?php
foreach ($_POST as $field=>$value) {
$fields[] = '`' . $field . '`';
                $values[] = "'" . mysql_real_escape_string($value) . "'";
                   
                }
                $field_list = join(',', $fields);
                $value_list = join(', ', $values);
                $sql = "INSERT INTO `" . $table . "` (" . $field_list . ") VALUES (" . $value_list . ")";
                mysql_query($sql);
                echo mysql_error();

Support Independence for Palestine

Tidak ada komentar:
Register on this  web http://www.avaaz.org/en/independence_for_palestine_en/ and hope independence for Palestine

Posting HTML Code to Blog

4 komentar:
using this web http://centricle.com/tools/html-entities/ for encode and decode your HTML Code..

Random PHP Code with Capital, Text and Number

Tidak ada komentar:

<?php
function createRandomPassword($long=4) {
    $charsL = "abcdefghijklmnopqrstuvwxyz";
$charsU = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$int = "0123456789";
    srand((double)microtime()*1000000);
    $i = 1;
    $pass = '' ;
$randStart = rand(1,3);
    while ($i <= $long) {
   
if ($randStart == 1){
$num = rand() % 26;
$tmp = substr($charsL, $num, 1);
}
if ($randStart == 2){
$num = rand() % 26;
$tmp = substr($charsU, $num, 1);
}
if ($randStart == 3){
$num = rand() % 10;
$tmp = substr($int, $num, 1);
}
        $pass = $pass . $tmp;
if ($randStart <= 2 )
$randStart = $randStart +1;
else
$randStart = $randStart -2;
        $i++;
    }
    return $pass;
}
echo createRandomPassword();  // 

Rabu, 21 September 2011

Intalasi ActiveMQ pada Ubuntu

Tidak ada komentar:
bisa di download di http://activemq.apache.org/download.html
copy folder activemq ke /opt/chmod 777 folder activemq
sudo /opt/activemq/bin/activemq start

akses http://localhost:8161/admin/ pada browser






Hiroshi Kitadani Menyanyikan Tema Baru ONE PIECE, "We Go!" Lyrics

3 komentar:

Kitadani Hiroshi  lagu baru "We Go!" Akan menjadi lagu tema untuk bab mendatang serial anime populer, ONE PIECE!
Bab, berjudul 'Saigo no Umi' Shinsekai '"(The End of the Sea “New World"), akan mulai ditayangkan pada 2 Oktober dan akan mengikuti Luffy dan teman-temannya saat mereka bersatu kembali setelah 2 tahun panjang pelatihan untuk berpetualang di dunia baru.
Tema bab ini, "We Go!", Dibuat sebagai jawaban lagu lagu tema ONE PIECE yang pertama, "Kita!". Kitadani yang vokal, lirik Shoko Fujibayashi, dan komposisi tim Kohei Tanaka sekali lagi setelah 12 tahun yang panjang.
"We Go!" Dijadwalkan untuk rilis pada 16 November. 

http://www.jpopasia.com/news/kitadani-hiroshi-sings-new-one-piece-theme-we-go::8956.html



berikut  Lyrics We Go
Aritakeno yume o kakiatsume
Sagashi mono sagashi ni yuku no sa one piece

Rashinban nante, jyutai no motto
Netsu ni ukasare, kaji o toru no sa

Hokori kabuteta, takara no chizu mo
Tashikameta no nara, densetsu jyanai!


Kojin teki na arashi wa dareka no
Bio, rizumu! nokkatte
Omoi sugose ba ii

Aritakeno yume o kakiatsume
Sagashi mono sagashi ni yuku no sa
Pocket no coin, soreto
You wanna be my friend?
We are, we are on the cruise! we are!

Zembu mani ukete, shinji chattemo
Kata wo osarete ippo lead sa

Kondo aeta nara hanasu tsumori sa
Sore kara no koto to kore kara no koto

Tsumari itsumo pinch wa dareka ni
Appeal dekiru ii chansu
Ji ishiki kajyoo ni!


Shimitareta yoru o buttobase!
Takara bako ni kyoumi wa nai kedo
Pocket ni roman, soreto
You wanna be my friend?
We are, we are on the cruise! we are!

Aritakeno yume o kakiatsume
Sagashi mono sagashi ni yuku no sa one piece

Pocket no coin, soreto
You wanna be my friend?
We are, we are on the cruise! we are!


We are! we are ...!

Selasa, 20 September 2011

Menggunakan Smarty Template Engine PHP

2 komentar:

Mengapa menggunakan Smarty?
-Memisahkan logika presentasi dari logika bisnis (Kode dan desain dipisahkan)
-Jika kita menggunakan PHP inti dengan dicampur dengan HTML kemudian berantakan untuk mengelola.
-Tidak ada pengetahuan PHP diperlukan untuk mengelola template Smarty.
-Web desainer dan pengembang PHP dapat dengan mudah bekerja dan tidak saling menyalahkan. (Ketika mereka mengembangkan website besar)

Smarty menawarkan alat
- Data granular caching
- Template warisan
- Fungsional sandboxing untuk beberapa nama

Dimana menemukan?
Download paket dari smarty.net / men-download versi yang kompatibel dengan PHP Anda.

Bagaimana menginstal?
Unzip file yang didownload ke appserv smarty Anda / folder www dan menjalankan aplikasi.

Dasar sintaks di smarty yang
Pada file index.php (Di root folder aplikasi Anda)

a) Sertakan kelas smarty (Yang libs folder).
membutuhkan ('libs / Smarty.class.php');
b) Membuat obyek untuk kelas smarty yang
$ Smarty = new Smarty;
c) Menetapkan variabel
$ Smarty-> assign ("var_name", "Smarty");

Di sini:
"Var_name" adalah untuk digunakan dalam template Smarty (. Tpl file)
"Smarty" adalah nilai yang

Tambahkan Styles dan file Javascript dalam file template (. Tpl file)
Control Structure in smarty

{literal}
<link rel="stylesheet" href="css/style.css" type="text/css">
<script>
function display(){
document.write(“Welcome to smarty”);
}
</script>
{ /literal}
Conditions
{if (condition)}
----- statements ----
{/if}

{if (condition)}
----- statements ----
{else}
----- statements ----
{/if}

{if (condition)}
----- statements ----
{elseif (condition)}
----- statements ----
{/if}
{/if}

in the conditions: “eq” is for “=”, “neq” is for “!=”

Loops
{section name=i loop=$ptquestionary}
{$ptquestionary[i]}
{/section}

http://www.9lessons.info/