Hallo liebe Community,
ich habe folgendes Problem.
Ich habe ein plugin das eigentlich nach dem speichern der daten, die ausgewählten daten in eine 2 Tabelle speichern sollte.
hier mal mein Code:
PHP-Code:function onAfterStoreUser($user, $isnew, $succes, $msg)
{
global $mainframe;
// convert the user parameters passed to the event
// to a format the external application
$args = array();
$args['username'] = "xyz"; //$user['username'];
$args['email'] = "xyz@xyz.de"; //$user['email'];
$args['password'] = "123"; //$user['password'];
createUser2();
if ($isnew && $succes)
{
// Call a function in the external app to create the user
//createUser($user['id'], $args); Inaktiv weil createUser2 am anfang aufgerufen wird
}
else
{
// Call a function in the external app to update the user
// ThirdPartyApp::updateUser($user['id'], $args);
}
return true;
}
Die Parameter abfrage habe ich wegen Testzwecken rausgenommen und in das Array Test daten eingetragen. trotzdem will es nicht.PHP-Code:function getDB() { //Soll eine Instanz zur DB aufbauen.
$options = array();
$options['host'] = 'localhost'; //$this->params->get('db_host');
$options['user'] = '***'; //$this->params->get('db_user');
$options['password'] = '***'; //$this->params->get('db_password');
$options['database'] = '***'; //$this->params->get('db_db');
$db =& JDatabase::getInstance($option);
return $db;
}
function createUser($userid, $args) { // Will nicht deswegen createUser2
$time = JDate::toFormat();
$ip = JRequest::get('$_SERVER [ \'REMOTE_ADDR\' ]');
$db = getDB();
$sql = 'INSERT INTO `accounts`
(`acct`, `login`, `password`, `gm`, `banned`, `lastlogin`, `lastip`, `email`, `flags`, `language`)
VALUES
(\''.$user.'\', \''.$args['username'].'\', \''.$args['password'].'\', \'1\', \'0\', \''.$time.'\', \'\', \''.$args['email'].'\', \'0\', \'deDE\');';
$db->setQuery($sql);
$db->Query();
}
function createUser2() { //Testfunktion um einen Festen eintrag zu erstellen. geht auch nicht -.-
$db = getDB();
$sql = 'INSERT INTO `accounts`
(`acct`, `login`, `password`, `gm`, `banned`, `lastlogin`, `lastip`, `email`, `flags`, `language`)
VALUES
(\'123\', \'123\', \'1234\', \'1\', \'0\', \'1231-03-15 01:32:32\', \'\', \'123@123.de\', \'0\', \'deDE\')';
$db->setQuery($sql);
$db->Query();
}
Hoffe ihr könnt mir helfen.
//LÖSUNG:
Ich hatte den $options falschgeschrieben, in der getDb funktion.
Gab komischerweise keinen error aus.
Ausserdem musste ich vor alles ein plgUserGame setzen als class


LinkBack URL
About LinkBacks
Zitieren
Lesezeichen