function db_exec($q, $res = 0) { global $mdb_res, $db_last_query; $res = $res ? $res : $mdb_res; /* @var $res PDO */ try { $r = $res->exec($q); } catch (PDOException $e) { echo 'Connection failed: ' . $e->getMessage(); } if (!$r) { trigger_error('failed query: ' . $q . n); trigger_error('error: ' . db_lasterror()); } return $r; }
$duser = $txpcfg['user']; $dpass = $txpcfg['pass']; $ddb = $txpcfg['db']; $ddbtype = $txpcfg['dbtype']; $lang = 'en-gb'; // just to start with @define("PFX", $txpcfg['prefix']); define('TXP_INSTALL', 1); define('txpath', $txpcfg['txpath']); include_once txpath . "/lib/mdb.php"; if (!db_connect($dhost, $duser, $dpass, $ddb)) { die('error connecting: ' . db_lasterror()); } if (!db_selectdb($ddb)) { if (!db_query('create database ' . $ddb)) { die('error selecting db: ' . db_lasterror()); } } include txpath . "/lib/txplib_misc.php"; include txpath . "/lib/txplib_html.php"; include txpath . "/lib/txplib_update.php"; // 4.0+ expects this to be set in txpsql.php $_POST['email'] = ''; include txpath . "/setup/txpsql.php"; if ($GLOBALS['txp_install_successful'] === false) { exit('install failed'); } $nonce = md5(uniqid(rand(), true)); $name = $argv[1]; $email = $argv[2]; $pass = strtolower($argv[3]);