From php.net:
-----------------------------
If you got a server which got only one subdomain and you
can't add a subdomain you can easily create your own "subdomain
script". You may create a file "index.php" or what ever your
default filename is in the webpage root directory and add the
following PHP Code:
<?php
// Get possible subdomain
$full_url = sprintf($HTTP_HOST);
$subdomain = "";
for($i = 0;$i<=strlen($full_url);$i++)
{
$dummy = substr($full_url,$i,1);
if($dummy == ".")
{
break;
}
$subdomain = $subdomain.$dummy;
}
// Get Subdomain List
if ($subdomain <> "www")
{
switch($subdomain)
{
case "download":
$real_url = "http://www.mydomain.com/download/index.php";
break;
case "contact":
$real_url = "http://www.mydomain.com/contact.php";
break;
}
header( "location: $real_url\r\n" );
?>
-----------------------------
This might also work:
http://www.mycgiscripts.com/free-hoster.html
Finally, from phpbuilders.com:
-----------------------------
Assuming you are using BIND. You need to edit the zone file using php. This
means giving php write access to the file.
If you can do this then.........
open the file for writing using fopen
add the domain record to the end
write the file to disk.
http://uk2.php.net/manual/en/function.fopen.php
restart BIND (or make a cron job to restart it every 10 minutes perhaps)
Done
-----------------------------