Welcome
Welcome to the Official<strong>World of Phaos</strong>Forums.

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining the World of Phaos community for free, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. Registration is fast, simple, and absolutely free, so please, <a href="/profile.php?mode=register">join the World of Phaos community today</a>!

Integrate with e107

Updated or created a new script or part of WoP and you think the world should know, post it here and you may well see it in the next release of Phaos.
(Remember to keep all code clean and readable)

Moderators: zeke, Aradan

Integrate with e107

Postby cory_booth » Sat Sep 06, 2008 7:56 pm

I am a big time user of the e107 CMS.
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);
            }
        }
    }
?>
cory_booth
Level 1
 
Posts: 4
Joined: Wed Aug 06, 2008 11:42 am

Re: Integrate with e107

Postby nutnut » Sat Apr 11, 2009 3:11 pm

How do you get this code to work ?
nutnut
Level 1
 
Posts: 19
Joined: Sat Apr 11, 2009 2:00 pm

Re: Integrate with e107

Postby mccragge » Sat Apr 11, 2009 5:05 pm

You have to ovewrite the Phaos config.php file with the above code, but you have to fill in all your MySql database information between the empty quotes as well. As well as go down the code looking for the commented out instructions and following them.

Or at least I think, I don't use e107 CMS.

McCragge
mccragge
Level 4
 
Posts: 82
Joined: Mon Nov 10, 2008 5:46 am

Re: Integrate with e107

Postby nutnut » Sun Apr 12, 2009 1:39 pm

It dont state which config file to put this in !

E107 Config file or Phaos Config file :?:

I put it in the Phaos file & entered mysql details
i couldnt logout or do anything in phaos
was stuck on create character menu.

Will try the other way.
nutnut
Level 1
 
Posts: 19
Joined: Sat Apr 11, 2009 2:00 pm

Re: Integrate with e107

Postby nutnut » Sun Apr 12, 2009 2:34 pm

The code wont work either way

I have a e107 test site to try things out.
Sent a pm to Cory
nutnut
Level 1
 
Posts: 19
Joined: Sat Apr 11, 2009 2:00 pm

Re: Integrate with e107

Postby nutnut » Thu Apr 16, 2009 12:19 am

No reply from Cory
Has anyone else done this modification ?
nutnut
Level 1
 
Posts: 19
Joined: Sat Apr 11, 2009 2:00 pm


Return to Scripts

Who is online

Users browsing this forum: No registered users and 0 guests

cron