示例#1
0
function createDB()
{
    global $DEBUG;
    $host = urldecode($_GET['host']);
    $name = $_GET['name'];
    $user = $_GET['user'];
    $pwd = $_GET['pwd'];
    $ret = "<p>";
    $dbExists = false;
    $con = mysql_connect($host, $user, $pwd);
    // try to connect
    if (!$con) {
        die('Could not connect: ' . mysql_error());
    }
    $dblist = mysql_list_dbs($con);
    // check if the database already exists
    while ($row = mysql_fetch_object($dblist)) {
        $db = $row->Database;
        if ($db == $name) {
            $dbExists = true;
        }
    }
    if (!$dbExists) {
        if (mysql_query("CREATE DATABASE " . $name, $con)) {
            $ret .= "Created database '{$name}' at '{$host}' for user '{$user}' with password '{$pwd}'</p>";
        } else {
            $ret .= "Error creating database: " . mysql_error() . "</p>";
        }
    } else {
        $ret .= "The database '{$name}' already exists. We are ready to create an RDF store.</p>";
    }
    mysql_close($con);
    return $ret;
}
示例#2
0
function listDbData()
{
    $link = mysqli_connect('localhost', 'root', '') or die(mysql_error());
    $db_list = mysql_list_dbs($link);
    print "<table width=100% bgcolor='BLACK' cellspacing=1 cellpadding=0>";
    print "<tr bgcolor=#BBBBBB><td align='center'>";
    print "<b>Database list</b>";
    print "</td></tr>";
    while ($row = mysqli_fetch_object($link, $db_list)) {
        print "<tr bgcolor='WHITE'><td align='center'>";
        print $row->Database;
        //echo $row->Database . "<br>";
        print "</td></tr>";
    }
    print "<tr bgcolor=#BBBBBB><td align='center'>";
    print "<b>Tables</b>";
    print "</td></tr>";
    $db_selected = mysqli_select_db('maxinedb', $link);
    $sql = "SHOW TABLES";
    $result = mysqli_query($link, $sql);
    if (!$result) {
        throw new man_exception('MySQL Error: ' . mysql_error());
    }
    while ($row = mysqli_fetch_row($link, $result)) {
        print "<tr bgcolor='WHITE'><td align='center'>";
        print $row[0] . "";
        print "</td></tr>";
    }
    print "</table>";
}
示例#3
0
文件: MYSQL.php 项目: notchent/linb
 /**
  * list all databases
  **/
 function listdbs($assoc = false)
 {
     $i = @mysql_list_dbs($this->link_id);
     $r = $this->_fetch_all($i, $assoc);
     $this->_release($i);
     return $r;
 }
示例#4
0
function listDatabases() {
global $mysqlHandle, $PHP_SELF;

echo "<h1>Database List</h1>\n";

echo "<form action='$PHP_SELF'>\n";
echo "<input type=hidden name=action value=createDB>\n";
echo "<input type=text name=dbname>\n";
echo "<input type=submit value='Create Database'>\n";
echo "</form>\n";
echo "<hr>\n";

echo "<table cellspacing=1 cellpadding=5>\n";

$pDB = mysql_list_dbs( $mysqlHandle );
$num = mysql_num_rows( $pDB );
for( $i = 0; $i < $num; $i++ ) {
  $dbname = mysql_dbname( $pDB, $i );
  echo "<tr>\n";
  echo "<td>$dbname</td>\n";
  echo "<td><a href='$PHP_SELF?action=listTables&dbname=$dbname'>Table</a></td>\n";
  echo "<td><a href='$PHP_SELF?action=dropDB&dbname=$dbname' onClick=\"return confirm('Drop Database \'$dbname\'?')\">Drop</a></td>\n";
  echo "<td><a href='$PHP_SELF?action=dumpDB&dbname=$dbname'>Dump</a></td>\n";
  echo "</tr>\n";
}
echo "</table>\n";
}
function db_mysql_listdbase()
{
    $array_modules = array();
    $link = mysql_connect(_CFG_MYSQL_SERVER, _CFG_MYSQL_USER, _CFG_MYSQL_PASSWORD);
    mysql_select_db(_CFG_MYSQL_DB, $link);
    $result = mysql_list_dbs($link);
    while ($rs = mysql_fetch_object($result)) {
        $array_modules[] = $rs->Database;
    }
    return $array_modules;
}
示例#6
0
function listDBs($connection)
{
    $dbs = array();
    $db_list = mysql_list_dbs($connection);
    while ($row = mysql_fetch_object($db_list)) {
        array_push($dbs, $row->Database);
    }
    if (count($dbs)) {
        return $dbs;
    }
}
示例#7
0
 function &MetaDatabases()
 {
     $qid = mysql_list_dbs($this->_connectionID);
     $arr = array();
     $i = 0;
     $max = mysql_num_rows($qid);
     while ($i < $max) {
         $arr[] = mysql_tablename($qid, $i);
         $i += 1;
     }
     return $arr;
 }
 public function has_database()
 {
     $password_file = $this->get_password_file();
     $database = $password_file->get_database();
     #echo "\$database: $database\n";
     $dbh = $this->get_dbh_no_db_selected();
     $db_list = mysql_list_dbs($dbh);
     while ($row = mysql_fetch_object($db_list)) {
         if ($row->Database == $database) {
             return TRUE;
         }
     }
     return FALSE;
 }
