added more customer intel. Response message from customer order and email
@@ -78,14 +78,23 @@ if(is_dir("uploads/".$customername)){
|
|||||||
//resize picture on upload dont see any reason to keep original picturefiles on server at this moment
|
//resize picture on upload dont see any reason to keep original picturefiles on server at this moment
|
||||||
$source = imagecreatefromjpeg($urls);
|
$source = imagecreatefromjpeg($urls);
|
||||||
list($width, $height) = getimagesize($urls);
|
list($width, $height) = getimagesize($urls);
|
||||||
|
list($old_width, $old_height) = getimagesize($urls);
|
||||||
// Define new dimensions
|
// Define new dimensions
|
||||||
/*$newWidth = 400;
|
/*$newWidth = 400;
|
||||||
$newHeight = 400;
|
$newHeight = 400;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$newWidth = $width / 20;
|
$max_width = 400;
|
||||||
$newHeight = $height / 20;
|
|
||||||
|
if ($old_width > $max_width) {
|
||||||
|
$ratio = $old_width / $max_width;
|
||||||
|
$newWidth = $max_width;
|
||||||
|
$newHeight = (int) round($old_height / $ratio);
|
||||||
|
} else {
|
||||||
|
$newWidth = $old_width;
|
||||||
|
$newHeight = $old_height;
|
||||||
|
}
|
||||||
|
|
||||||
// Create a blank true-color image
|
// Create a blank true-color image
|
||||||
$thumb = imagecreatetruecolor($newWidth, $newHeight);
|
$thumb = imagecreatetruecolor($newWidth, $newHeight);
|
||||||
|
|
||||||
@@ -102,7 +111,7 @@ imagedestroy($thumb);
|
|||||||
|
|
||||||
// Ladataan pääkuva ja vesileimalogo
|
// Ladataan pääkuva ja vesileimalogo
|
||||||
$mainImg = imagecreatefromjpeg($urls);
|
$mainImg = imagecreatefromjpeg($urls);
|
||||||
$watermark = imagecreatefrompng('raccoon.png');
|
$watermark = imagecreatefrompng('styles/tes.png');
|
||||||
|
|
||||||
// Haetaan kuvien mitat
|
// Haetaan kuvien mitat
|
||||||
$mainWidth = imagesx($mainImg);
|
$mainWidth = imagesx($mainImg);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ $stmt = $mysqli ->prepare("SELECT usersname FROM users WHERE idusers = ? AND use
|
|||||||
$stmt -> bind_param("ss",$id,$username);
|
$stmt -> bind_param("ss",$id,$username);
|
||||||
$stmt -> execute();
|
$stmt -> execute();
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
$stmt->store_result();
|
//$stmt->store_result();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ exit;}
|
|||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<body >
|
<body >
|
||||||
|
<p id="msg"></p>
|
||||||
<?php foreach($images as $picture): ?>
|
<?php foreach($images as $picture): ?>
|
||||||
<div class="imagesDiv" onclick='add("<?php echo($picture["imagesname"]) ?>", this)'>
|
<div class="imagesDiv" onclick='add("<?php echo($picture["imagesname"]) ?>", this)'>
|
||||||
<img style=""src="<?php echo($picture["imagesurls"]); ?>" alt="" >
|
<img style=""src="<?php echo($picture["imagesurls"]); ?>" alt="" >
|
||||||
@@ -108,7 +108,10 @@ if (arr.includes(name)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function send(){
|
function send(){
|
||||||
var dataToSend = "variableName=" + arr;
|
var dataToSend = "variableName=" + arr + "&user="+<?php echo($id); ?>;
|
||||||
|
//var customer = ;
|
||||||
|
//console.log(customer);
|
||||||
|
console.log(dataToSend);
|
||||||
|
|
||||||
// Prepare the data to send
|
// Prepare the data to send
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
@@ -128,7 +131,8 @@ function send(){
|
|||||||
|
|
||||||
// Check if the request was successful
|
// Check if the request was successful
|
||||||
console.log(xhr.responseText);
|
console.log(xhr.responseText);
|
||||||
|
let elemMsg = document.getElementById("msg");
|
||||||
|
elemMsg.innerHTML = xhr.responseText;
|
||||||
|
|
||||||
// Output the response from the PHP script
|
// Output the response from the PHP script
|
||||||
} else {
|
} else {
|
||||||
@@ -144,7 +148,7 @@ function send(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
;
|
// const test = {dataToSend , customer};
|
||||||
xhr.send(dataToSend);
|
xhr.send(dataToSend);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -2,13 +2,25 @@
|
|||||||
use Socketlabs\SocketLabsClient;
|
use Socketlabs\SocketLabsClient;
|
||||||
use Socketlabs\Message\BasicMessage;
|
use Socketlabs\Message\BasicMessage;
|
||||||
use Socketlabs\Message\EmailAddress;
|
use Socketlabs\Message\EmailAddress;
|
||||||
|
include "db.php";
|
||||||
include "socketlabs-php-main/socketlabs-php-main/InjectionApi/src/includes.php";
|
include "socketlabs-php-main/socketlabs-php-main/InjectionApi/src/includes.php";
|
||||||
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["variableName"])) {
|
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["variableName"])) {
|
||||||
$receivedVariable = $_POST["variableName"];
|
$receivedVariable = $_POST["variableName"];
|
||||||
// Process the received variable here
|
$user = $_POST["user"];
|
||||||
// echo "Received variable: " . $receivedVariable;
|
|
||||||
|
$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;
|
//echo "Received variable: " . $receivedVariable;
|
||||||
|
|
||||||
@@ -18,8 +30,15 @@ $apiKey = "RB1ix50wg5NW19mvUHvx.DImVryVSWvWwgjr61XNGhYAVtlr5yNEmmZmsj3ev";
|
|||||||
$client = new SocketLabsClient($serverId, $apiKey);
|
$client = new SocketLabsClient($serverId, $apiKey);
|
||||||
|
|
||||||
$message = new BasicMessage();
|
$message = new BasicMessage();
|
||||||
$message->subject = "Test Message";
|
$message->subject = "Halutut kuvat";
|
||||||
$message->htmlBody = "<html><body><p>".$receivedVariable."</p></body></html>";
|
$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";
|
$message->plainTextBody = "Test email body";
|
||||||
|
|
||||||
// Ensure this From address uses your verified domain in SocketLabs!
|
// Ensure this From address uses your verified domain in SocketLabs!
|
||||||
@@ -29,8 +48,9 @@ $message->addToAddress("[email protected]");
|
|||||||
try {
|
try {
|
||||||
$response = $client->send($message);
|
$response = $client->send($message);
|
||||||
if($response->result == "Success"){
|
if($response->result == "Success"){
|
||||||
echo("Tilaus lähetetty");
|
echo("Tilaus lähetetty <br>");
|
||||||
echo "Received variable: " . $receivedVariable;
|
echo "Kuvat: ". $receivedVariable;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
|
After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 5.3 MiB After Width: | Height: | Size: 5.3 MiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 5.3 MiB |
|
After Width: | Height: | Size: 5.3 MiB |
|
Before Width: | Height: | Size: 25 MiB After Width: | Height: | Size: 25 MiB |
|
After Width: | Height: | Size: 5.3 MiB |
|
After Width: | Height: | Size: 25 MiB |
|
After Width: | Height: | Size: 130 KiB |
|
After Width: | Height: | Size: 5.3 MiB |
|
After Width: | Height: | Size: 25 MiB |
|
After Width: | Height: | Size: 5.3 MiB |
|
After Width: | Height: | Size: 25 MiB |
|
After Width: | Height: | Size: 85 KiB |
|
After Width: | Height: | Size: 69 KiB |
|
After Width: | Height: | Size: 69 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 5.3 MiB |
|
After Width: | Height: | Size: 25 MiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 130 KiB |
|
After Width: | Height: | Size: 5.3 MiB |
|
After Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 5.3 MiB |
|
After Width: | Height: | Size: 130 KiB |
|
After Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 87 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 69 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 978 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 69 KiB |