I’m not sure how exactly should I do this. But general idea is that when someone access our script on:
– http://livescript.phpiscool.com OR any of the sub folders
The database should be normal “live” database.
But when someone is trying to enter/navigate:
– http://livescript.phpiscool.com/beta1
OR
– http://livescript.phpiscool.com/beta2
The script should use different database (“beta” database)…
We have databse configuration in config.php and it looks like that:
<?php
$db_host = "localhost";
$db_username = "tureh_user";
$db_password = "crazypssrd";
$db_name = "database_test";
?>
$_SERVER[‘REQUEST_URI’] will contain everything from the first slash after the domain onwards, so checking for it starting at position 0 with ‘/beta’ should do the job
the explicit comparison (===) means a int of 0 rather than (==) which may give a false positive on “false” if it fails to find a match