Re: PHP Template Trouble

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Yes all the sites are located on a Windows 2003 Dedicated Server.



Kevin wrote:
Sorry, made a mistake in that last post:

"even if using frames on www.example1.com (using them to load www.solution.com) $_SERVER[HTTP_HOST] would still equal www.example1.com "

It would actually equal www.solution.com once its in the frame as well not www.example1.com which is what i've put above.

Thanks

Brad Fuller wrote:
Hi,

I am trying to have 1 template site and have an unlimited number of
websites using this template site to call there own information.

The sites are exactly the same except for the database, each of the sites also needs there own URL, for example one of these urls may be www.example1.com and the other www.example2.com. These sites are identical apart from the database they call to, one will call to a database called example1 and the other example2. I want another site (for example www.solution.com) to read what url has been entered and to pull in the database for that site (either example1 or example2) and show that information. I have tried using the CURL library without success (not sure how to use it fully) and have tried using frames but had loads of problems regarding losing session data. can anyone help?

Thanks
Kev



Here's just an idea to give you maybe a starting point to go from...

<?php
// config.php

$db_host = "localhost";
$db_user = "foo";
$db_pass = "bar";

switch($_SERVER["HTTP_HOST"]){
    case "www.example1.com":
        $db_name = "example1";
        break;
    Case "www.example2.com":
        $db_name = "example2";
        break;
    case "www.template.com":
        $db_name = "template";
        break;
}
?>

<?php
// index.php

include("config.php");

$link = mysql_connect($db_host, $db_user, $db_pass);
mysql_select_db($db_name);

...

?>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux