Exemplo n.º 1
0
     // UPDATE COMMAND
     $query = "UPDATE `offerte` SET `off-stato` = 0, `datamod` = CURRENT_TIMESTAMP WHERE `id` = ?";
     $result = $mysqli->prepare($query);
     $result->bind_param('i', $_GET['off_id']);
     $res = $result->execute() or trigger_error($result->error, E_USER_ERROR);
     echo $res;
     cleanDB($mysqli);
 } else {
     if (isset($_GET['update_stato'])) {
         // UPDATE COMMAND
         $query = "UPDATE `offerte` SET `off-stato` = 1, `datamod` = CURRENT_TIMESTAMP WHERE `id` = ?";
         $result = $mysqli->prepare($query);
         $result->bind_param('i', $_GET['off_id']);
         $res = $result->execute() or trigger_error($result->error, E_USER_ERROR);
         echo $res;
         cleanDB($mysqli);
     } else {
         if (isset($_GET['delete_logic'])) {
             // LOGIC DELETE COMMAND
             $query = "UPDATE `offerte` SET `off-stato` = 2, `datamod` = CURRENT_TIMESTAMP WHERE `id` = ?";
             $result = $mysqli->prepare($query);
             $result->bind_param('i', $_GET['off_id']);
             $res = $result->execute() or trigger_error($result->error, E_USER_ERROR);
             echo $res;
         } else {
             if (isset($_GET['delete_hard'])) {
                 // HARD DELETE COMMAND
                 $query = "DELETE FROM `offerte` WHERE `off-numoff` = ?";
                 $result = $mysqli->prepare($query);
                 $result->bind_param('i', $_GET['off_numoff']);
                 $res = $result->execute() or trigger_error($result->error, E_USER_ERROR);
Exemplo n.º 2
0
    scanPHP($paths, $db, $printStatus);
    echo "DONE" . PHP_EOL;
}
/*  ACTION INIT  */
if (@$_REQUEST['action'] == 'init' || in_array("init", $params)) {
    try {
        $db->exec("CREATE TABLE IF NOT EXISTS files\n\t        (\n\t            id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, \n\t            filepath VARCHAR(255) NULL,\n\t            modTime VARCHAR(255) NOT NULL\n\t        );");
        $db->exec("CREATE TABLE IF NOT EXISTS elements\n\t        (\n\t            id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, \n\t            filepath VARCHAR(255) NULL,\n\t            filename VARCHAR(255) NOT NULL,\n\t            fileext VARCHAR(20) NOT NULL,\n\t            element VARCHAR(255) NOT NULL,\n\t            elementType VARCHAR(20) NOT NULL,\n\t            linenum INTEGER NOT NULL\n\t        );");
    } catch (Exception $exception) {
        echo "ERROR: " . $exception->getMessage();
        die;
    }
}
/*  ACTION RESET  */
if (@$_REQUEST['action'] == 'reset' || in_array("reset", $params)) {
    cleanDB($db);
}
/*  ACTION VIEW  */
if (!isset($_REQUEST['action']) && !isset($argv) || isset($_REQUEST['action']) && $_REQUEST['action'] == 'view') {
    $search = @$_REQUEST['search'];
    echo "<style>a{text-decoration:none;color:green;} .tfile{color:red;} .tclass{color:green;} .tfunction{color:blue;} .tfelement{background-color:yellow;} .tpath{color:grey;}</style>\n\t<div><form><input type='hidden' name='action' value='view'><input type='text' name='search' value='" . htmlspecialchars($search) . "'><input type='submit' value='seach' /></form></div><hr>";
    if (trim($search) != "") {
        $data = searchElements($db, $search);
        echo "<table style='width=100%'>";
        foreach ($data as $value) {
            echo "<tr>";
            if ($value['elementType'] == 'file') {
                echo "<td><a href='/grep.php?view=view&search=" . urlencode($value['element']) . "&line=" . urlencode($value['linenum']) . "&path=" . urlencode($value['filepath']) . "' target='_blank' >view</a></td>";
                echo "<td class='tfile'>file</td>";
                echo "<td class='tfelement'></td>";
                echo "<td class='tpath'>" . htmlspecialchars($value['filepath']) . "</td>";