当前位置: 首页>>代码示例>>PHP>>正文


PHP sql_db::sql_connect方法代码示例

本文整理汇总了PHP中sql_db::sql_connect方法的典型用法代码示例。如果您正苦于以下问题:PHP sql_db::sql_connect方法的具体用法?PHP sql_db::sql_connect怎么用?PHP sql_db::sql_connect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sql_db的用法示例。


在下文中一共展示了sql_db::sql_connect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

 function &getServiceInstance($name, $servicedir = NULL)
 {
     global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype;
     static $instances = array();
     static $db;
     if (!isset($db)) {
         require_once dirname(__FILE__) . '/../includes/db/' . $dbtype . '.php';
         $db = new sql_db();
         $db->sql_connect($dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist);
         if (!$db->db_connect_id) {
             message_die(CRITICAL_ERROR, "Could not connect to the database", $db);
         }
     }
     if (!isset($instances[$name])) {
         if (isset($serviceoverrules[$name])) {
             $name = $serviceoverrules[$name];
         }
         if (!class_exists($name)) {
             if (!isset($servicedir)) {
                 $servicedir = dirname(__FILE__) . '/';
             }
             require_once $servicedir . strtolower($name) . '.php';
         }
         $instances[$name] = call_user_func(array($name, 'getInstance'), $db);
     }
     return $instances[$name];
 }
开发者ID:kidwellj,项目名称:scuttle,代码行数:27,代码来源:servicefactory.php

示例2: acm

