if ($validMail) { // get card url $myUrl = "http://" . $_SERVER['HTTP_HOST']; $_SESSION["messageSentOk"] = true; header('Location: ' . $myUrl); // set mail body with cards require "getAllCards.php"; //$body = "<!doctype html>"; //$body .= "<html>"; //$body .= "<head>"; //$body .= '<link href="../style.css" type="text/css" rel="stylesheet">'; //$body .= "</head>"; //$body .= "<body>"; $body = getAllCards("all"); //$body .= "</body>"; //$body .= "</html>"; $mailBody = "Please open this mail in a mail client that supports html."; // mail to receiver and print that it succeeded require "mailer.php"; $sn = "Kenzo&Kobe"; $se = "*****@*****.**"; $rn = "Person"; $re = $email; $subject = "ecard overview"; echo sendphpmail($sn, $se, $rn, $re, $subject, $mailBody, $body); } else { echo "Not a valid mail address!"; } } else { echo "<h1>Post Was not complete</h1>"; }
// update readTime of card $sql = "UPDATE sentCards\n SET readDateTime=NOW()\n WHERE cardNr='{$cardNumber}';"; $result = $conn->query($sql); if ($conn->query($sql) === TRUE) { echo "<script>console.log('ecard updated successfully');</script>"; //mail sender that card is readd require "mailer.php"; $senderName = "Kenzo&Kobe"; $senderEmail = "*****@*****.**"; $receiverName = $sName; $receiverAddress = $sMail; $subject = "ecard is read"; $cardReceiver = $row['receiverName']; $altBody = "the ecard you sent to {$cardReceiver} has been read."; $htmlBody = $altBody; sendphpmail($senderName, $senderEmail, $receiverName, $receiverAddress, $subject, $altBody, $htmlBody); } else { echo "<script>console.log('Error: {$sql}<br>{$conn->error}');</script>"; return -1; } } // get ecard $sql = "SELECT * FROM sentCards where cardNr='{$cardNumber}';"; $result = $conn->query($sql); if ($result->num_rows == 1) { $row = $result->fetch_assoc(); $image = $row['image']; $message = $row['message']; $fColor = $row['fontColor']; $fStyle = $row['fontStyle']; $fHeight = $row['fontHeight'];