Wells-it.com - Web Hosting

Cheating Subdomains - PHP

You are viewing this site as a guest. Join our community to get your questions answered and share knowledge. Active members may advertise and ask for a website critique.
Mark Hensler's picture

He has: 4,044 posts

Joined: Aug 2000

My host doesn't support subdomains. So I wrote this.

if the url is http://maxalbert.com it creates frames to hide http://atomicpixels.com/maxalbert/
if the url is http://lpp.maxalbert.com it creates frames to hide http://lpp.gliebster.com/
else it just goes to http://atomicpixels.com/

Anyway, it's here for all to use.

<?
if (eregi("lpp.maxalbert.com",$HTTP_HOST)) {
?>
<html>
<head>
<title>Liquid Plastic Productions</title>
</head>

<frameset rows="*,100%" >
<frame name=blanktop src="http://atomicpixels.com/maxalbert/blanktop.html" scrolling=no noresize marginheight=0 frameborder=0>
<frame name=maincontent src="http://lpp.gliebster.com" scrolling=auto noresize marginheight=0 frameborder=0>
<noframes>Sorry, this site requires frames.</noframes>
</frameset>

</html>
<?
}
elseif (eregi("maxalbert.com",$HTTP_HOST)) {
?>
<html>
<head>
<title>Max Albert .Com</title>
</head>

<frameset rows="*,100%" >
<frame name=blanktop src="http://atomicpixels.com/maxalbert/blanktop.html" scrolling=no noresize marginheight=0 frameborder=0>
<frame name=maincontent src="http://atomicpixels.com/maxalbert/home.shtml" scrolling=auto noresize marginheight=0 frameborder=0>
<noframes>Sorry, this site requires frames.</noframes>
</frameset>

</html>
<?
}
else{
header("Location: http://atomicpixels.com/home.shtml");
}
?>

'

Mark Hensler ["Max Albert"] [Email]
If there is no answer on Google, then there is no question.

They have: 21 posts

Joined: Sep 2000

Thanks, I was going to ask you for that little script.

You should also mention that wildcarding needs to be on so that *.yourdomain.com points to your domain's IP. Not all hosts are setup like that but if you manage your own DNS it should be no problem.