示例#9
0
function fnDatabaseExists($dbName, $oConn = '')
{
    //Verifies existence of a MySQL database
    $bRetVal = FALSE;
    if ($oConn or $oConn = @xf_db_connect(DB_HOST, DB_USER, DB_PASSWORD)) {
        $result = mysql_list_dbs($oConn);
        while ($row = xf_db_fetch_array($result, MYSQL_NUM)) {
            if ($row[0] == $dbName) {
                $bRetVal = TRUE;
            }
        }
        xf_db_free_result($result);
        xf_db_close($oConn);
    }
    return $bRetVal;
}
示例#10
0
function createDatabaseOptions($default, $host, $user, $pass)
{
    $result = "";
    if ($con = @mysql_connect($host, $user, $pass)) {
        if ($res = mysql_list_dbs($con)) {
            $items = array();
            while ($row = mysql_fetch_object($res)) {
                $items[$row->Database] = $row->Database;
            }
            $result = createOptionsFromArray($items, isset($default) ? $default : NULL);
            mysql_free_result($res);
        }
        mysql_close($con);
    }
    return $result;
}
示例#11
0
function get_db_list()
{
    global $hostname;
    global $username;
    global $password;
    global $db_remove_list;
    $conn = mysql_connect($hostname, $username, $password);
    $db_list = mysql_list_dbs($conn);
    $html = "<ul id='user_list'>";
    while ($row = mysql_fetch_object($db_list)) {
        $db_name = $row->Database;
        if (!preg_match($db_remove_list, $db_name)) {
            $html .= "<li ><a href=\"tables.php?q={$db_name}\" target=\"form\">{$db_name}</a></li>\n";
        }
    }
    $html .= "</ul>";
    return $html;
}
示例#12
0
function dbconnect($host, $uname, $passwd, $mydb)
{
    global $dbarr;
    $db = mysql_connect($host, $uname, $passwd);
    $db_list = mysql_list_dbs($db);
    echo "\nDatabases: <select name=\"sel_db\" onChange=\"JavaScript:form.submit();\">\n";
    echo "<option value=\"\">select database ....</option>\n";
    while ($row = mysql_fetch_object($db_list)) {
        foreach ($dbarr as $myvalue) {
            if ($row->Database == $myvalue) {
                if ($mydb == "{$row->Database}") {
                    echo "<option value=\"{$row->Database}\" selected>{$row->Database}</option>\n";
                } else {
                    echo "<option value=\"{$row->Database}\">{$row->Database}</option>\n";
                }
            }
        }
    }
    echo "</select>";
}
示例#13
0
 public function setDBName($dbName = '*')
 {
     if ($dbName == '*') {
         $rs = mysql_list_dbs();
         $rows = mysql_num_rows($rs);
         if ($rows) {
             for ($i = 0; $i < $rows; $i++) {
                 $dbName = mysql_tablename($rs, $i);
                 $block = array('information_schema', 'mysql');
                 if (!in_array($dbName, $block)) {
                     $this->dbName[] = $dbName;
                 }
             }
         } else {
             $this->error('没有任何数据库!');
         }
     } else {
         $this->dbName = func_get_args();
     }
 }
