added more customer intel. Response message from customer order and email

This commit is contained in:
2026-10-20 10:15:30 +03:00
parent c41e56d382
commit 9634551a68
49 changed files with 50 additions and 17 deletions
+27 -7
View File
@@ -2,13 +2,25 @@
use Socketlabs\SocketLabsClient;
use Socketlabs\Message\BasicMessage;
use Socketlabs\Message\EmailAddress;
include "db.php";
include "socketlabs-php-main/socketlabs-php-main/InjectionApi/src/includes.php";
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["variableName"])) {
$receivedVariable = $_POST["variableName"];
// Process the received variable here
// echo "Received variable: " . $receivedVariable;
$user = $_POST["user"];
$stmt = $mysqli ->prepare("SELECT usersname,usersphone,usersemail FROM users WHERE idusers = ? ");
$stmt -> bind_param("s",$user);
$stmt -> execute();
$result = $stmt->get_result();
//$stmt->store_result();
$customer;
if ($row = $result->fetch_assoc()) {
$customer=$row;
}
else
{echo("warning");}
//echo "Received variable: " . $receivedVariable;
@@ -18,8 +30,15 @@ $apiKey = "RB1ix50wg5NW19mvUHvx.DImVryVSWvWwgjr61XNGhYAVtlr5yNEmmZmsj3ev";
$client = new SocketLabsClient($serverId, $apiKey);
$message = new BasicMessage();
$message->subject = "Test Message";
$message->htmlBody = "<html><body><p>".$receivedVariable."</p></body></html>";
$message->subject = "Halutut kuvat";
$message->htmlBody =
"<html>
<body>"."<p>".$customer["usersname"]."<p> ".
"<p> puhelin: ".$customer["usersphone"]."<p> ".
"<p> sähköposti: ".$customer["usersemail"]."<p> ".
"<p>".$receivedVariable."</p>
</body>
</html>";
$message->plainTextBody = "Test email body";
// Ensure this From address uses your verified domain in SocketLabs!
@@ -29,8 +48,9 @@ $message->addToAddress("[email protected]");
try {
$response = $client->send($message);
if($response->result == "Success"){
echo("Tilaus lähetetty");
echo "Received variable: " . $receivedVariable;
echo("Tilaus lähetetty <br>");
echo "Kuvat: ". $receivedVariable;
}