Example #1
0
                for ($colidx = 1; $colidx < count($arrcolumn); $colidx++) {
                    $idxcol = $idxcol + 1;
                    $upd = $upd . ", " . $arrcolumn[$colidx] . "='" . str_replace("#", " ", $arrdaten[$idxcol]) . "'";
                }
                $sql = "UPDATE " . $arrnchtables[$tablecount] . " SET " . $upd . " WHERE " . $arrnchindex[$tablecount] . "=" . $arridxds[$idxcnt];
            } else {
                $idxcol = $idxcol + 1;
                $ins = "'" . str_replace("#", " ", $arrdaten[$idxcol]) . "'";
                for ($colidx = 1; $colidx < count($arrcolumn); $colidx++) {
                    $idxcol = $idxcol + 1;
                    $ins = $ins . ",'" . str_replace("#", " ", $arrdaten[$idxcol]) . "'";
                }
                $sql = "INSERT INTO " . $arrnchtables[$tablecount] . " (" . $arrcolsel[$tablecount] . ") VALUES(" . $ins . ")";
            }
            echo $sql . "<br>";
            dbexecutetyp($arrnchdbtyp[$tablecount], $dbnchopen, $sql);
            $idxcnt = $idxcnt + 1;
        }
    } else {
        $tblstatus = "FEHLER";
        $arrcolumn = explode(",", $arrcolsel[$tablecount]);
        $idxcol = $idxcol + count($arrcolumn);
        echo $idxcol . "=idxcol<br>";
        echo "nch:" . $nchcolumn . "<br>";
        echo "von:" . $arrcolsel[$tablecount] . "<br>";
    }
    array_push($arrtblstatus, $tblstatus);
}
echo "<form class='form-horizontal' method='post' action='" . $callbackurl . "&onlyshow=" . $onlyshow . "'>";
if ($action == "einspielen") {
    echo "<input type='hidden' name='status' value='fertig' />";
Example #2
0
function abschliessen($onlyshow, $database)
{
    echo "<br>";
    echo "<div class='alert alert-info'>";
    if ($onlyshow == "J") {
        echo "Datenanzeige abgeschlossen.<br>";
    } else {
        $arrtblstatus = json_decode($_POST["strtblstatus"]);
        $arrdbsyncnr = json_decode($_POST["strdbsyncnr"]);
        $db = new SQLite3('../data/' . $database);
        $date = date('Y-m-d');
        $time = date('H:i:s', time());
        $timestamp = $date . " " . $time;
        $arrnchtables = json_decode($_POST["strnchtables"]);
        echo count($arrnchtables) . "=anztable<br>";
        for ($tblcnt = 0; $tblcnt < count($arrnchtables); $tblcnt++) {
            if ($arrtblstatus[$tblcnt] == "OK") {
                $query = "SELECT * FROM tblsyncstatus WHERE fldtable='" . $arrnchtables[$tblcnt] . "'";
                echo $query . "<br>";
                $results = $db->query($query);
                if ($line = $results->fetchArray()) {
                    $sql = "UPDATE tblsyncstatus SET fldtimestamp='" . $timestamp . "' WHERE fldtable='" . $arrnchtables[$tblcnt] . "' AND flddbsyncnr=" . $arrdbsyncnr[$tblcnt];
                } else {
                    $sql = "INSERT INTO tblsyncstatus (fldtable,fldtimestamp,flddbsyncnr) VALUES('" . $arrnchtables[$tblcnt] . "','" . $timestamp . "'," . $arrdbsyncnr[$tblcnt] . ")";
                }
                echo $sql . "<br>";
                dbexecutetyp("SQLITE3", $db, $sql);
            } else {
                echo $arrnchtables[$tblcnt] . " not ok.<br>";
            }
        }
        echo "Timestamp:" . $timestamp . "<br>";
        echo "Datensynchronisation abgeschlossen.<br>";
    }
    echo "onlyshow=" . $onlyshow . "<br>";
    echo "</div>";
}
Example #3
0
$dbuser = $_POST['dbuser'];
$dbpassword = $_POST['dbpassword'];
$timestamp = $_POST['timestamp'];
$fldindex = $_POST['fldindex'];
//$db = new SQLite3($database);
echo $dbtyp . "<br>";
echo $database . "<br>";
$db = dbopentyp($dbtyp, $database, $dbuser, $dbpassword);
//echo "<div class='alert alert-success'>";
//timestamp ermitteln
//$qryval = "SELECT * FROM tblsyncstatus WHERE fldtable='".$dbtable."'";
//echo $qryval."<br>";
//$results = $db->query($qryval);
//if ($linval = $results->fetchArray()) {
//  $timestamp=$linval['fldtimestamp'];
//} else {
//  $timestamp="";
//}
//echo "table:".$dbtable."<br>";;
echo "Timestamp:" . $timestamp . "<br>";
//echo "</div>";
$col = "*";
$qryval = "SELECT " . $col . " FROM " . $dbtable . " WHERE fldtimestamp>'" . $timestamp . "' AND flddbsyncnr=" . $dbsyncnr . " AND flddbsyncstatus='SYNC'";
echo $qryval . "<br>";
$results = dbquerytyp($dbtyp, $db, $qryval);
while ($linval = dbfetchtyp($dbtyp, $results)) {
    $qryupd = "UPDATE " . $dbtable . " SET flddbsyncstatus='NOSYNC' WHERE " . $fldindex . "=" . $linval[$fldindex];
    echo $qryupd . "<br>";
    dbexecutetyp($dbtyp, $db, $qryupd);
}
bootstrapend();
Example #4
0
function syncempfangen($database, $nuranzeigen, $datcntremote, $dbtable, $fldindex, $timestamp)
{
    $db = new SQLite3('../data/' . $database);
    $dbtyp = "MYSQL";
    $dbase = "dbjoorgportal";
    $dbuser = "******";
    $dbpassword = "******";
    $dbremote = dbopentyp($dbtyp, $dbase, $dbuser, $dbpassword);
    echo "<div class='alert alert-success'>";
    echo $datcntremote . " Datensätze empfangen am " . $timestamp . "<br>";
    for ($i = 1; $i <= $datcntremote; $i++) {
        echo "<div class='alert alert-success'>";
        $index = $_POST['index' . $i];
        $qryval = "SELECT * FROM " . $dbtable . " WHERE " . $fldindex . "=" . $index;
        echo $qryval . "<br>";
        //    $results = $db->query($qryval);
        $results = dbquerytyp($dbtyp, $dbase, $qryval);
        if ($linval = dbfetchtyp($dbtyp, $results)) {
            $sql = $_POST['updsql' . $i];
        } else {
            $sql = $_POST['inssql' . $i];
        }
        $sql = str_replace("#", "'", $sql);
        echo $sql . "<br>";
        echo "</div>";
        if ($nuranzeigen != "anzeigen") {
            //$query = $db->exec($sql);
            dbexecutetyp($dbtyp, $dbremote, $sql);
        }
    }
    echo "</div>";
    syncfertig($database, $nuranzeigen, $dbtable, $timestamp);
}
Example #5
0
$callbackurl = str_replace("sync.php", "showtab.php", $callbackurl);
$arrtblstatus = json_decode($_POST["strtblstatus"]);
$arrdbsyncnr = json_decode($_POST["strdbsyncnr"]);
$db = new SQLite3('../data/' . $database);
$date = date('Y-m-d');
$time = date('H:i:s', time());
$timestamp = $date . " " . $time;
$arrnchtables = json_decode($_POST["strnchtables"]);
echo count($arrnchtables) . "=anztables<br>";
for ($tblcnt = 0; $tblcnt < count($arrnchtables); $tblcnt++) {
    if ($arrtblstatus[$tblcnt] == "OK") {
        $query = "SELECT * FROM tblsyncstatus WHERE fldtable='" . $arrnchtables[$tblcnt] . "'";
        echo $query . "<br>";
        $results = $db->query($query);
        if ($line = $results->fetchArray()) {
            $sql = "UPDATE tblsyncstatus SET fldtimestamp='" . $timestamp . "' WHERE fldtable='" . $arrnchtables[$tblcnt] . "' AND flddbsyncnr=" . $arrdbsyncnr[$tblcnt];
        } else {
            $sql = "INSERT INTO tblsyncstatus (fldtable,fldtimestamp,flddbsyncnr) VALUES('" . $arrnchtables[$tblcnt] . "','" . $timestamp . "'," . $arrdbsyncnr[$tblcnt] . ")";
        }
        echo $sql . "<br>";
        dbexecutetyp("SQLITE3", $db, $sql);
    } else {
        echo $arrnchtables[$tblcnt] . " not ok.<br>";
    }
}
echo "Timestamp:" . $timestamp . "<br>";
echo "<a href='" . $callbackurl . "'  class='btn btn-primary btn-sm active' role='button'>Zurück</a> ";
echo "<div class='alert alert-info'>";
echo "Datensynchronisation abgeschlossen.";
echo "</div>";
bootstrapend();