Beispiel #1
0
if ($_GET['action'] == 'delsess') {
    echo $impex_phrases['dell_session_1'];
    echo $impex_phrases['dell_session_2'];
    echo $impex_phrases['dell_session_3'];
    echo $impex_phrases['dell_session_4'];
    $Db_target->query("DELETE FROM {$targettableprefix}datastore WHERE title='ImpExSession';");
    echo $impex_phrases['dell_session_5'];
    echo $impex_phrases['dell_session_6'];
}
if ($_GET['action'] == 'delall') {
    echo $impex_phrases['deleting_session'];
    $Db_target->query("DELETE FROM {$targettableprefix}datastore WHERE title='ImpExSession';");
    echo $impex_phrases['session_deleted'];
    foreach ($target as $tablename => $colname) {
        $Db_target->reporterror = 0;
        $is_it_there = $Db_target->query_first("DESCRIBE {$targettableprefix}{$tablename} {$colname}");
        $Db_target->reporterror = 1;
        if ($is_it_there) {
            echo $impex_phrases['deleting_from'] . " {$targettableprefix}{$tablename} ....";
            flush();
            $Db_target->query("DELETE FROM {$targettableprefix}{$tablename} WHERE {$colname} <> 0");
            echo "...<b>{$impex_phrases['completed']}</b></p>";
            flush();
        }
    }
    echo $impex_phrases['click_to_return'];
}
if ($_GET['action'] == 'delids') {
    echo $impex_phrases['deleting_session'];
    $Db_target->query("DELETE FROM {$targettableprefix}datastore WHERE title='ImpExSession';");
    echo $impex_phrases['session_deleted'];
$targetpassword = '******';
$targetdatabase = 'vb3';
$Db_target = new DB_Sql_vb_impex();
$Db_target->server = $targetserver;
$Db_target->user = $targetuser;
$Db_target->password = $targetpassword;
$Db_target->database = $targetdatabase;
$Db_target->connect();
$data_base_result = $Db_target->query("show tables");
while ($table = $Db_target->fetch_array($data_base_result)) {
    if ($table[0] != 'vbfields') {
        echo "<h4>'" . $table[0] . "'</h4>";
        $table_result = $Db_target->query("DESCRIBE " . $table[0]);
        while ($row = $Db_target->fetch_array($table_result)) {
            // Check that it is in vBfields to start with
            $not_found = $Db_target->query_first("SELECT fieldid FROM vbfields WHERE fieldname='" . $row['Field'] . "' AND tablename='" . $table[0] . "'");
            if ($not_found[0] == null) {
                echo "<h2><font color='red'>I found field " . $row['Field'] . " in table '" . $table[0] . "' and not in vbfields !</font></h2>";
            }
            echo "<br /><i>updating</i> -|- <b>" . $row['Field'] . "</b> :: " . $row['Type'];
            $unsigned = 'NO';
            if (strstr($row['Type'], 'unsigned')) {
                $unsigned = 'YES';
            }
            if (strstr($row['Type'], 'char') or strstr($row['Type'], 'text') or strstr($row['Type'], 'enum')) {
                $unsigned = 'N/A';
            }
            $sql = "UPDATE vbfields\n\t\t\t\tSET\n\t\t\t\tisunsigned='" . $unsigned . "' ,\n\t\t\t\tdefaultvalue='" . $row['Default'] . "' ,\n\t\t\t\tcreatesql='" . addslashes($row['Type']) . "',\n\t\t\t\tlocalupdate='Y'\n\t\t\t\tWHERE fieldname='" . $row['Field'] . "' AND tablename='" . $table[0] . "'\n\t\t\t\t";
            $Db_target->query($sql);
        }
    }