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


PHP mysql_version函数代码示例

本文整理汇总了PHP中mysql_version函数的典型用法代码示例。如果您正苦于以下问题:PHP mysql_version函数的具体用法?PHP mysql_version怎么用?PHP mysql_version使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: mysql_start

function mysql_start($server = "localhost", $database = "", $username = "root", $password = "")
{
    global $sql_errors, $sql_debug, $mysql_version;
    $connect_id = @mysql_connect($server, $username, $password);
    if ($connect_id) {
        $mysql_version = floatval(mysql_version());
        if ($database) {
            if (mysql_select_db($database, $connect_id)) {
                return $connect_id;
            } else {
                # Wasnt able to select the database
                if ($sql_errors or $sql_debug) {
                    print "<b>Error:</b> Unable to connect to [{$database}] database.<br>\r\n";
                }
                return $connect_id;
            }
        } else {
            return $connect_id;
        }
    }
    if ($sql_errors or $sql_debug) {
        print "<b>Error:</b> Unable to connect to [{$server}] database server.<br>\r\n";
    }
    return 0;
}
开发者ID:madhavpanda,项目名称:iou-centerms,代码行数:25,代码来源:mysql.php

示例2: __query

 function __query($sql)
 {
     sql_open();
     if (mysql_version() >= 50503) {
         return query($sql);
     } else {
         return query(str_replace('utf8mb4', 'utf8', $sql));
     }
 }
开发者ID:0xjove,项目名称:lainchan,代码行数:9,代码来源:install.php

示例3: sql_open

function sql_open()
{
    global $pdo, $config, $debug;
    if ($pdo) {
        return true;
    }
    if ($config['debug']) {
        $start = microtime(true);
    }
    if (isset($config['db']['server'][0]) && $config['db']['server'][0] == ':') {
        $unix_socket = substr($config['db']['server'], 1);
    } else {
        $unix_socket = false;
    }
    $dsn = $config['db']['type'] . ':' . ($unix_socket ? 'unix_socket=' . $unix_socket : 'host=' . $config['db']['server']) . ';dbname=' . $config['db']['database'];
    if (!empty($config['db']['dsn'])) {
        $dsn .= ';' . $config['db']['dsn'];
    }
    try {
        $options = array(PDO::ATTR_TIMEOUT => $config['db']['timeout'], PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true);
        if ($config['db']['persistent']) {
            $options[PDO::ATTR_PERSISTENT] = true;
        }
        $pdo = new PDO($dsn, $config['db']['user'], $config['db']['password'], $options);
        if ($config['debug']) {
            $debug['time']['db_connect'] = '~' . round((microtime(true) - $start) * 1000, 2) . 'ms';
        }
        if (mysql_version() >= 50503) {
            query('SET NAMES utf8mb4') or error(db_error());
        } else {
            query('SET NAMES utf8') or error(db_error());
        }
        return $pdo;
    } catch (PDOException $e) {
        $message = $e->getMessage();
        // Remove any sensitive information
        $message = str_replace($config['db']['user'], '<em>hidden</em>', $message);
        $message = str_replace($config['db']['password'], '<em>hidden</em>', $message);
        // Print error
        if ($config['mask_db_error']) {
            error(_('Could not connect to the database. Please try again later.'));
        } else {
            error(_('Database error: ') . $message);
        }
    }
}
开发者ID:odilitime,项目名称:infinity,代码行数:46,代码来源:database.php

示例4: mysql_check_version

function mysql_check_version($version)
{
    $version = explode_version($version);
    $mysql_version = explode_version(mysql_version());
    foreach ($version as $index => $version_number) {
        if (!$version_number) {
            continue;
        }
        if ($index >= count($mysql_version)) {
            return FALSE;
        }
        $mysql_version_number = $mysql_version[$index];
        if ($version_number > $mysql_version_number) {
            return FALSE;
        }
        if ($version_number < $mysql_version_number) {
            return TRUE;
        }
    }
    return TRUE;
}
开发者ID:BackupTheBerlios,项目名称:htmlhelp-svn,代码行数:21,代码来源:mysql_util.lib.php

