Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class DATABASE_CONFIG {
- # home server
- var $home = array(
- 'driver' => 'mysql',
- 'persistent' => false,
- 'host' => 'localhost',
- 'login' => '',
- 'password' => '',
- 'database' => '_home',
- );
- # dev server
- var $dev = array(
- 'driver' => 'mysql',
- 'persistent' => false,
- 'host' => 'mysql.devsite.com',
- 'login' => '',
- 'password' => '',
- 'database' => '_dev',
- );
- # live server
- var $live = array(
- 'driver' => 'mysql',
- 'persistent' => false,
- 'host' => 'mysql.livesite.com',
- 'login' => '',
- 'password' => '',
- 'database' => '_live',
- );
- # switch between configs
- var $default = array();
- var $test = array();
- function __construct() {
- #wildcard the subdomains
- $host_r = explode('.', $_SERVER['SERVER_NAME']);
- if(count($host_r)>2) while(count($host_r)>2)array_shift($host_r);
- $mainhost = implode('.', $host_r);
- #switch between servers
- switch(strtolower($mainhost)) {
- case 'workstation':
- $this->default = $this->home;
- break;
- case 'dojoserver.com':
- $this->default = $this->live;
- break;
- case 'remotedojo.com':
- $this->default = $this->dev;
- break;
- default:
- $this->default = $this->home;
- }
- }
- #php 4 compatibility
- function DATABASE_CONFIG() {
- $this->__construct();
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement