Jump to content

Will this really work?


happypete

Recommended Posts

Hi,

 

I'm designing a site that contains mini-sites on sub-domains: 1.site.com, 2.site.com, 3.site.com etc...

 

Each site will use the following script to extract the sub-domain:

 

<?php
$subdir = basename(dirname(__FILE__));
echo "$subdir";
?>

 

and everything will revolve around this number, so for www.1.site.com $subdir equals 1

 

I will then use this number to relate to the table 'id' within the database to extract data:

 

$sql = "SELECT title
        FROM data
        WHERE id=$subdir"; 

 

so 1.site.com will call data from the database with id=1

 

I then use an addon domain on the sub-domain ie: thisdomain.com = 1.site.com, so thisdomain.com will extract data with id=1 from the database.

 

so my question, will this work and will it be reliable?

Link to comment
https://forums.phpfreaks.com/topic/192224-will-this-really-work/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.