include $phpbb_root_path . 'config.' . $phpEx;
require $phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.' . $phpEx;
require $phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx;
include $phpbb_root_path . 'includes/functions.' . $phpEx;
define('ACL_NEVER', 0);
define('ACL_YES', 1);
define('ACL_NO', -1);
define('ACL_GROUPS_TABLE', $table_prefix . 'acl_groups');
define('ACL_OPTIONS_TABLE', $table_prefix . 'acl_options');
define('ACL_USERS_TABLE', $table_prefix . 'acl_users');
define('GROUPS_TABLE', $table_prefix . 'groups');
define('USERS_TABLE', $table_prefix . 'users');
$cache = new acm();
$db = new sql_db();
// Connect to DB
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
// auth => is_local, is_global
$f_permissions = array('f_' => array(1, 0), 'f_list' => array(1, 0), 'f_read' => array(1, 0), 'f_post' => array(1, 0), 'f_reply' => array(1, 0), 'f_edit' => array(1, 0), 'f_user_lock' => array(1, 0), 'f_delete' => array(1, 0), 'f_bump' => array(1, 0), 'f_poll' => array(1, 0), 'f_vote' => array(1, 0), 'f_votechg' => array(1, 0), 'f_announce' => array(1, 0), 'f_sticky' => array(1, 0), 'f_attach' => array(1, 0), 'f_download' => array(1, 0), 'f_icons' => array(1, 0), 'f_bbcode' => array(1, 0), 'f_smilies' => array(1, 0), 'f_img' => array(1, 0), 'f_flash' => array(1, 0), 'f_sigs' => array(1, 0), 'f_search' => array(1, 0), 'f_email' => array(1, 0), 'f_print' => array(1, 0), 'f_ignoreflood' => array(1, 0), 'f_postcount' => array(1, 0), 'f_noapprove' => array(1, 0), 'f_report' => array(1, 0), 'f_subscribe' => array(1, 0));
$m_permissions = array('m_' => array(1, 1), 'm_edit' => array(1, 1), 'm_delete' => array(1, 1), 'm_move' => array(1, 1), 'm_lock' => array(1, 1), 'm_split' => array(1, 1), 'm_merge' => array(1, 1), 'm_approve' => array(1, 1), 'm_unrate' => array(1, 1), 'm_auth' => array(1, 1), 'm_ip' => array(1, 1), 'm_info' => array(1, 1));
$a_permissions = array('a_' => array(0, 1), 'a_server' => array(0, 1), 'a_board' => array(0, 1), 'a_clearlogs' => array(0, 1), 'a_words' => array(0, 1), 'a_icons' => array(0, 1), 'a_bbcode' => array(0, 1), 'a_attach' => array(0, 1), 'a_email' => array(0, 1), 'a_styles' => array(0, 1), 'a_user' => array(0, 1), 'a_useradd' => array(0, 1), 'a_userdel' => array(0, 1), 'a_ranks' => array(0, 1), 'a_ban' => array(0, 1), 'a_names' => array(0, 1), 'a_group' => array(0, 1), 'a_groupadd' => array(0, 1), 'a_groupdel' => array(0, 1), 'a_forum' => array(0, 1), 'a_forumadd' => array(0, 1), 'a_forumdel' => array(0, 1), 'a_prune' => array(0, 1), 'a_auth' => array(0, 1), 'a_authmods' => array(0, 1), 'a_authadmins' => array(0, 1), 'a_authusers' => array(0, 1), 'a_authgroups' => array(0, 1), 'a_authdeps' => array(0, 1), 'a_backup' => array(0, 1), 'a_restore' => array(0, 1), 'a_search' => array(0, 1), 'a_events' => array(0, 1), 'a_cron' => array(0, 1));
$u_permissions = array('u_' => array(0, 1), 'u_sendemail' => array(0, 1), 'u_readpm' => array(0, 1), 'u_sendpm' => array(0, 1), 'u_sendim' => array(0, 1), 'u_hideonline' => array(0, 1), 'u_viewonline' => array(0, 1), 'u_viewprofile' => array(0, 1), 'u_chgavatar' => array(0, 1), 'u_chggrp' => array(0, 1), 'u_chgemail' => array(0, 1), 'u_chgname' => array(0, 1), 'u_chgpasswd' => array(0, 1), 'u_chgcensors' => array(0, 1), 'u_search' => array(0, 1), 'u_savedrafts' => array(0, 1), 'u_download' => array(0, 1), 'u_attach' => array(0, 1), 'u_sig' => array(0, 1), 'u_pm_attach' => array(0, 1), 'u_pm_bbcode' => array(0, 1), 'u_pm_smilies' => array(0, 1), 'u_pm_download' => array(0, 1), 'u_pm_edit' => array(0, 1), 'u_pm_printpm' => array(0, 1), 'u_pm_emailpm' => array(0, 1), 'u_pm_forward' => array(0, 1), 'u_pm_delete' => array(0, 1), 'u_pm_img' => array(0, 1), 'u_pm_flash' => array(0, 1));
echo "<p><b>Determining existing permissions</b></p>\n";
$sql = 'SELECT auth_option_id, auth_option FROM ' . ACL_OPTIONS_TABLE;
$result = $db->sql_query($sql);
$remove_auth_options = array();
while ($row = $db->sql_fetchrow($result)) {
    if (!in_array($row['auth_option'], array_keys(${substr($row['auth_option'], 0, 2) . 'permissions'}))) {
        $remove_auth_options[$row['auth_option']] = $row['auth_option_id'];
    }
    unset(${substr($row['auth_option'], 0, 2) . 'permissions'}[$row['auth_option']]);
}
开发者ID:BackupTheBerlios,项目名称:phpbb-hu-svn,代码行数:31,代码来源:add_permissions.php

示例3: loadDb

 /**
  * Loads self::$db if it is not loaded already.
  * Dies if the connection could not be established.
  *
  * @return void
  */
 protected static function loadDb()
 {
     global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype, $dbneedssetnames;
     if (self::$db !== null) {
         return;
     }
     include_once 'SemanticScuttle/db/' . $dbtype . '.php';
     $db = new sql_db();
     $db->sql_connect($dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist);
     if (!$db->db_connect_id) {
         message_die(CRITICAL_ERROR, 'Could not connect to the database', self::$db);
     }
     $dbneedssetnames && $db->sql_query('SET NAMES UTF8');
     self::$db = $db;
 }
开发者ID:MarxGonzalez,项目名称:SemanticScuttle,代码行数:21,代码来源:Factory.php


注:本文中的sql_db::sql_connect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。