本文整理匯總了PHP中MSD_mysql_connect函數的典型用法代碼示例。如果您正苦於以下問題:PHP MSD_mysql_connect函數的具體用法?PHP MSD_mysql_connect怎麽用?PHP MSD_mysql_connect使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了MSD_mysql_connect函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: GetStatusLine
function GetStatusLine($kind = "php")
{
/*AUFBAU der Statuszeile:
-- Status:tabellenzahl:datensätze:Multipart:Datenbankname:script:scriptversion:Kommentar:MySQLVersion:Backupflags:SQLBefore:SQLAfter:EXTINFO
Aufbau Backupflags (1 Zeichen pro Flag, 0 oder 1, 2=unbekannt)
(complete inserts)(extended inserts)(ignore inserts)(delayed inserts)(downgrade)(lock tables)(optimize tables)
*/
global $databases, $config, $dump, $mysql_commentstring;
$t_array = explode("|", $databases['db_actual_tableselected']);
$t = 0;
$r = 0;
$t_zeile = "{$mysql_commentstring}\n{$mysql_commentstring} TABLE-INFO\n";
MSD_mysql_connect();
$res = mysql_query("SHOW TABLE STATUS FROM `" . $databases['Name'][$dump['dbindex']] . "`");
$numrows = mysql_num_rows($res);
for ($i = 0; $i < $numrows; $i++) {
$erg = mysql_fetch_array($res);
if (($databases['db_actual_tableselected'] == "" || $databases['db_actual_tableselected'] != "" && in_array($erg[0], $t_array)) && substr($erg[0], 0, strlen($databases['praefix'][$dump['dbindex']])) == $databases['praefix'][$dump['dbindex']]) {
$t++;
$r += $erg['Rows'];
$t_zeile .= "{$mysql_commentstring} TABLE|" . $erg['Name'] . "|" . $erg['Rows'] . "|" . ($erg['Data_length'] + $erg['Index_length']) . "|" . $erg['Update_time'] . "\n";
}
}
//$dump['totalrecords']=$r;
$flags = $config['backup_complete_inserts'] . $config['backup_extended_inserts'] . $config['backup_ignore_inserts'] . $config['backup_delayed_inserts'] . $config['backup_downgrade'] . $config['backup_lock_tables'] . $config['optimize_tables_beforedump'];
$mp = $config['multi_part'] == 1 ? $mp = "MP_" . ($dump['part'] - $dump['part_offset']) : "MP_0";
$statusline = "{$mysql_commentstring} Status:{$t}:{$r}:{$mp}:" . $databases['Name'][$dump['dbindex']] . ":{$kind}:" . MSD_VERSION . ":" . $dump['kommentar'] . ":";
$statusline .= MSD_MYSQL_VERSION . ":{$flags}:::EXTINFO\n" . $t_zeile . "{$mysql_commentstring}" . " EOF TABLE-INFO\n{$mysql_commentstring}\n\n";
return $statusline;
}
示例2: MSD_query
function MSD_query($query)
{
global $config;
if (!isset($config['dbconnection'])) {
MSD_mysql_connect();
}
return @mysql_query($query, $config['dbconnection']);
}
示例3: MSD_query
function MSD_query($query, $error_output = true)
{
global $config;
if (!isset($config['dbconnection'])) {
MSD_mysql_connect();
}
//echo "<br>Query: ".htmlspecialchars($query);
$res = mysql_query($query, $config['dbconnection']);
if (false === $res && $error_output) {
SQLError($query, mysql_error($config['dbconnection']));
}
return $res;
}
示例4: MSD_query
function MSD_query($query, $error_output = true)
{
global $config;
if (!isset($config['dbconnection'])) {
MSD_mysql_connect();
}
//echo "<br>Query: ".htmlspecialchars($query);
$res = mysqli_query($config['dbconnection'], $query);
if (false === $res && $error_output) {
SQLError($query, is_object($config['dbconnection']) ? mysqli_error($config['dbconnection']) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
}
return $res;
}
示例5: GetStatusLine
function GetStatusLine($kind = "php")
{
/*AUFBAU der Statuszeile:
-- Status:tabellenzahl:datensätze:Multipart:Datenbankname:script:scriptversion:Kommentar:MySQLVersion:Backupflags:SQLBefore:SQLAfter:Charset:CharsetEXTINFO
Aufbau Backupflags (1 Zeichen pro Flag, 0 oder 1, 2=unbekannt)
(complete inserts)(extended inserts)(ignore inserts)(delayed inserts)(downgrade)(lock tables)(optimize tables)
*/
global $databases, $config, $lang, $dump, $mysql_commentstring;
$t_array = explode("|", $databases['db_actual_tableselected']);
$t = 0;
$r = 0;
$t_zeile = "{$mysql_commentstring}\n{$mysql_commentstring} TABLE-INFO\r\n";
MSD_mysql_connect();
$res = mysqli_query($GLOBALS["___mysqli_ston"], "SHOW TABLE STATUS FROM `" . $databases['Name'][$dump['dbindex']] . "`");
$numrows = intval(@mysqli_num_rows($res));
for ($i = 0; $i < $numrows; $i++) {
$erg = mysqli_fetch_array($res);
// Get nr of records -> need to do it this way because of incorrect returns when using InnoDBs
$sql_2 = "SELECT count(*) as `count_records` FROM `" . $databases['Name'][$dump['dbindex']] . "`.`" . $erg['Name'] . "`";
$res2 = @mysqli_query($GLOBALS["___mysqli_ston"], $sql_2);
if ($res2 === false) {
// error reading table definition
$read_create_error = sprintf($lang['L_FATAL_ERROR_DUMP'], $databases['Name'][$dump['dbindex']], $erg['Name']) . ': ' . (is_object($config['dbconnection']) ? mysqli_error($config['dbconnection']) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
Errorlog("DUMP", $databases['Name'][$dump['dbindex']], '', $read_create_error, 0);
WriteLog($read_create_error);
if ($config['stop_with_error'] > 0) {
die($read_create_error);
}
$dump['errors']++;
//$i++; // skip corrupted table
} else {
$row2 = mysqli_fetch_array($res2);
$erg['Rows'] = $row2['count_records'];
if (($databases['db_actual_tableselected'] == '' || $databases['db_actual_tableselected'] != '' && in_array($erg[0], $t_array)) && substr($erg[0], 0, strlen($databases['praefix'][$dump['dbindex']])) == $databases['praefix'][$dump['dbindex']]) {
$t++;
$r += $erg['Rows'];
if (isset($erg['Type'])) {
$erg['Engine'] = $erg['Type'];
}
$t_zeile .= "{$mysql_commentstring} TABLE|" . $erg['Name'] . '|' . $erg['Rows'] . '|' . ($erg['Data_length'] + $erg['Index_length']) . '|' . $erg['Update_time'] . '|' . $erg['Engine'] . "\n";
}
}
}
//$dump['totalrecords']=$r;
$flags = 1;
$mp = $config['multi_part'] == 1 ? $mp = "MP_" . ($dump['part'] - $dump['part_offset']) : 'MP_0';
$statusline = "{$mysql_commentstring} Status:{$t}:{$r}:{$mp}:" . $databases['Name'][$dump['dbindex']] . ":{$kind}:" . MSD_VERSION . ":" . $dump['kommentar'] . ":";
$statusline .= MSD_MYSQL_VERSION . ":{$flags}:::" . $dump['dump_encoding'] . ":EXTINFO\n" . $t_zeile . "{$mysql_commentstring}" . " EOF TABLE-INFO\n{$mysql_commentstring}";
return $statusline;
}
示例6: DBDetailInfo
function DBDetailInfo($index)
{
global $databases, $config;
$databases['Detailinfo']['tables'] = $databases['Detailinfo']['records'] = $databases['Detailinfo']['size'] = 0;
MSD_mysql_connect();
mysql_select_db($databases['Name'][$index]);
$databases['Detailinfo']['Name'] = $databases['Name'][$index];
$res = @mysql_query('SHOW TABLE STATUS FROM `' . $databases['Name'][$index] . '`');
if ($res) {
$databases['Detailinfo']['tables'] = mysql_num_rows($res);
}
if ($databases['Detailinfo']['tables'] > 0) {
$s1 = $s2 = 0;
for ($i = 0; $i < $databases['Detailinfo']['tables']; $i++) {
$row = mysql_fetch_array($res);
$s1 += $row['Rows'];
$s2 += $row['Data_length'] + $row['Index_length'];
}
$databases['Detailinfo']['records'] = $s1;
$databases['Detailinfo']['size'] = $s2;
}
}
示例7: SearchDatabases
function SearchDatabases($printout, $db = '')
{
global $databases, $config, $lang;
if (!isset($config['dbconnection'])) {
MSD_mysql_connect();
}
$db_list = array();
if ($db > '') {
$db_list[] = $db;
// DB wurde manuell angegeben
}
// Datenbanken automatisch erkennen
$show_dbs = mysqli_query($config['dbconnection'], "SHOW DATABASES");
if (!$show_dbs === false) {
while ($row = mysqli_fetch_row($show_dbs)) {
if (trim($row[0]) > '') {
$db_list[] = $row[0];
}
}
}
$db_list = array_unique($db_list);
sort($db_list);
if (sizeof($db_list) > 0) {
$databases['db_selected_index'] = 0;
for ($i = 0; $i < sizeof($db_list); $i++) {
// Test-Select um zu sehen, ob Berechtigungen existieren
if (!@mysqli_query($config['dbconnection'], "SHOW TABLES FROM `" . $db_list[$i] . "`") === false) {
$databases['Name'][$i] = $db_list[$i];
$databases['praefix'][$i] = '';
$databases['command_before_dump'][$i] = '';
$databases['command_after_dump'][$i] = '';
if ($printout == 1) {
echo $lang['L_FOUND_DB'] . ' `' . $db_list[$i] . '`<br />';
}
} else {
if ($printout == 1) {
echo '<span class="error">' . sprintf($lang['L_DB_MANUAL_ERROR'], $db_list[$i]) . '</span><br />';
}
}
}
}
if (isset($databases['Name'][0])) {
$databases['db_actual'] = $databases['Name'][0];
}
}
示例8: ExportHTML
function ExportHTML()
{
global $sql, $config, $lang;
$header = implode("", file($config['paths']['config'] . 'html_template'));
$header = str_replace("{TITLE}", 'MSD HTML-Export', $header);
$footer = "\n\n</body>\n</html>";
$content = "";
$content .= '<h1>Datenbank ' . $sql['export']['db'] . '</h1>';
$time_start = time();
if (!isset($config['dbconnection'])) {
MSD_mysql_connect();
}
for ($table = 0; $table < count($sql['export']['tables']); $table++) {
$content .= '<h2>Tabelle ' . $sql['export']['tables'][$table] . '</h2>' . "\n";
$fsql = "show fields from `" . $sql['export']['tables'][$table] . "`";
$dsql = "select * from `" . $sql['export']['tables'][$table] . "`";
//Struktur
$res = MSD_query($fsql) or die(SQLError($fsql, mysql_error()));
if ($res) {
$field = $fieldname = $fieldtyp = array();
$structure = "<table class=\"Table\">\n";
$numfields = mysql_numrows($res);
for ($feld = 0; $feld < $numfields; $feld++) {
$row = mysql_fetch_row($res);
$field[$feld] = $row[0];
if ($feld == 0) {
$structure .= "<tr class=\"Header\">\n";
for ($i = 0; $i < count($row); $i++) {
$str = mysql_fetch_field($res, $i);
$fieldname[$i] = $str->name;
$fieldtyp[$i] = $str->type;
$structure .= "<th>" . $str->name . "</th>\n";
}
$structure .= "</tr>\n<tr>\n";
}
for ($i = 0; $i < count($row); $i++) {
$structure .= "<td class=\"Object\">" . ($row[$i] != "" ? $row[$i] : " ") . "</td>\n";
}
$structure .= "</tr>\n";
}
$structure .= "</table>\n";
}
if ($sql['export']['htmlstructure'] == 1) {
$content .= "<h3>Struktur</h3>\n" . $structure;
}
//Daten
$res = MSD_query($dsql) or die(SQLError($dsql, mysql_error()));
if ($res) {
$anz = mysql_num_rows($res);
$content .= "<h3>Daten ({$anz} Datensätze)</h3>\n";
$content .= "<table class=\"Table\">\n";
for ($feld = 0; $feld < count($field); $feld++) {
if ($feld == 0) {
$content .= "<tr class=\"Header\">\n";
for ($i = 0; $i < count($field); $i++) {
$content .= "<th>" . $field[$i] . "</th>\n";
}
$content .= "</tr>\n";
}
}
for ($d = 0; $d < $anz; $d++) {
$row = mysql_fetch_row($res);
$content .= "<tr>\n";
for ($i = 0; $i < count($row); $i++) {
$content .= '<td class="Object">' . ($row[$i] != "" ? $row[$i] : " ") . "</td>\n";
}
$content .= "</tr>\n";
}
}
$content .= "</table>";
}
CSVOutput($header . $content . $footer);
}
示例9: MSD_mysql_connect
$config['dbsocket'] = "";
}
echo '<form action="install.php?language=' . $language . '&phase=' . $phase . '" method="post">';
echo '<table class="bdr" style="width:700px;">';
echo '<tr><td>' . $lang['L_DB_HOST'] . ':</td><td><input type="text" name="dbhost" value="' . $dbhost . '" size="60" maxlength="100"></td></tr>';
echo '<tr><td>' . $lang['L_DB_USER'] . ':</td><td><input type="text" name="dbuser" value="' . $dbuser . '" size="60" maxlength="100"></td></tr>';
echo '<tr><td>' . $lang['L_DB_PASS'] . ':</td><td><input type="password" name="dbpass" value="' . $dbpass . '" size="60" maxlength="100"></td></tr>';
echo '<tr><td>* ' . $lang['L_DB'] . ':<p class="small">(' . $lang['L_ENTER_DB_INFO'] . ')</p></td><td><input type="text" name="manual_db" value="' . $manual_db . '" size="60" maxlength="100"></td></tr>';
echo '<tr><td>';
echo $lang['L_PORT'] . ':</td><td><input type="text" name="dbport" value="' . $dbport . '" size="5" maxlength="5"> ' . $lang['L_INSTALL_HELP_PORT'] . '</td></tr>';
echo '<tr><td>' . $lang['L_SOCKET'] . ':</td><td><input type="text" name="dbsocket" value="' . $dbsocket . '" size="30" maxlength="255"> ' . $lang['L_INSTALL_HELP_SOCKET'] . '</td></tr>';
echo '<tr><td>' . $lang['L_TESTCONNECTION'] . ':</td><td><input type="submit" name="dbconnect" value="' . $lang['L_CONNECTTOMYSQL'] . '" class="Formbutton"></td></tr>';
if (isset($_POST['dbconnect'])) {
echo '<tr class="thead"><th colspan="2">' . $lang['L_DBCONNECTION'] . '</th></tr>';
echo '<tr><td colspan="2">';
$connection = MSD_mysql_connect();
if ($connection === false) {
echo '<p class="error">' . $lang['L_CONNECTIONERROR'] . '</p><span> ';
} else {
echo '<p class="success">' . $lang['L_CONNECTION_OK'] . '</p><span class="ssmall">';
$connection = "ok";
$connstr = "{$dbhost}|{$dbuser}|{$dbpass}|{$dbport}|{$dbsocket}|{$manual_db}";
echo '<input type="hidden" name="connstr" value="' . $connstr . '">';
if ($manual_db > '') {
SearchDatabases(1, $manual_db);
} else {
SearchDatabases(1);
}
}
echo '</span></td></tr>';
}
示例10: phpinfo
echo '<p align="center"><a href="main.php"><< Home</a></p>';
phpinfo();
echo '<p align="center"><a href="main.php"><< Home</a></p>';
exit;
}
if (isset($_POST['htaccess']) || $action == 'schutz') {
include './inc/home/protection_create.php';
}
if ($action == 'edithtaccess') {
include './inc/home/protection_edit.php';
}
if ($action == 'deletehtaccess') {
include './inc/home/protection_delete.php';
}
// Output headnavi
$tpl = new MSDTemplate();
$tpl->set_filenames(array('show' => 'tpl/home/headnavi.tpl'));
$tpl->assign_vars(array('HEADER' => MSDHeader(), 'HEADLINE' => headline('Home')));
$tpl->pparse('show');
MSD_mysql_connect();
if ($action == 'status') {
include './inc/home/home.php';
} elseif ($action == 'db') {
include './inc/home/databases.php';
} elseif ($action == 'sys') {
include './inc/home/system.php';
} elseif ($action == 'vars') {
include './inc/home/mysql_variables.php';
}
echo MSDFooter();
ob_end_flush();
示例11: SearchDatabases
function SearchDatabases($printout)
{
global $databases, $config, $lang;
if (!isset($config['dbconnection'])) {
MSD_mysql_connect();
}
if (isset($config['dbonly']) && $config['dbonly'] != '') {
$success = @mysql_select_db($config['dbonly'], $config['dbconnection']);
if ($success) {
$databases['db_actual'] = $config['dbonly'];
$databases['Name'][0] = $config['dbonly'];
$databases['praefix'][0] = "";
$databases['command_before_dump'][0] = "";
$databases['command_after_dump'][0] = "";
$databases['db_selected_index'] = 0;
if ($printout == 1) {
echo "... " . $lang['found_db'] . " `" . $config['dbonly'] . "`<br />";
}
} else {
echo '<div style="color:red;">' . $lang['found_no_db'] . ' `' . $config['dbonly'] . "` !</div>";
}
} else {
$db_list = @mysql_list_dbs($config['dbconnection']);
$i = 0;
if ($db_list && @mysql_num_rows($db_list) > 0) {
$databases['db_selected_index'] = 0;
while ($row = @mysql_fetch_row($db_list)) {
// Test-Select um zu sehen, ob Berechtigungen existieren
if (mysql_query("SHOW TABLES FROM `" . $row[0] . "`", $config['dbconnection'])) {
$databases['Name'][$i] = $row[0];
$databases['praefix'][$i] = "";
$databases['command_before_dump'][$i] = "";
$databases['command_after_dump'][$i] = "";
if ($printout == 1) {
echo $lang['found_db'] . ' `' . $row[0] . '`<br />';
}
}
}
$databases['db_actual'] = $databases['Name'][0];
$databases['db_selected_index'] = 0;
} else {
if ($printout == 1) {
echo $lang['dbonlyneed'] . '<br />';
}
}
}
}
示例12: intval
} else {
// wenn Multidump aktiviert ist, aber keine DB gewaehlt wurde -> aktuelle DB uebernehmen
if (!isset($databases['multi'][0])) {
$databases['multi'][0] = $databases['db_actual'];
}
// find correct dbindex -> take dbname from $databases['multi'] and get the correct index
// from $databases['Name'] -> needed to set $dump['dbindex'] for first run of command_before_dump
$dump['dbindex'] = $flipped[$databases['multi'][0]];
}
//Zeitzähler aktivieren
$dump['max_zeit'] = intval($config['max_execution_time'] * $config['time_buffer']);
$dump['startzeit'] = time();
$xtime = isset($_POST['xtime']) ? $_POST['xtime'] : time();
$dump['countdata'] = !empty($_POST['countdata']) ? $_POST['countdata'] : 0;
$dump['aufruf'] = !empty($_POST['aufruf']) ? $_POST['aufruf'] : 0;
MSD_mysql_connect($dump['dump_encoding']);
if ($dump['table_offset'] == -1) {
ExecuteCommand('b');
}
// only read tableinfos the first time and save it to session to speed up backing up process
if (!isset($_SESSION['dump'])) {
getDBInfos();
}
$num_tables = count($dump['tables']);
if ($config['optimize_tables_beforedump'] == 1 && $dump['table_offset'] == -1) {
$out .= sprintf($lang['L_NR_TABLES_OPTIMIZED'], $num_tables) . '<br>';
}
$dump['data'] = '';
$dump['dbindex'] = isset($_POST['dbindex']) ? $_POST['dbindex'] : $flipped[$databases['multi'][0]];
//Ausgaben-Header bauen
$aus_header[] = headline('Backup: ' . ($config['multi_dump'] == 1 ? 'Multidump (' . count($databases['multi']) . ' ' . $lang['L_DBS'] . ')' : $lang['L_DB'] . ': ' . $databases['Name'][$dump['dbindex']] . ($databases['praefix'][$dump['dbindex']] != '' ? ' (' . $lang['L_WITHPRAEFIX'] . ' <span>' . $databases['praefix'][$dump['dbindex']] . '</span>)' : '')));
示例13: GetCollationArray
function GetCollationArray()
{
global $config;
if (!isset($config['dbconnection'])) {
MSD_mysql_connect();
}
$res = mysql_query("SHOW Collation");
$num = @mysql_num_rows($res);
$r = array();
if (is_array($r)) {
for ($i = 0; $i < $num; $i++) {
$row = mysql_fetch_array($res);
$r[$i]['Collation'] = isset($row['Collation']) ? $row['Collation'] : '';
$r[$i]['Charset'] = isset($row['Charset']) ? $row['Charset'] : '';
$r[$i]['Id'] = isset($row['Id']) ? $row['Id'] : '';
$r[$i]['Default'] = isset($row['Default']) ? $row['Default'] : '';
$r[$i]['Compiled'] = isset($row['Compiled']) ? $row['Compiled'] : '';
$r[$i]['Sortlen'] = isset($row['Sortlen']) ? $row['Sortlen'] : '';
}
}
return $r;
}
示例14: ExportHTML
function ExportHTML()
{
global $sql, $config, $lang;
$header = '<html><head><title>MSD Export</title></head>';
$footer = "\n\n</body>\n</html>";
$content = "";
$content .= '<h1>' . $lang['L_DB'] . ' ' . $sql['export']['db'] . '</h1>';
$time_start = time();
if (!isset($config['dbconnection'])) {
MSD_mysql_connect();
}
for ($table = 0; $table < count($sql['export']['tables']); $table++) {
$content .= '<h2>Tabelle ' . $sql['export']['tables'][$table] . '</h2>' . "\n";
$fsql = "show fields from `" . $sql['export']['tables'][$table] . "`";
$dsql = "select * from `" . $sql['export']['tables'][$table] . "`";
//Struktur
$res = MSD_query($fsql);
if ($res) {
$field = $fieldname = $fieldtyp = array();
$structure = "<table class=\"Table\">\n";
$numfields = mysqli_num_rows($res);
for ($feld = 0; $feld < $numfields; $feld++) {
$row = mysqli_fetch_row($res);
$field[$feld] = $row[0];
if ($feld == 0) {
$structure .= "<tr class=\"Header\">\n";
for ($i = 0; $i < count($row); $i++) {
$str = ($___mysqli_tmp = mysqli_fetch_field_direct($res, 0)) && is_object($___mysqli_tmp) ? !is_null($___mysqli_tmp->primary_key = $___mysqli_tmp->flags & MYSQLI_PRI_KEY_FLAG ? 1 : 0) && !is_null($___mysqli_tmp->multiple_key = $___mysqli_tmp->flags & MYSQLI_MULTIPLE_KEY_FLAG ? 1 : 0) && !is_null($___mysqli_tmp->unique_key = $___mysqli_tmp->flags & MYSQLI_UNIQUE_KEY_FLAG ? 1 : 0) && !is_null($___mysqli_tmp->numeric = (int) ($___mysqli_tmp->type <= MYSQLI_TYPE_INT24 || $___mysqli_tmp->type == MYSQLI_TYPE_YEAR || (defined("MYSQLI_TYPE_NEWDECIMAL") ? $___mysqli_tmp->type == MYSQLI_TYPE_NEWDECIMAL : 0))) && !is_null($___mysqli_tmp->blob = (int) in_array($___mysqli_tmp->type, array(MYSQLI_TYPE_TINY_BLOB, MYSQLI_TYPE_BLOB, MYSQLI_TYPE_MEDIUM_BLOB, MYSQLI_TYPE_LONG_BLOB))) && !is_null($___mysqli_tmp->unsigned = $___mysqli_tmp->flags & MYSQLI_UNSIGNED_FLAG ? 1 : 0) && !is_null($___mysqli_tmp->zerofill = $___mysqli_tmp->flags & MYSQLI_ZEROFILL_FLAG ? 1 : 0) && !is_null($___mysqli_type = $___mysqli_tmp->type) && !is_null($___mysqli_tmp->type = $___mysqli_type == MYSQLI_TYPE_STRING || $___mysqli_type == MYSQLI_TYPE_VAR_STRING ? "type" : "") && !is_null($___mysqli_tmp->type = "" == $___mysqli_tmp->type && in_array($___mysqli_type, array(MYSQLI_TYPE_TINY, MYSQLI_TYPE_SHORT, MYSQLI_TYPE_LONG, MYSQLI_TYPE_LONGLONG, MYSQLI_TYPE_INT24)) ? "int" : $___mysqli_tmp->type) && !is_null($___mysqli_tmp->type = "" == $___mysqli_tmp->type && in_array($___mysqli_type, array(MYSQLI_TYPE_FLOAT, MYSQLI_TYPE_DOUBLE, MYSQLI_TYPE_DECIMAL, defined("MYSQLI_TYPE_NEWDECIMAL") ? constant("MYSQLI_TYPE_NEWDECIMAL") : -1)) ? "real" : $___mysqli_tmp->type) && !is_null($___mysqli_tmp->type = "" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_TIMESTAMP ? "timestamp" : $___mysqli_tmp->type) && !is_null($___mysqli_tmp->type = "" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_YEAR ? "year" : $___mysqli_tmp->type) && !is_null($___mysqli_tmp->type = "" == $___mysqli_tmp->type && ($___mysqli_type == MYSQLI_TYPE_DATE || $___mysqli_type == MYSQLI_TYPE_NEWDATE) ? "date " : $___mysqli_tmp->type) && !is_null($___mysqli_tmp->type = "" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_TIME ? "time" : $___mysqli_tmp->type) && !is_null($___mysqli_tmp->type = "" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_SET ? "set" : $___mysqli_tmp->type) && !is_null($___mysqli_tmp->type = "" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_ENUM ? "enum" : $___mysqli_tmp->type) && !is_null($___mysqli_tmp->type = "" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_GEOMETRY ? "geometry" : $___mysqli_tmp->type) && !is_null($___mysqli_tmp->type = "" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_DATETIME ? "datetime" : $___mysqli_tmp->type) && !is_null($___mysqli_tmp->type = "" == $___mysqli_tmp->type && in_array($___mysqli_type, array(MYSQLI_TYPE_TINY_BLOB, MYSQLI_TYPE_BLOB, MYSQLI_TYPE_MEDIUM_BLOB, MYSQLI_TYPE_LONG_BLOB)) ? "blob" : $___mysqli_tmp->type) && !is_null($___mysqli_tmp->type = "" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_NULL ? "null" : $___mysqli_tmp->type) && !is_null($___mysqli_tmp->type = "" == $___mysqli_tmp->type ? "unknown" : $___mysqli_tmp->type) && !is_null($___mysqli_tmp->not_null = $___mysqli_tmp->flags & MYSQLI_NOT_NULL_FLAG ? 1 : 0) : false ? $___mysqli_tmp : false;
$fieldname[$i] = $str->name;
$fieldtyp[$i] = $str->type;
$structure .= "<th>" . $str->name . "</th>\n";
}
$structure .= "</tr>\n<tr>\n";
}
for ($i = 0; $i < count($row); $i++) {
$structure .= "<td class=\"Object\">" . ($row[$i] != "" ? $row[$i] : " ") . "</td>\n";
}
$structure .= "</tr>\n";
}
$structure .= "</table>\n";
}
if ($sql['export']['htmlstructure'] == 1) {
$content .= "<h3>Struktur</h3>\n" . $structure;
}
//Daten
$res = MSD_query($dsql);
if ($res) {
$anz = mysqli_num_rows($res);
$content .= "<h3>Daten ({$anz} Datensätze)</h3>\n";
$content .= "<table class=\"Table\">\n";
for ($feld = 0; $feld < count($field); $feld++) {
if ($feld == 0) {
$content .= "<tr class=\"Header\">\n";
for ($i = 0; $i < count($field); $i++) {
$content .= "<th>" . $field[$i] . "</th>\n";
}
$content .= "</tr>\n";
}
}
for ($d = 0; $d < $anz; $d++) {
$row = mysqli_fetch_row($res);
$content .= "<tr>\n";
for ($i = 0; $i < count($row); $i++) {
$content .= '<td class="Object">' . ($row[$i] != "" ? $row[$i] : " ") . "</td>\n";
}
$content .= "</tr>\n";
}
}
$content .= "</table>";
}
CSVOutput($header . $content . $footer);
}
示例15: mysql_search
function mysql_search($db, $tabelle, $suchbegriffe, $suchart, $offset = 0, $anzahl_ergebnisse = 20, $auszuschliessende_tabellen = '')
{
global $tables, $config;
$ret = false;
$link = MSD_mysql_connect();
if (sizeof($tables) > 0) {
$suchbegriffe = trim(str_replace('*', '', $suchbegriffe));
$suchworte = explode(' ', $suchbegriffe);
if ($suchbegriffe > '' && is_array($suchworte)) {
// Leere Einträge (durch doppelte Leerzeichen) entfernen
$anzahl_suchworte = sizeof($suchworte);
for ($i = 0; $i < $anzahl_suchworte; $i++) {
if (trim($suchworte[$i]) == '') {
unset($suchworte[$i]);
}
}
$bedingung = '';
$where = '';
$felder = '';
// Felder ermitteln
$sql = 'SHOW COLUMNS FROM `' . $db . '`.`' . $tables[$tabelle] . '`';
$res = mysqli_query($link, $sql);
unset($felder);
if (!$res === false) {
// Felder der Tabelle ermitteln
while ($row = mysqli_fetch_object($res)) {
$felder[] = $row->Field;
}
}
$feldbedingung = '';
if ($suchart == 'CONCAT') {
if (is_array($felder)) {
//Concat-String bildem
$concat = implode('`),LOWER(`', $felder);
$concat = 'CONCAT_WS(\'\',LOWER(`' . $concat . '`))';
$where = '';
foreach ($suchworte as $suchbegriff) {
$where .= $concat . ' LIKE \'%' . strtolower($suchbegriff) . '%\' AND ';
}
$where = substr($where, 0, -4);
// letztes AND entfernen
$sql = 'SELECT * FROM `' . $db . '`.`' . $tables[$tabelle] . '` WHERE ' . $where . ' LIMIT ' . $offset . ',' . $anzahl_ergebnisse;
}
} else {
$pattern = '`{FELD}` LIKE \'%{SUCHBEGRIFF}%\'';
if (is_array($felder)) {
foreach ($felder as $feld) {
unset($feldbedingung);
foreach ($suchworte as $suchbegriff) {
$suchen = array('{FELD}', '{SUCHBEGRIFF}');
$ersetzen = array($feld, $suchbegriff);
$feldbedingung[] = str_replace($suchen, $ersetzen, $pattern);
}
$bedingung[] = '(' . implode(' ' . $suchart . ' ', $feldbedingung) . ') ';
}
} else {
die('<br>Fehler bei Suche: ich konnte nicht ermitteln welche Felder die Tabelle "' . $tabelle . '" hat!');
}
$where = implode(' OR ', $bedingung);
$sql = 'SELECT * FROM `' . $db . '`.`' . $tables[$tabelle] . '` WHERE (' . $where . ') LIMIT ' . $offset . ',' . $anzahl_ergebnisse;
}
} else {
$sql = 'SELECT * FROM `' . $db . '`.`' . $tables[$tabelle] . '` LIMIT ' . $offset . ',' . $anzahl_ergebnisse;
}
$res = @mysqli_query($link, $sql);
if ($res) {
while ($row = mysqli_fetch_array($res, MYSQLI_ASSOC)) {
//Treffer markieren
foreach ($row as $key => $val) {
foreach ($suchworte as $suchbegriff) {
$row[$key] = markiere_suchtreffer($suchbegriff, $row[$key]);
}
$row[$key] = ersetze_suchtreffer($row[$key]);
}
$ret[] = $row;
}
}
}
return $ret;
}