You are herePHP

PHP


PHP: check domain availability

function check_domain($domain) {
if(preg_match('/[;\&\|\>\<]/', $domain)) exit;

exec("whois " . escapeshellarg($domain), $output);
$result = implode("\n", $output);

return (strpos($result, 'No match') !== false);
}
if( check_domain("domain.com")){
//domain.com still available
}

Setup drconcierge.org using Drupal Part 1

This is a work log on how I setup drconcierge.org.

In this part, we are going to:

Switching from Wordpress to Drupal

  1. Install latest version of drupal
  2. Install wordpress import module, and Chaos tools module
  3. Export the wordpress blog into XML and start importing. Post -> Story, Page->Page and Comment->Comment
  4. copy wp-content folder to drupal dir, so all images/uploaded files still works

The answer to “Why Do 'Cool Kids' Choose Ruby or PHP to Build Websites Instead of Java?”

This morning I'd read an article with the title: “Why Do 'Cool Kids' Choose Ruby or PHP to Build Websites Instead of Java?”, and I think I may have some opinions on this kind of topic.

Please discuss the following questions with the website owner or business owner first

  1. What is your budget and dead line for this website project?
  2. How many developers/designers involved ?

If there's system architect, ask the following questions

Using Console_Getopt to parse command line parameters in PHP

1st, make sure you have the Console_Getopt installed:

C:\php>pear list
INSTALLED PACKAGES, CHANNEL PEAR.PHP.NET:
=========================================
PACKAGE VERSION STATE
Archive_Tar 1.3.2 stable
Console_Getopt 1.2.3 stable
DB 1.7.12 stable
HTML_BBCodeParser 1.2.2 stable
Log 1.9.11 stable
Net_DNS 1.0.0 stable
PEAR 1.7.2 stable
Structures_Graph 1.0.2 stable

Here’s the sample code:

<?php

PHP or ASP.NET, skill or profession

Just read an article PHP is a skill not a profession So I did a search on hotjobs.yahoo.com and found an interesting result.

Simple function to parse RGB value

Here’s a simple function to parse RGB string (#00ff00) into array, so it can be used in GD functions.
Hope it can save a little time for you.


list($r, $g, $b)= parse_RGB("#123456");

function parse_RGB($color)
{
$r= hexdec(substr($color, 1, 2));
$g= hexdec(substr($color, 3, 2));
$b= hexdec(substr($color, 5, 2));
return array($r, $g, $b);
}

Install PDO, PDO_SQLITE, PDO_DBLIB, PDO_MYSQL

Recently I'm using PRADO framework for some web application development. It comes to deploy to the server side.
The server is running Debian 3.1r3

  • apt-get install php5-dev php5-mysql php5-sybase php5-sqlite libmysqlclient-dev freetds-dev
  • apt-get install make
  • pecl install PDO
  • pecl install PDO_SQLITE
  • pecl install PDO_MYSQL
  • pecl install PDO_DBLIB
At the last step, it report:
pear/PDO_DBLIB requires PHP extension "pdo" (version >= 1.0)
No valid packages found
install failed