I have integrated the CMS with Phoas by modifying the config.php file and over writing with the following.
Once I find a good stable copy of Phoas with monsters and things, I'll re-release a set of code which also integrate the system
with the gold_system. In that users will bring their e107 gold into the game and game activities will also update e107 gold.
- Code: Select all
<?
@include '../class2.php';
if(!USER) {
$exit_message;
exit;
}
// Enter your MySQL settings below
$mysql_server = "";
$mysql_user = "";
$mysql_password = "";
$mysql_database = "";
// su computer user root passw '' database phaos su server user 5481 passw raist database 5481
// Enter your language (see the avaliables in the /lang directory):
$lang = "en"; // default to "en" for English -- but later select lang from users table
if(@$_COOKIE['lang']){
$lang= $_COOKIE['lang'];
}
// Enter your MySQL settings and $SITETITLE in this file
@include 'config_settings.php';
//removing 1st class security risk
if(file_exists('phaos.cfg')){
unlink('phaos.cfg');
}
$connection = mysql_connect("$mysql_server","$mysql_user","$mysql_password") or die ("Unable to connect to MySQL server.");
$db = mysql_select_db("$mysql_database") or die ("Unable to select requested database.");
//Sanity check
$query = "SELECT 1 FROM phaos_locations LIMIT 1";
$result = mysql_query($query);
if (!mysql_fetch_array($result)){
die('Missing tables in the database - please import the structure and the data.');
}
// INITIAL SETUP
define('DEBUG',intval(@$_COOKIE['_debug']));
if(DEBUG){
error_reporting(E_ALL);
}else{
error_reporting(E_ERROR | E_PARSE);
}
$PHP_PHAOS_USER = USERNAME;
//$PHP_PHAOS_USER = @$_COOKIE["PHP_PHAOS_USER"];
$PHP_PHAOS_PW = @"phaos";
$PHP_PHAOS_MD5PW = @"phaos";
$PHP_ADMIN_USER = @$_COOKIE["PHP_ADMIN_USER"];
$PHP_ADMIN_PW = @$_COOKIE["PHP_ADMIN_PW"];// for compatibility with old accounts
$PHP_ADMIN_MD5PW = @$_COOKIE["PHP_ADMIN_MD5PW"];
// FIXME: security hole
foreach($_GET as $key=>$value) {
$$key = get_magic_quotes_gpc() ? $value : addslashes($value);
}
foreach($_POST as $key=>$value) {
$$key = get_magic_quotes_gpc() ? $value : addslashes($value);
}
// Additional Security Check
unset($PHP_PHAOS_CHARID);
unset($PHP_PHAOS_CHAR);
$auth = false;
if(@$PHP_PHAOS_USER) {
$query = "SELECT * FROM phaos_users WHERE username = '$PHP_PHAOS_USER'";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
}
if(!@$row){
$username = USERNAME;
$password = 'phaos';
$email_address = USEREMAIL;
$full_name = USERNAME;
$query = "INSERT INTO phaos_users
(username,password,email_address,full_name)
VALUES
('$username','$password','$email_address','$full_name')";
$req = mysql_query($query);
$query = "SELECT * FROM phaos_users WHERE username = '$username'";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
}
if ($row) {
$auth = true;
$lang = $row['lang'];
$result = mysql_query("SELECT * FROM phaos_characters WHERE username = '$PHP_PHAOS_USER'");
if ($row = mysql_fetch_array($result)) {
$PHP_PHAOS_CHARID = $row['id'];
$PHP_PHAOS_CHAR = $row['name'];
} else {
$PHP_PHAOS_CHARID=0;
}
if(defined('AUTH')){
setcookie("PHP_PHAOS_USER",$PHP_PHAOS_USER,time()+17280000); // ( REMEMBERS USER NAME FOR 200 DAYS )
setcookie("PHP_E107_ID",USERID,time()+17280000);
setcookie("PHP_PHAOS_MD5PW",$PHP_PHAOS_MD5PW,time()+172800); // ( REMEMBERS USER PASSWORD FOR 2 DAYS )
setcookie('lang',$lang,time()+17280000); // ( REMEMBERS LANGUAGE FOR 200 DAYS )
setcookie("PHP_PHAOS_PW",0,time()-3600); // remove cookie used in version 0.88
if($_GET[play_music] == "YES") {
$play_music = $_GET[play_music];
setcookie("play_music",$play_music,time()+17280000);
} elseif($_GET[play_music] == "NO") {
$play_music = $_GET[play_music];
setcookie("play_music",$play_music,time()+17280000);
} elseif($_GET[play_music] == "") {
$play_music = $_COOKIE[play_music];
setcookie("play_music",$play_music,time()+17280000);
}
}
}
?>
