Пример #1
0
    $tp->assign('mysql_checked', 'checked');
    $tp->assign('ado_access_checked', '');
    $tp->assign('mysql_display', 'block');
    $tp->assign('ado_access_display', 'none');
    $tp->assign('ado_mssql_display', 'none');
    $moduleTemplate = $tp->result();
    $moduleTitle = '数据库连接设置';
} else {
    session_start();
    if ($_POST['type']) {
        $databaseType = $_POST['type'];
    } else {
        $databaseType = $_GET['type'];
    }
    include_once 'adodb/adodb.inc.php';
    $adodb = adonewconnection($databaseType);
    $objName = 'NEAT_DB2DB_' . strtoupper($databaseType);
    include_once 'includes/class/extra/NEATDB2DB.' . $databaseType . '.class.php';
    $db2db = new $objName();
    $db2db->setADODB($adodb);
    if ($_GET['setp'] == 'testConnect') {
        $dbStatus = $db2db->testConnect();
        if (trim($_POST['MYSQL_TARGET_DB_NAME'])) {
            $TARGET_DB_NAME = trim($_POST['MYSQL_TARGET_DB_NAME']);
        } else {
            if (trim($_POST['ADO_ACCESS_TARGET_DB_HOST'])) {
                $TARGET_DB_NAME = trim($_POST['ADO_ACCESS_TARGET_DB_HOST']);
            } else {
                if (trim($_POST['ADO_MSSQL_TARGET_DB_NAME'])) {
                    $TARGET_DB_NAME = trim($_POST['ADO_MSSQL_TARGET_DB_NAME']);
                }
Пример #2
0
    case "i5":
    case "u5":
        ?>

	<h1><?php 
        echo _T("Check of the database");
        ?>
</h1>
	<p><?php 
        echo _T("Check the parameters and the existence of the database");
        ?>
</p>
<ul>
<?php 
        include "../includes/adodb/adodb.inc.php";
        $DB = adonewconnection($_POST["install_dbtype"]);
        $DB->debug = false;
        $permsdb_ok = true;
        if (!@$DB->Connect($_POST["install_dbhost"], $_POST["install_dbuser"], $_POST["install_dbpass"], $_POST["install_dbname"])) {
            $permsdb_ok = false;
            echo "<li class=\"install-bad\">" . _T("Unable to connect to the database") . "</li>";
        } else {
            echo "<li class=\"install-ok\"> " . _T("Connection to database successfull") . "</li>";
            $DB->Close();
        }
        echo "</ul>";
        if (!$permsdb_ok) {
            ?>
	<p><?php 
            echo _T("Database can't be reached. Please go back to enter the connection parameters again.");
            ?>
Пример #3
0
 $sql .= $sqlRules . ' ';
 $sql .= 'ORDER BY id DESC';
 $rs = $db->query($sql, intval($_GET['start']), $eachTimes);
 switch ($DB_TYPE) {
     case 'mysql':
         $TDB = adonewconnection('mysql');
         $TDB->Connect($HOST, $USER, $PASS, $NAME);
         break;
     case 'ado_access':
         $myDSN = 'PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=' . realpath($HOST) . ';' . 'USER ID=' . $USER . ';PASSWORD='******';';
         $TDB = adonewconnection('ado_access');
         $TDB->Connect($myDSN, '', '', '');
         break;
     case 'ado_mssql':
         $myDSN = 'Driver={SQL Server};Server=' . $HOST . ';Database=' . $NAME . ';Uid=' . $USER . ';Pwd=' . $PASS . ';';
         $TDB = adonewconnection('ado_mssql');
         $TDB->Connect($myDSN, '', '', '');
         break;
     default:
         error('不可识别或者不支持的数据库类型');
         break;
 }
 $NBS = new NEATBulidSql($dbAllList['orderList'][0]);
 while ($rs->next_record()) {
     switch ($DB_TYPE) {
         case 'mysql':
             $contents['title'] = addslashes($rs->get('title'));
             $contents['body'] = addslashes($rs->get('body'));
             $contents['date'] = $rs->get('date');
             $contents['url'] = addslashes($rs->get('url'));
             $contents['author'] = addslashes($rs->get('author'));
Пример #4
0
<?php

include 'adodb.inc.php';
//include('adodb-exceptions.inc.php');
$db = adonewconnection('mysqli');
$db->connect('localhost', 'root', 'C0yote71', 'mantis_13x');
$db->debug = true;
set_error_handler(function ($errno, $errstr, $errfile, $errline, array $errcontext) {
    throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
});
try {
    $db->getAssoc('select * from mantis_user_table where 1=1');
    $db->getAssoc('select * from mantis_user_table where 0=1');
} catch (Exception $e) {
    throw $e;
    exit(1);
}