示例#14
0
文件: task.php 项目: 453111208/bbc
 function dbnames($options)
 {
     $options = $options['base'];
     $link = @mysql_connect($options['database.host'], $options['database.username'], $options['database.password']);
     if (!$link) {
         return array();
     } else {
         if (function_exists('mysql_list_dbs')) {
             $db_list = mysql_list_dbs($link);
         } else {
             $db_list = mysql_query('SHOW databases');
         }
         //todo: 加强兼容性
         $i = 0;
         $cnt = mysql_num_rows($db_list);
         $rows = array();
         while ($i < $cnt) {
             $dbname = trim(mysql_db_name($db_list, $i++));
             $rows[$dbname] = $dbname;
         }
         return $rows;
     }
 }
示例#15
0
 function init(&$c)
 {
     $errors = pfcContainerInterface::init($c);
     // connect to the db
     $db = $this->_connect($c);
     if ($db === FALSE) {
         $errors[] = _pfc("Mysql container: connect error");
         return $errors;
     }
     // create the db if it doesn't exists
     $db_exists = false;
     $db_list = mysql_list_dbs($db);
     while (!$db_exists && ($row = mysql_fetch_object($db_list))) {
         $db_exists = $c->container_cfg_mysql_database == $row->Database;
     }
     if (!$db_exists) {
         $query = 'CREATE DATABASE ' . $c->container_cfg_mysql_database;
         $result = mysql_query($query, $db);
         if ($result === FALSE) {
             $errors[] = _pfc("Mysql container: create database error '%s'", mysql_error($db));
             return $errors;
         }
         mysql_select_db($c->container_cfg_mysql_database, $db);
     }
     // create the table if it doesn't exists
     $query = $this->_sql_create_table;
     $query = str_replace('%engine%', $c->container_cfg_mysql_engine, $query);
     $query = str_replace('%table%', $c->container_cfg_mysql_table, $query);
     $query = str_replace('%fieldtype_server%', $c->container_cfg_mysql_fieldtype_server, $query);
     $query = str_replace('%fieldtype_group%', $c->container_cfg_mysql_fieldtype_group, $query);
     $query = str_replace('%fieldtype_subgroup%', $c->container_cfg_mysql_fieldtype_subgroup, $query);
     $query = str_replace('%fieldtype_leaf%', $c->container_cfg_mysql_fieldtype_leaf, $query);
     $query = str_replace('%fieldtype_leafvalue%', $c->container_cfg_mysql_fieldtype_leafvalue, $query);
     $query = str_replace('%fieldtype_timestamp%', $c->container_cfg_mysql_fieldtype_timestamp, $query);
     $result = mysql_query($query, $db);
     if ($result === FALSE) {
         $errors[] = _pfc("Mysql container: create table error '%s'", mysql_error($db));
         return $errors;
     }
     return $errors;
 }
示例#16
0
 function db2app()
 {
     require_once 'HTML/QuickForm.php';
     $form = new HTML_QuickForm('db2app');
     $res = mysql_list_dbs(db());
     if (!$res) {
         trigger_error(mysql_error(db()), E_USER_ERROR);
     }
     $options = array('' => 'Please Select Database ...');
     while ($row = mysql_fetch_row($res)) {
         $options[$row[0]] = $row[0];
     }
     $form->addElement('hidden', '-action', 'db2app');
     $form->addElement('select', 'database_name', 'Select Database' . $this->infoLink('archive2app.database_name'), $options, array('onchange' => 'listeners.database_name.onchange(this)'));
     $form->addElement('header', 'db_info', 'Database connection details');
     //$form->addElement('html', 'this is a test');
     $form->addElement('text', 'mysql_user', 'MySQL Username ' . $this->infoLink('archive2app.mysql_user'));
     $form->addElement('password', 'mysql_password', 'MySQL Password');
     //$form->addElement('radio','output_format','Output options','Download as tar.gz archive','download');
     //$form->addElement('radio','output_format','','Install on webserver in apps directory','install');
     $form->addElement('select', 'install_type', 'Installation type ' . $this->infoLink('archive2app.install_type'), array('' => 'Please select ...', 'download_tarball' => 'Download Tarball', 'ftp_install' => 'Install on server (using FTP)'), array('onchange' => "listeners.install_type.onchange(this);"));
     $form->addElement('header', 'ftp_info', 'FTP Connection Info');
     $form->addElement('text', 'ftp_host', 'FTP Host');
     $form->addElement('checkbox', 'ftp_ssl', 'Use SSL');
     $form->setDefaults(array('ftp_host' => DB_HOST));
     $form->addElement('text', 'ftp_path', 'FTP Path', array('size' => 50));
     $form->setDefaults(array('ftp_path' => $_SERVER['DOCUMENT_ROOT']));
     $form->addElement('text', 'ftp_username', 'FTP Username');
     $form->addElement('password', 'ftp_password', 'FTP Password');
     $form->addElement('submit', 'submit', 'Submit');
     $form->addRule('database_name', 'Please select a database', 'required', null, 'client');
     $form->addRule('mysql_user', 'Please enter a mysql username that the application can connect as.', 'required', null, 'client');
     $form->addRule('install_type', 'Please select an installation type and then click submit.', 'required', null, 'client');
     $form->setDefaults(array('mysql_user' => $_SERVER['PHP_AUTH_USER'], 'mysql_password' => $_SERVER['PHP_AUTH_PW']));
     if ($form->validate()) {
         $tarpath = $form->process(array(&$this, 'db2app__process'), true);
         header('Content-type: application/x-gzip');
         header('Content-Disposition: attachment; filename="' . basename($tarpath) . '.tar.gz"');
         echo file_get_contents($tarpath);
         exit;
     }
     require_once 'HTML/QuickForm/Renderer/Array.php';
     $renderer = new HTML_QuickForm_Renderer_Array(true, true, true);
     $form->accept($renderer);
     $context = $renderer->toArray();
     //print_r($context);
     ob_start();
     $form->display();
     $out = ob_get_contents();
     ob_end_clean();
     include 'install' . DIRECTORY_SEPARATOR . 'db2app.inc.php';
 }
示例#17
0
</head>

<body text="#000000" link="#006600" vlink="#993333" alink="#CC6600" background="rlaemb.JPG">

<?php 
$priviledge = '00';
include 'allow_to_show.inc';
?>
<form method="POST" action="php.php">
  	<p><b>The following database found in MySQL server</b>&nbsp;&nbsp;&nbsp;
    <select size="1" name="dblist">
    <?php 
//list database
$dbcont = "invalid";
include "connet_root.inc";
$result = mysql_list_dbs();
$i = 0;
while ($i < mysql_num_rows($result)) {
    $tb_names[$i] = mysql_tablename($result, $i);
    if ($i == 0) {
        echo '<option selected>';
        echo $tb_names[$i];
        echo '</option>';
    } else {
        echo '<option>';
        echo $tb_names[$i];
        echo '</option>';
    }
    $i++;
}
?>
示例#18
0
function DB_Exists($db)
{
    global $config;
    if (!isset($config['dbconnection'])) {
        MSD_mysql_connect();
    }
    $erg = false;
    $dbs = mysql_list_dbs($config['dbconnection']);
    while ($row = mysql_fetch_object($dbs)) {
        if (strtolower($row->Database) == strtolower($db)) {
            $erg = true;
            break;
        }
    }
    return $erg;
}
示例#19
0
 function GetDatabaseList()
 {
     $xmlOutput = "<RESULTSET><FIELDS><FIELD><NAME>NAME</NAME></FIELD></FIELDS><ROWS>";
     $dbList = mysql_list_dbs($this->connectionId);
     while ($row = mysql_fetch_object($dbList)) {
         $xmlOutput .= "<ROW><VALUE>" . $row->Database . "</VALUE></ROW>";
     }
     $xmlOutput .= "</ROWS></RESULTSET>";
     return $xmlOutput;
 }
