Selasa, 28 Mei 2013


Dibawah ini merupakan contoh penggunaan  fungsi preg_match untuk memvalidasi email apakah email anda valid atau tidak.

<?php
$pattern = '/^(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){255,})(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){65,}@)(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22))(?:\\.(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22)))*@(?:(?:(?!.*[^.]{64,})(?:(?:(?:xn--)?[a-z0-9]+(?:-+[a-z0-9]+)*\\.){1,126}){1,}(?:(?:[a-z][a-z0-9]*)|(?:(?:xn--)[a-z0-9]+))(?:-+[a-z0-9]+)*)|(?:\\[(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){7})|(?:(?!(?:.*[a-f0-9][:\\]]){7,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?)))|(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){5}:)|(?:(?!(?:.*[a-f0-9]:){5,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3}:)?)))?(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))(?:\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))\\]))$/iD';

$emailaddress = 'test@gmail.com';

if (preg_match($pattern, $emailaddress) === 1) {
   echo "valid";
}
?>
Selamat Mencoba.

Selasa, 21 Mei 2013




Berikut ini adalah  cara sederhana untuk membuat auto complete pada phpdesigner 7-8
  • Dari halaman start up klik menu Project > Project Manager.
  • Buat project baru, isikan project title, arahkan project root folder ke direktori kerja anda,setelah itu tambahkan juga library sama seperti project root tadi.
  • Setelah selesai jangan lupa me load Projectnya.
Cara diatas juga berlaku jika anda ingin membuat auto complete untuk  framework seperti CI.
Selamat Mencoba

Rabu, 15 Mei 2013


Berikut ini adalah contoh program untuk menjalankan atau untuk mengimport sql file dengan php.

<?php
$mysqli = new mysqli('host', 'username', 'password', 'database');

if (mysqli_connect_error()) {
    die('Connect Error (' . mysqli_connect_errno() . ') '
            . mysqli_connect_error());
}

echo 'Success... ' . $mysqli->host_info . "<br />";
echo 'Retrieving dumpfile' . "<br />";

$sql = file_get_contents('file .sql nya');
if (!$sql){
die ('Error opening file');
}

echo 'processing file <br />';
mysqli_multi_query($mysqli,$sql);

echo 'done.';
$mysqli->close();

?>

Terima kasih.

Selasa, 14 Mei 2013

If your error in web

Uncomment the following to use a MySQL database on protection/config/main.php
                               
'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=yiidb',
'emulatePrepare' => true,
'username' => 'root',
'password' => 'your pass',
'charset' => 'utf8',
),

                If your error in console
                 Uncomment the following to use a MySQL database protection/config/console.php     
'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=yiidb',
'emulatePrepare' => true,
'username' => 'root',
'password' => 'your pass',
'charset' => 'utf8',
),
 You can change host with 127.0.0.1 
Have Nice Day
                

Senin, 13 Mei 2013

Step 1: Assigning PHP engine location path in system variable

  • Go to “My Computer” ->Right click and select "Properties"
  • Click "Advanced system settings" from left pane
  • Under "Advanced" tab click on "Environment Variables"
  • Under "System variables" scroll down and find text "Path" then Double click on it
  • Now enter your PHP engine location on end of the "variable value" field
  • i.e. for wamp entered "C:\wamp\bin\php\php5" or for xampp "C:\xampp\php". Just enter location without double quotes
  • Click ok and finally exit from this.
Step 2: Create new folder under your web root folder i.e "testyii"

Step 3: Download yii framework and extrack under web root folder
  • Go "http://www.yiiframework.com/" and download latest Yii framework zipped file
  • Unzip and rename folder to "yii"
  • Using command-
  • C:\web root>cd yii\framework\
  • C:\web root \yii\framework>yiic webapp C:\web root\testyii
  • Create a Web application under ‘C:\wamp\www\bid’? [Yes|No] y
  • Your application has been created successfully under C:\web root\testyii.

Now you are ready to browse your project by accessing the URL : http://localhost/testyii/

Sabtu, 04 Mei 2013


Winginx Portable, versatile, multiproject, fast server based on nginx!
nginx 1.2.3, PHP 5.3.15, PHP 5.4.5, Node.js 0.8.6, MySQL 5.1.62, MongoDB 2.0.6, Redis 2.4.5, memcached 1.2.6, phpMyAdmin 3.5.0, Adminer 3.3.3, RockMongo 1.1.1, phpMemcachedAdmin 1.2.1, Xdebug 2.2.1, Zend Guard Loader 5.5, ionCube 4.2.2, HostsEditor 2.0

What's new in 0.5?
Winginx 0.5: spawning PHP FastCGI, new log viewer, new settings, Redis support

nginx 1.2.3

PHP 5.3.15 and 5.4.5

Node.js 0.8.6

MongoDB 2.0.7

Redis 2.4.5 (added)

Xdebug 2.2.1

ionCube 4.2.2

ionCube for PHP 5.4 (added)

source : http://winginx.com/download
Subscribe to RSS Feed Follow me on Twitter!