Using php to control many domains withing one web host

can build many web sites, with one web host, one site with one different domain, just using php, it can make you very happy, save your money. $arrays=array( ’www.money.com’=>’money/index.html’, ’www.insurance.com’=>’insurance/index.html’, ’www.car.com’=>’car/index.html’, ’www.travel.com’=>’travel/index.html’, ’127.0.0.1’=>’forum/index.php’, ); $url = $arrays[$_SERVER[’HTTP_HOST’]]; Header(”Location: $url”); ?>

Php generate random numbers

/*random function $length: length of needed number */ function random($length) { $hash = ”; $chars = ‘0123456789′; $max = strlen($chars) – 1; mt_srand((double)microtime() * 1000000); for($i = 0; $i < $length; $i++) { $hash .= $chars[mt_rand(0, $max)]; }

Remove hyperlinks ( A tag) from HTML

Sometimes we want to remove hyperlinks with anker text, sometimes only keep anker text, how to use php to achive this? First, only remove hyperlink, and keep anker text part, the code is: $text = ‘Test paragraph.’;

rename()

— Renames a file or directory Description bool rename ( string $oldname , string $newname [, resource $context ] ) Attempts to rename oldname to newname .

fwrite() example

Description int fwrite ( resource $handle , string $string [, int $length ] ) fwrite() writes the contents of string to the file stream pointed to by handle .