示例5: markup

function markup(&$body, $track_cites = false, $op = false)
{
    global $board, $config, $markup_urls;
    $modifiers = extract_modifiers($body);
    $body = preg_replace('@<tinyboard (?!escape )([\\w\\s]+)>(.+?)</tinyboard>@us', '', $body);
    $body = preg_replace('@<(tinyboard) escape ([\\w\\s]+)>@i', '<$1 $2>', $body);
    if (isset($modifiers['raw html']) && $modifiers['raw html'] == '1') {
        return array();
    }
    $body = str_replace("\r", '', $body);
    $body = utf8tohtml($body);
    if (mysql_version() < 50503) {
        $body = mb_encode_numericentity($body, array(0x10000, 0xffffff, 0, 0xffffff), 'UTF-8');
    }
    foreach ($config['markup'] as $markup) {
        if (is_string($markup[1])) {
            $body = preg_replace($markup[0], $markup[1], $body);
        } elseif (is_callable($markup[1])) {
            $body = preg_replace_callback($markup[0], $markup[1], $body);
        }
    }
    if ($config['markup_urls']) {
        $markup_urls = array();
        $body = preg_replace_callback('/((?:https?:\\/\\/|ftp:\\/\\/|irc:\\/\\/)[^\\s<>()"]+?(?:\\([^\\s<>()"]*?\\)[^\\s<>()"]*?)*)((?:\\s|<|>|"|\\.||\\]|!|\\?|,|&#44;|&quot;)*(?:[\\s<>()"]|$))/', 'markup_url', $body, -1, $num_links);
        if ($num_links > $config['max_links']) {
            error($config['error']['toomanylinks']);
        }
        if ($num_links < $config['min_links'] && $op) {
            error(sprintf($config['error']['notenoughlinks'], $config['min_links']));
        }
    }
    if ($config['markup_repair_tidy']) {
        $body = str_replace('  ', ' &nbsp;', $body);
    }
    if ($config['auto_unicode']) {
        $body = unicodify($body);
        if ($config['markup_urls']) {
            foreach ($markup_urls as &$url) {
                $body = str_replace(unicodify($url), $url, $body);
            }
        }
    }
    $tracked_cites = array();
    // Cites
    if (isset($board) && preg_match_all('/(^|\\s)&gt;&gt;(\\d+?)([\\s,.)?]|$)/m', $body, $cites, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) {
        if (count($cites[0]) > $config['max_cites']) {
            error($config['error']['toomanycites']);
        }
        $skip_chars = 0;
        $body_tmp = $body;
        $search_cites = array();
        foreach ($cites as $matches) {
            $search_cites[] = '`id` = ' . $matches[2][0];
        }
        $search_cites = array_unique($search_cites);
        $query = query(sprintf('SELECT `thread`, `id` FROM ``posts_%s`` WHERE ' . implode(' OR ', $search_cites), $board['uri'])) or error(db_error());
        $cited_posts = array();
        while ($cited = $query->fetch(PDO::FETCH_ASSOC)) {
            $cited_posts[$cited['id']] = $cited['thread'] ? $cited['thread'] : false;
        }
        foreach ($cites as $matches) {
            $cite = $matches[2][0];
            // preg_match_all is not multibyte-safe
            foreach ($matches as &$match) {
                $match[1] = mb_strlen(substr($body_tmp, 0, $match[1]));
            }
            if (isset($cited_posts[$cite])) {
                $replacement = '<a onclick="highlightReply(\'' . $cite . '\', event);" href="' . $config['root'] . $board['dir'] . $config['dir']['res'] . ($cited_posts[$cite] ? $cited_posts[$cite] : $cite) . '.html#' . $cite . '">' . '&gt;&gt;' . $cite . '</a>';
                $body = mb_substr_replace($body, $matches[1][0] . $replacement . $matches[3][0], $matches[0][1] + $skip_chars, mb_strlen($matches[0][0]));
                $skip_chars += mb_strlen($matches[1][0] . $replacement . $matches[3][0]) - mb_strlen($matches[0][0]);
                if ($track_cites && $config['track_cites']) {
                    $tracked_cites[] = array($board['uri'], $cite);
                }
            }
        }
    }
    // Cross-board linking
    if (preg_match_all('/(^|\\s)&gt;&gt;&gt;\\/(' . $config['board_regex'] . 'f?)\\/(\\d+)?([\\s,.)?]|$)/um', $body, $cites, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) {
        if (count($cites[0]) > $config['max_cites']) {
            error($config['error']['toomanycross']);
        }
        $skip_chars = 0;
        $body_tmp = $body;
        if (isset($cited_posts)) {
            // Carry found posts from local board >>X links
            foreach ($cited_posts as $cite => $thread) {
                $cited_posts[$cite] = $config['root'] . $board['dir'] . $config['dir']['res'] . ($thread ? $thread : $cite) . '.html#' . $cite;
            }
            $cited_posts = array($board['uri'] => $cited_posts);
        } else {
            $cited_posts = array();
        }
        $crossboard_indexes = array();
        $search_cites_boards = array();
        foreach ($cites as $matches) {
            $_board = $matches[2][0];
            $cite = @$matches[3][0];
            if (!isset($search_cites_boards[$_board])) {
                $search_cites_boards[$_board] = array();
            }
//.........这里部分代码省略.........
开发者ID:Cipherwraith,项目名称:infinity,代码行数:101,代码来源:functions.php

示例6: markup

function markup(&$body, $track_cites = false)
{
    global $board, $config, $markup_urls;
    $modifiers = extract_modifiers($body);
    $body = preg_replace('@<tinyboard (?!escape )([\\w\\s]+)>(.+?)</tinyboard>@us', '', $body);
    $body = preg_replace('@<(tinyboard) escape ([\\w\\s]+)>@i', '<$1 $2>', $body);
    if (isset($modifiers['raw html']) && $modifiers['raw html'] == '1') {
        return array();
    }
    $body = str_replace("\r", '', $body);
    $body = utf8tohtml($body);
    if (mysql_version() < 50503) {
        $body = mb_encode_numericentity($body, array(0x10000, 0xffffff, 0, 0xffffff), 'UTF-8');
    }
    if ($config['markup_code']) {
        $code_markup = array();
        $body = preg_replace_callback($config['markup_code'], function ($matches) use(&$code_markup) {
            $d = count($code_markup);
            $code_markup[] = $matches;
            return "<code {$d}>";
        }, $body);
    }
    foreach ($config['markup'] as $markup) {
        if (is_string($markup[1])) {
            $body = preg_replace($markup[0], $markup[1], $body);
        } elseif (is_callable($markup[1])) {
            $body = preg_replace_callback($markup[0], $markup[1], $body);
        }
    }
    if ($config['markup_urls']) {
        $markup_urls = array();
        $body = preg_replace_callback('/((?:https?:\\/\\/|ftp:\\/\\/|irc:\\/\\/)[^\\s<>()"]+?(?:\\([^\\s<>()"]*?\\)[^\\s<>()"]*?)*)((?:\\s|<|>|"|\\.||\\]|!|\\?|,|&#44;|&quot;)*(?:[\\s<>()"]|$))/', 'markup_url', $body, -1, $num_links);
        if ($num_links > $config['max_links']) {
            error($config['error']['toomanylinks']);
        }
    }
    if ($config['markup_repair_tidy']) {
        $body = str_replace('  ', ' &nbsp;', $body);
    }
    if ($config['auto_unicode']) {
        $body = unicodify($body);
        if ($config['markup_urls']) {
            foreach ($markup_urls as &$url) {
                $body = str_replace(unicodify($url), $url, $body);
            }
        }
    }
    $tracked_cites = array();
    // Cites
    if (isset($board) && preg_match_all('/(^|\\s)&gt;&gt;(\\d+?)([\\s,.)?]|$)/m', $body, $cites, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) {
        if (count($cites[0]) > $config['max_cites']) {
            error($config['error']['toomanycites']);
        }
        $skip_chars = 0;
        $body_tmp = $body;
        $search_cites = array();
        foreach ($cites as $matches) {
            $search_cites[] = '`id` = ' . $matches[2][0];
        }
        $search_cites = array_unique($search_cites);
        $query = query(sprintf('SELECT `thread`, `id` FROM ``posts_%s`` WHERE ' . implode(' OR ', $search_cites), $board['uri'])) or error(db_error());
        $cited_posts = array();
        while ($cited = $query->fetch(PDO::FETCH_ASSOC)) {
            $cited_posts[$cited['id']] = $cited['thread'] ? $cited['thread'] : false;
        }
        foreach ($cites as $matches) {
            $cite = $matches[2][0];
            // preg_match_all is not multibyte-safe
            foreach ($matches as &$match) {
                $match[1] = mb_strlen(substr($body_tmp, 0, $match[1]));
            }
            if (isset($cited_posts[$cite])) {
                $replacement = '<a onclick="highlightReply(\'' . $cite . '\');" href="' . $config['root'] . $board['dir'] . $config['dir']['res'] . link_for(array('id' => $cite, 'thread' => $cited_posts[$cite])) . '#' . $cite . '">' . '&gt;&gt;' . $cite . '</a>';
                $body = mb_substr_replace($body, $matches[1][0] . $replacement . $matches[3][0], $matches[0][1] + $skip_chars, mb_strlen($matches[0][0]));
                $skip_chars += mb_strlen($matches[1][0] . $replacement . $matches[3][0]) - mb_strlen($matches[0][0]);
                if ($track_cites && $config['track_cites']) {
                    $tracked_cites[] = array($board['uri'], $cite);
                }
            }
        }
    }
    // Cross-board linking
    if (preg_match_all('/(^|\\s)&gt;&gt;&gt;\\/(' . $config['board_regex'] . 'f?)\\/(\\d+)?([\\s,.)?]|$)/um', $body, $cites, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) {
        if (count($cites[0]) > $config['max_cites']) {
            error($config['error']['toomanycross']);
        }
        $skip_chars = 0;
        $body_tmp = $body;
        if (isset($cited_posts)) {
            // Carry found posts from local board >>X links
            foreach ($cited_posts as $cite => $thread) {
                $cited_posts[$cite] = $config['root'] . $board['dir'] . $config['dir']['res'] . ($thread ? $thread : $cite) . '.html#' . $cite;
            }
            $cited_posts = array($board['uri'] => $cited_posts);
        } else {
            $cited_posts = array();
        }
        $crossboard_indexes = array();
        $search_cites_boards = array();
        foreach ($cites as $matches) {
//.........这里部分代码省略.........
开发者ID:jejechan,项目名称:jejechan,代码行数:101,代码来源:functions.php

示例7: error

         $user_flag = $_POST['user_flag'];
         if (!isset($config['user_flags'][$user_flag])) {
             error(_('Invalid flag selection!'));
         }
         $flag_alt = isset($user_flag_alt) ? $user_flag_alt : $config['user_flags'][$user_flag];
         $post['body'] .= "\n<tinyboard flag>" . strtolower($user_flag) . "</tinyboard>" . "\n<tinyboard flag alt>" . $flag_alt . "</tinyboard>";
     } else {
         if ($config['force_flag']) {
             error(_('You must choose a flag to post on this board!'));
         }
     }
 }
 if ($config['allowed_tags'] && $post['op'] && isset($_POST['tag']) && $_POST['tag'] && isset($config['allowed_tags'][$_POST['tag']])) {
     $post['body'] .= "\n<tinyboard tag>" . $_POST['tag'] . "</tinyboard>";
 }
 if (mysql_version() >= 50503) {
     $post['body_nomarkup'] = $post['body'];
     // Assume we're using the utf8mb4 charset
 } else {
     // MySQL's `utf8` charset only supports up to 3-byte symbols
     // Remove anything >= 0x010000
     $chars = preg_split('//u', $post['body'], -1, PREG_SPLIT_NO_EMPTY);
     $post['body_nomarkup'] = '';
     foreach ($chars as $char) {
         $o = 0;
         $ord = ordutf8($char, $o);
         if ($ord >= 0x10000) {
             continue;
         }
         $post['body_nomarkup'] .= $char;
     }
开发者ID:fugeris,项目名称:8chan,代码行数:31,代码来源:post.php

示例8: mod_new_board

function mod_new_board()
{
    global $config, $board;
    if (!hasPermission($config['mod']['newboard'])) {
        error($config['error']['noaccess']);
    }
    if (isset($_POST['uri'], $_POST['title'], $_POST['subtitle'])) {
        if ($_POST['uri'] == '') {
            error(sprintf($config['error']['required'], 'URI'));
        }
        if ($_POST['title'] == '') {
            error(sprintf($config['error']['required'], 'title'));
        }
        if (!preg_match('/^' . $config['board_regex'] . '$/u', $_POST['uri'])) {
            error(sprintf($config['error']['invalidfield'], 'URI'));
        }
        $bytes = 0;
        $chars = preg_split('//u', $_POST['uri'], -1, PREG_SPLIT_NO_EMPTY);
        foreach ($chars as $char) {
            $o = 0;
            $ord = ordutf8($char, $o);
            if ($ord > 0x80) {
                $bytes += 5;
            } else {
                $bytes++;
            }
        }
        $bytes + strlen('posts_.frm');
        if ($bytes > 255) {
            error('Your filesystem cannot handle a board URI of that length (' . $bytes . '/255 bytes)');
            exit;
        }
        if (openBoard($_POST['uri'])) {
            error(sprintf($config['error']['boardexists'], $board['url']));
        }
        $query = prepare('INSERT INTO ``boards`` VALUES (:uri, :title, :subtitle)');
        $query->bindValue(':uri', $_POST['uri']);
        $query->bindValue(':title', $_POST['title']);
        $query->bindValue(':subtitle', $_POST['subtitle']);
        $query->execute() or error(db_error($query));
        modLog('Created a new board: ' . sprintf($config['board_abbreviation'], $_POST['uri']));
        if (!openBoard($_POST['uri'])) {
            error(_("Couldn't open board after creation."));
        }
        $query = Element('posts.sql', array('board' => $board['uri']));
        if (mysql_version() < 50503) {
            $query = preg_replace('/(CHARSET=|CHARACTER SET )utf8mb4/', '$1utf8', $query);
        }
        query($query) or error(db_error());
        if ($config['cache']['enabled']) {
            cache::delete('all_boards');
        }
        // Build the board
        buildIndex();
        rebuildThemes('boards');
        header('Location: ?/' . $board['uri'] . '/' . $config['file_index'], true, $config['redirect_http']);
    }
    mod_page(_('New board'), 'mod/board.html', array('new' => true, 'token' => make_secure_link_token('new-board')));
}
开发者ID:vicentil,项目名称:vichan,代码行数:59,代码来源:pages.php

示例9: mysql_version

    $table->construct_header("Message");
    $table->construct_cell('
	<form action="index.php?module=cloudflare-report_bug&action=send_report" method="post">
	<textarea rows="15" cols="4000" name="message">
Hello Nathan,

I would like to report a bug with your CloudFlare Manager plugin.

Details of the report:

(Your message here)

Server Information:

PHP Version: ' . PHP_VERSION . '
MySQL Version: ' . mysql_version() . '
MyBB Version: ' . $mybb->version . '
Plugin Version: ' . get_version() . '

Thanks.

' . $mybb->user['username'] . '
' . $mybb->settings['bburl'] . '
	</textarea><br />
	<input type="submit" name="submit" value="Send Report">
	</form>

');
    $table->construct_row();
    $table->output("Report Form");
    $page->output_footer();
开发者ID:nmalcolm,项目名称:mybb-cloudflare-manager,代码行数:31,代码来源:cloudflare_report_bug.php

示例10: header

    if (preg_match('`MSIE`', $_SERVER['HTTP_USER_AGENT'])) {
        header('Content-Disposition: inline; filename="' . $nomsql . '"');
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
        header('Pragma: public');
    } else {
        header('Content-Disposition: attachment; filename="' . $nomsql . '"');
        header('Pragma: no-cache');
    }
}
$fd = '';
$fd .= "#**************** BASE DE DONNEES " . $dbDb . " ****************" . "\n" . date("\\#\\ \\L\\e\\ \\:\\ d\\ m\\ Y\\ \\a\\ H\\h\\ i") . "\n";
if (isset($_SERVER['SERVER_NAME'])) {
    $fd .= "# Serveur : " . $_SERVER['SERVER_NAME'] . "\n";
}
$fd .= "# Version PHP : " . php_version() . "\n";
$fd .= "# Version mySQL : " . mysql_version() . "\n";
$fd .= "# Version GRR : " . affiche_version() . "\n";
if (isset($_SERVER['REMOTE_ADDR'])) {
    $fd .= "# IP Client : " . $_SERVER['REMOTE_ADDR'] . "\n";
}
$fd .= "# Fichier SQL compatible PHPMyadmin\n#\n";
$fd .= "# ******* debut du fichier ********\n";
$j = '0';
while ($j < count($liste_tables)) {
    $temp = $table_prefix . $liste_tables[$j];
    if ($structure) {
        $fd .= "#\n# Structure de la table {$temp}\n#\n";
        $fd .= "DROP TABLE IF EXISTS `{$temp}`;\n";
        // requete de creation de la table
        $query = "SHOW CREATE TABLE {$temp}";
        $resCreate = mysqli_query($GLOBALS['db_c'], $query);
开发者ID:nicolas-san,项目名称:GRRV4,代码行数:31,代码来源:admin_save_mysql.php

示例11: mysql_create_select_statement

//      $fields_to_extract = "CODE ID, name, groupno, classname, city, boxno as address, phone, fax, classcode, email, website, location";
//      $mysql_connection_id = ""; $table_to_query = $mysql_hawk_biz_db_companies_tb;
# need to set the variables $table_to_query and $select_addons before including this file
$maximum_result_pages = !$maximum_result_pages ? 10 : $maximum_result_pages;
$records_per_page = !$records_per_page ? 10 : $records_per_page;
$FORM['start'] = ($FORM['start'] == "" or $FORM['start'] < 0) ? "0" : $FORM['start'];
if ($FORM['start'] == "all") {
    $FORM['start'] = 0;
    $records_per_page = 100000000;
    $select_addons['LIMIT'] = "{$FORM['start']}, {$records_per_page}";
} else {
    $select_addons['LIMIT'] = "{$FORM['start']}, {$records_per_page}";
}
#print mysql_create_select_statement( $table_to_query, $fields_to_extract, $select_addons );
#exit;
$mysql_version = intval(mysql_version());
if ($mysql_version >= 4) {
    $time_start = microtime_float();
    $select_addons['FOUND_ROWS'] = '';
    $search_results = mysql_extract_records_where($mysql_connection_id, $table_to_query, $select_addons, $fields_to_extract);
    $total_records = mysql_select_total_records($mysql_connection_id);
    $time_end = microtime_float();
} else {
    $time_start = microtime_float();
    $search_results = mysql_extract_records_where($mysql_connection_id, $table_to_query, $select_addons, $fields_to_extract);
    if ($select_addons['LIMIT']) {
        //            $field_list = "";
        //            if ( $select_addons['LIMIT'] ) {
        //               $field_list =
        //            }
        $total_records = mysql_count_query_records($mysql_connection_id, $table_to_query, $select_addons);
开发者ID:madhavpanda,项目名称:iou-centerms,代码行数:31,代码来源:query_results_begin.php


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