Hi Brad,
That sounds like a good idea however:
Where would config.php go? If it goes on the www.solution.com side of
things, then $_SERVER[HTTP_HOST] will always be www.solution.com and if
it goes on another then it would be www.example1.com.
What you have put would be the kind of solution I am looking for but its
the $_SERVER[HTTP_HOST] variable that would need to be posted through
correctly, even if using frames on www.example1.com (using them to load
www.solution.com) $_SERVER[HTTP_HOST] would still equal www.example1.com
Thanks
Kevin
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