示例#20
0
 /**
  * Test mysql_db_name
  *
  * @return boolean
  */
 public function MySQL_Db_Name_Test()
 {
     // Connect
     list($mysql, $ourDb) = $this->_getConnection();
     $dbs1 = mysql_list_dbs();
     $dbs2 = $this->_object->mysql_list_dbs();
     $list1 = array();
     $list2 = array();
     $i = 0;
     $cnt = mysql_num_rows($dbs1);
     while ($i < $cnt) {
         $list1[] = mysql_db_name($dbs1, $i);
         $i++;
     }
     $i = 0;
     $cnt = $this->_object->mysql_num_rows($dbs2);
     while ($i < $cnt) {
         $list2[] = $this->_object->mysql_db_name($dbs2, $i);
         $i++;
     }
     return $list1 === $list2;
 }
示例#21
0
		function listDbs() {
			switch($this->type)	{
				case 'mysql':
					return $this->res = @mysql_list_dbs($this->link);
				break;
			}
			return false;
		}
示例#22
0
文件: bsn.php 项目: ForAEdesWeb/AEW4
                                 $msg .= "<td>" . $dataz . "</td>";
                             }
                             $msg .= "</tr>";
                         }
                         $msg .= "</table>";
                     } else {
                         $msg .= "<p style=\"padding:0;margin:20px 6px 0 6px;\">" . $query . ";&nbsp;&nbsp;&nbsp;<span class=\"gaya\">[</span> error <span class=\"gaya\">]</span></p>";
                     }
                 }
             }
         } else {
             $query = "SHOW PROCESSLIST;\nSHOW VARIABLES;\nSHOW STATUS;";
             $msg = "<div style=\"width:99%;padding:0 10px;\"><form action=\"?\" method=\"get\"> <input type=\"hidden\" name=\"y\" value=\"" . $pwd . "\" /> <input type=\"hidden\" name=\"x\" value=\"mysql\" /> <input type=\"hidden\" name=\"sqlhost\" value=\"" . $sqlhost . "\" /> <input type=\"hidden\" name=\"sqluser\" value=\"" . $sqluser . "\" /> <input type=\"hidden\" name=\"sqlport\" value=\"" . $sqlport . "\" /> <input type=\"hidden\" name=\"sqlpass\" value=\"" . $sqlpass . "\" /> <input type=\"hidden\" name=\"db\" value=\"" . $db . "\" /> <p><textarea name=\"sqlquery\" class=\"output\" style=\"width:98%;height:80px;\">" . $query . "</textarea></p> <p><input class=\"inputzbut\" style=\"width:80px;\" name=\"submitquery\" type=\"submit\" value=\"Go !\" /></p> </form></div> ";
             $dbs = array();
             $msg .= "<table class=\"explore\" style=\"width:99%;\"><tr><th>available databases</th></tr>";
             $hasil = @mysql_list_dbs($con);
             while (list($db) = @mysql_fetch_row($hasil)) {
                 @array_push($dbs, $db);
             }
             @sort($dbs);
             foreach ($dbs as $db) {
                 $msg .= "<tr><td><a href=\"?y=" . $pwd . "&amp;x=mysql&amp;sqlhost=" . $sqlhost . "&amp;sqluser="******"&amp;sqlpass="******"&amp;sqlport=" . $sqlport . "&amp;db=" . $db . "\">{$db}</a></td></tr>";
             }
             $msg .= "</table>";
         }
         @mysql_close($con);
     } else {
         $msg = "<p style=\"text-align:center;\">cant connect to mysql server</p>";
     }
     echo $msg;
 } else {
示例#23
0
    function availableDatabases()
    {
        $databaseArray = mysql_list_dbs( $this->DBConnection );

        if ( $this->errorNumber() != 0 )
        {
            return null;
        }

        $databases = array();
        $i = 0;
        $numRows = mysql_num_rows( $databaseArray );
        if ( count( $numRows ) == 0 )
        {
            return false;
        }

        while ( $i < $numRows )
        {
            // we don't allow "mysql" or "information_schema" database to be shown anywhere
            $curDB = mysql_db_name( $databaseArray, $i );
            if ( strcasecmp( $curDB, 'mysql' ) != 0 && strcasecmp( $curDB, 'information_schema' ) != 0 )
            {
                $databases[] = $curDB;
            }
            ++$i;
        }
        return $databases;
    }
示例#24
0
 /**
  * Get the list and number of available databases.
  *
  * @param   string   the url to go back to in case of error
  *
  * @return  boolean  always true
  *
  * @global  array    the list of available databases
  * @global  integer  the number of available databases
  */
 function PMA_availableDatabases($error_url = '')
 {
     global $dblist;
     global $num_dbs;
     $num_dbs = count($dblist);
     // 1. A list of allowed databases has already been defined by the
     //    authentification process -> gets the available databases list
     if ($num_dbs) {
         $true_dblist = array();
         for ($i = 0; $i < $num_dbs; $i++) {
             $dblink = @mysql_select_db($dblist[$i]);
             if ($dblink) {
                 $true_dblist[] = $dblist[$i];
             }
             // end if
         }
         // end for
         $dblist = array();
         $dblist = $true_dblist;
         unset($true_dblist);
         $num_dbs = count($dblist);
     } else {
         $dbs = mysql_list_dbs() or PMA_mysqlDie('', 'mysql_list_dbs()', FALSE, $error_url);
         $num_dbs = @mysql_num_rows($dbs);
         $real_num_dbs = 0;
         for ($i = 0; $i < $num_dbs; $i++) {
             $db_name_tmp = mysql_dbname($dbs, $i);
             $dblink = @mysql_select_db($db_name_tmp);
             if ($dblink) {
                 $dblist[] = $db_name_tmp;
                 $real_num_dbs++;
             }
         }
         // end for
         mysql_free_result($dbs);
         $num_dbs = $real_num_dbs;
     }
     // end else
     return TRUE;
 }
示例#25
0
文件: sp.php 项目: arrizaqu/skripsi
<script type="text/javascript" src="./jquery/jquery.js"></script>
<script type="text/javascript" src="./jquery/jquery.corner.js"></script>
<script type='text/javascript'>
$(document).ready(function(){
$('#header').corner('50px top');
$('#sidebar').corner("35px left");
$('#footer').corner('50px bottom');
$('table').corner("top");
$('#wrapper').corner('60px');
});
</script>
<head>
	
<body>
<?php 
$hasil = mysql_list_dbs($koneksi);
?>
	<div id="wrapper"> <!-- pembungkus semua halaman-->
		<div id="header">
			<h1>
			<a href="home.php">SQL-Radmin</a>
			</h1>
		</div><!-- akhir header -->
		<div id="content">		
<p>
<h3>Buat Store Procedure</h3>
<center>
<?php 
echo "" . $_GET['pesan'] . "";
?>
<form action="sp2.php" method="post">
示例#26
0
                        $count_row = mysql_fetch_array($count);
                        echo "<b>»&nbsp;<a href=\"" . $sql_surl . "sql_db=" . htmlspecialchars($sql_db) . "&sql_tbl=" . htmlspecialchars($row[0]) . "\"><b>" . htmlspecialchars($row[0]) . "</b></a> (" . $count_row[0] . ")</br></b>\n";
                        mysql_free_result($count);
                        $c++;
                    }
                    if (!$c) {
                        echo "No tables found in database.";
                    }
                }
            } else {
                ?>
<td width="1" height="100" valign="top"><a href="<?php 
                echo $sql_surl;
                ?>
"><b>Home</b></a><hr size="1" noshade><?php 
                $result = mysql_list_dbs($sql_sock);
                if (!$result) {
                    echo mysql_error();
                } else {
                    ?>
<form action="<?php 
                    echo $surl;
                    ?>
"><input type="hidden" name="act" value="sql"><input type="hidden" name="sql_login" value="<?php 
                    echo htmlspecialchars($sql_login);
                    ?>
"><input type="hidden" name="sql_passwd" value="<?php 
                    echo htmlspecialchars($sql_passwd);
                    ?>
"><input type="hidden" name="sql_server" value="<?php 
                    echo htmlspecialchars($sql_server);
示例#27
0
		</tr><tr>
		<td>Password:</td>
		<td><input type="password" name="pw" value="' . htmlspecialchars($pw) . '"></td>
		</tr><tr>
		<td>Database:</td>
        <td><input type="text" name="db" value="' . htmlspecialchars($db) . '"></td>
		</tr><tr>
		<td>Table:</td>
		<td><input type="text" name="tb" value="' . htmlspecialchars($tb) . '"></td>
		</tr>
		</table><br>
		<input type="submit" name="submit" value="Submit">
		</form>' . PHP_EOL;
} else {
    if (!isset($db)) {
        $dbs = @mysql_list_dbs($dbl);
        $num_dbs = @mysql_num_rows($dbs);
        echo '<h1>Please select a database</h1>
		<form action="' . htmlspecialchars($self) . '" method="POST">
		<input type="hidden" name="hn" value="' . htmlspecialchars($hn) . '">
		<input type="hidden" name="un" value="' . htmlspecialchars($un) . '">
		<input type="hidden" name="pw" value="' . htmlspecialchars($pw) . '">
		<table border="1" cellpadding="1" cellspacing="1" summary="Database selection">' . PHP_EOL;
        for ($i = 0; $i < $num_dbs; $i++) {
            $db = @mysql_db_name($dbs, $i);
            $checked = !strcasecmp($un, $db) ? ' checked' : '';
            $db = htmlspecialchars($db);
            echo '<tr><td><input' . $checked . ' type="radio" name="db" value="' . $db . '"></td><td>' . $db . '</td></tr>' . PHP_EOL;
        }
        echo '</table><br>
		<input type="submit" name="submit" value="Submit">
示例#28
0
 /**
  * Test mysql_db_name
  *
  * @return boolean
  */
 public function MySQL_Db_Name_Test()
 {
     // Connect
     $this->_getConnection();
     $dbs1 = mysql_list_dbs();
     $list1 = array();
     $i = 0;
     $cnt = mysql_num_rows($dbs1);
     while ($i < $cnt) {
         $list1[] = mysql_db_name($dbs1, $i);
         $i++;
     }
     return in_array('unit_sql_v_1', $list1) && in_array('unit_sql_v_2', $list1);
 }
function check_mysql_databases()
{
    $data = array();
    //session_start();
    $link = @mysql_connect($_SESSION['install_iconito']['host'], $_SESSION['install_iconito']['login'], $_SESSION['install_iconito']['password']) or die("Probl�me de base mysql");
    $db_list = @mysql_list_dbs($link);
    if ($db_list != false) {
        while ($row = mysql_fetch_object($db_list)) {
            $data[] = $row->Database;
        }
    }
    return $data;
}
示例#30
0
             $res = mysql_query("SELECT * FROM `" . $_POST['table_sel'] . "`", $connect);
             if (mysql_num_rows($res) > 0) {
                 while ($row = mysql_fetch_assoc($res)) {
                     $values = array_values($row);
                     foreach ($values as $k => $v) {
                         $values[$k] = addslashes($v);
                     }
                     $values = implode($_POST['cvs_term'], $values);
                     write($values);
                 }
             }
             break;
     }
 }
 echo "{$text}\n<table height=200 width=100%><tr><td bgcolor=green width=10%>";
 $db_list = mysql_list_dbs($connect);
 echo "<select name='db' multiple size=30>\n";
 while ($row = mysql_fetch_object($db_list)) {
     $db1 = $row->Database;
     echo "<option value='{$db1}' " . ($db1 === $_POST['db'] ? 'selected' : '') . ">{$db1}</option>\n";
 }
 echo "</select></td><td bgcolor=#CBC3B6>\n";
 if (!empty($_POST['db'])) {
     $tb_list = mysql_list_tables($_POST['db']);
     echo "<select name='table_sel' multiple size=30>";
     for ($i = 0; $i < mysql_num_rows($tb_list); $i++) {
         $n = mysql_fetch_array(mysql_query('select count(*) from ' . mysql_tablename($tb_list, $i)));
         echo "<option value='" . mysql_tablename($tb_list, $i) . "'" . ($tr = isset($_POST['table_sel']) && $_POST['table_sel'] === mysql_tablename($tb_list, $i) ? 'selected' : '') . ">" . mysql_tablename($tb_list, $i) . '(' . $n[0] . ")</option>";
     }
     echo "</select></td><td width=100%>\n<table  width=100% height=100% bgcolor='#E3FFF2'><tr><td height=20 bgcolor=#dfdfdf width=100%><nobr>\n";
     if (isset($_POST['table_sel'])) {