<?php
include "db.php";

if (!empty($_POST)){
    //set up data
    $docId = utf8_decode($_POST['id']);
    $userId = utf8_decode($_POST['userId']);
    $faulty = utf8_decode($_POST['faulty']);
    $correct = utf8_decode($_POST['correct']);

    //insert data
    $sql = "INSERT INTO fix (date, documentId, userId, faultySent, correctSent) VALUES (NOW(), '$docId', '$userId', '$faulty', '$correct')";
    $insert = $mysqli->query($sql);


//        require 'PHPMailer/PHPMailerAutoload.php';
//
//        $mail = new PHPMailer;
//
//        $mail->isSMTP();                                      // Set mailer to use SMTP
//        $mail->Host = 'mailhost.ut.ee';                        // Specify main and backup SMTP servers //vaata et kaitsmist ikka ülikooli võrgus teed!!!11
//        $mail->SMTPAuth = false;                               // Enable SMTP authentication
//        $mail->Port = 25;                                    // TCP port to connect to
//
//        $mail->addAddress('sandervunk24@hotmail.com');     // Add a recipient
//        $mail->isHTML(true);                                  // Set email format to HTML
//
//        $mail->Subject = $title;
//        $mail->Body    = $content;
//
//        //$mail->send();
//
//        if(!$mail->send()) {
//            echo 'Message could not be sent.';
//            echo 'Mailer Error: ' . $mail->ErrorInfo;
//        } else {
//            echo 'Message has been sent';
//        }
}

?>