protect binary contents in cookies
[phpmyadmin/crack.git] / libraries / mysql_charsets.lib.php3
blobd6d212a146f9c889e2cff027df567cbcbf810836
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
5 if (!defined('PMA_MYSQL_CHARSETS_LIB_INCLUDED')){
6 define('PMA_MYSQL_CHARSETS_LIB_INCLUDED', 1);
8 $res = PMA_mysql_query('SHOW VARIABLES LIKE "character_sets";', $userlink)
9 or PMA_mysqlDie(PMA_mysql_error($userlink), 'SHOW VARIABLES LIKE "character_sets";');
10 $row = PMA_mysql_fetch_row($res);
11 @mysql_free_result($res);
12 unset($res);
14 $charsets_tmp = explode(' ', $row[1]);
15 unset($row);
17 $mysql_charsets = array();
19 for ($i = 0; isset($charsets_tmp[$i]); $i++) {
20 if (strpos(' ' . $charsets_tmp[$i], '_')) {
21 $current = substr($charsets_tmp[$i], 0, strpos($charsets_tmp[$i], '_'));
22 } else {
23 $current = $charsets_tmp[$i];
25 if (!in_array($current, $mysql_charsets)) {
26 $mysql_charsets[] = $current;
30 unset($charsets_tmp);
31 unset($i);
32 unset($current);
34 if (PMA_PHP_INT_VERSION >= 40000) {
35 sort($mysql_charsets, SORT_STRING);
36 } else {
37 sort($mysql_charsets);
40 } // $__PMA_MYSQL_CHARSETS_LIB__