PK œqhYî¶J‚ßF ßF ) nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/
| Dir : /home/distinctdesign/codenwebz.com/includes/ |
| Server: Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 IP: 162.0.232.53 |
| Dir : /home/distinctdesign/codenwebz.com/includes/send_data.php |
<?php
session_start();
ini_set('display_errors', 1);
require("../vendor/phpmailer/src/PHPMailer.php");
require("../vendor/phpmailer/src/SMTP.php");
require("../vendor/phpmailer/src/Exception.php");
require '../vendor/autoload.php';
include '../config.php';
$action = $_GET['action'];
if($action == 'order_form'){
$f_name = $_POST['f_name'];
$l_name = $_POST['l_name'];
$email = $_POST['email'];
$number = $_POST['number'];
$url = $_POST['url'];
$domain = $_POST['domain'];
$subject = $_POST['subject'];
//$return_table = insert_into_table($f_name, $l_name, $email, $number, $url, $domain, $subject, $conn, null, null);
$return_param = send_mail_to_admin($f_name, $l_name, $email, $number, $url, $domain, $subject, null, null, ADMIN_EMAIL, null);
echo json_encode(array('response' => $return_param));
}else if($action == 'form_submission'){
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$message = isset($_POST['message']) ? $_POST['message'] : null;
$url = $_POST['url'];
$domain = $_POST['domain'];
$subject = $_POST['subject'];
if(isset($_POST['optional'])){
$optional = $_POST['optional'];
}else{
$optional = null;
}
//$return_table = insert_into_table($name, null, $email, $phone, $url, $domain, $subject, $conn, null, $message);
$return_param = send_mail_to_admin($name, null, $email, $phone, $url, $domain, $subject, null, $message, ADMIN_EMAIL, $optional);
echo json_encode(array('response' => $return_param));
}else if($action == 'landing_page'){
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$message = $_POST['message'];
$url = $_POST['url'];
$domain = $_POST['domain'];
$subject = $_POST['subject'];
if(isset($_POST['optional'])){
$optional = $_POST['optional'];
}else{
$optional = null;
}
//$return_table = insert_into_table($name, null, $email, $phone, $url, $domain, $subject, $conn, null, $message);
$return_param = send_mail_to_admin($name, null, $email, $phone, $url, $domain, $subject, null, $message, ADMIN_EMAIL, $optional);
echo json_encode(array('response' => $return_param));
}else if($action == 'newsletter'){
// $email = $_POST['email'];
$url = $_POST['url'];
$domain = $_POST['domain'];
$subject = $_POST['subject'];
//$return_table = insert_into_table(null, null, null,null, $url, $domain, $subject, $conn, null, null);
$return_param = send_mail_to_admin(null, null,null, null, $url, $domain, $subject, null, null, ADMIN_EMAIL, null);
echo json_encode(array('response' => $return_param));
}else if($action == 'logo_brief'){
$name = $_POST['name'];
$email = $_POST['email'];
$specific_product_option = $_POST['specific_product_option'];
$specific_product = $_POST['specific_product'];
$logo_name = $_POST['logo_name'];
$tagline = $_POST['tagline'];
$description = $_POST['description'];
$existing_website = $_POST['existing_website'];
$target_market = $_POST['target_market'];
$competitors = $_POST['competitors'];
$see_in_logo = $_POST['see_in_logo'];
$logo_feel = $_POST['logo_feel'];
$logo_feel_string = implode(', ', $logo_feel);
$plan_logo_option = $_POST['logo_option_name'];
$plan_logo = $_POST['logo_option'];
$plan_logo_string = implode(', ', $plan_logo);
$colors_option = $_POST['colors_option'];
$colors_option_string = implode(', ', $colors_option);
$colors_option_name = $_POST['colors_option_name'];
$font_style = $_POST['font_style'];
$font_style_string = implode(', ', $font_style);
$font_style_name = $_POST['font_style_name'];
$additional_information = $_POST['additional_information'];
$message = "Name: $name <br>
Email: $email <br>
Specific Product Option : $specific_product_option <br>
Specific Product : $specific_product <br>
Logo Name: $logo_name <br>
Logo Tagline: $tagline <br>
Description: $description <br>
Existing Website: $existing_website <br>
Target Market: $target_market <br>
Competitors: $competitors <br>
See in logo: $see_in_logo <br>
Logo Feel: $logo_feel_string <br>
Logo Feel Option: $plan_logo_option <br>
Plan Logo: $plan_logo_string <br>
Colors Option: $colors_option_string <br>
Colors Option Name: $colors_option_name <br>
Font Style: $font_style_string <br>
Font Style Name: $font_style_name <br>
Additional Information: $additional_information";
$mail = new PHPMailer\PHPMailer\PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->SMTPAuth = TRUE;
$mail->SMTPSecure = "ssl";
$mail->Port = 465;
$mail->Username = ADMIN_EMAIL_SENDER;
$mail->Password = ADMIN_APP_PASSWORD;
$mail->Host = 'smtp.gmail.com';
$mail->Mailer = "smtp";
$mail->setFrom(ADMIN_EMAIL, WEBSITE_NAME);
$mail->addAddress(ADMIN_EMAIL, WEBSITE_NAME);
$mail->addAddress(ADMIN_EMAIL_SENDER, WEBSITE_NAME);
$mail->Subject = 'Logo Brief Form';
foreach ($_FILES["attachment"]["name"] as $k => $v) {
$mail->AddAttachment( $_FILES["attachment"]["tmp_name"][$k], $_FILES["attachment"]["name"][$k] );
}
$mail->isHTML(true);
$mail->Body = $message;
if(!$mail->Send()) {
echo json_encode(array('response' => false, 'response_table' => false));
} else {
echo json_encode(array('response' => true, 'response_table' => true));
}
}else{
}
function insert_into_table($f_name, $l_name, $email, $number, $url, $domain, $subject, $conn, $services, $message){
$sql = "INSERT INTO leads (f_name, l_name, email, phone, url, domain, subject, services, message)
VALUES ('$f_name', '$l_name', '$email', '$number', '$url', '$domain', '$subject', '$services', '$message')";
if ($conn->query($sql)) {
$last_id = $conn->insert_id;
$_SESSION["customer_email"] = $email;
$_SESSION["customer_phone"] = $number;
$_SESSION["customer_url"] = $url;
$_SESSION["customer_id"] = $last_id;
return $last_id;
}
return 0;
}
function send_mail_to_admin($f_name, $l_name, $email, $number, $url, $domain, $subject, $services, $param_message, $admin_email, $optional){
$to = ADMIN_EMAIL;
$subject = $subject;
$from = $email;
$optional = json_encode($optional);
$headers = 'From:' . $admin_email;
// Compose a simple HTML email message
$message = " First Name: $f_name <br> Last Name: $l_name <br> Email: $email <br> Number: $number <br> Url: $url <br> Domain: $domain <br> Service: $services <br> Message: $param_message <br> Optional: $optional";
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on'){
$url = "https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
}else{
$url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
}
$url_components = parse_url($url);
// Sending email
$mail = new PHPMailer\PHPMailer\PHPMailer();
try {
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
$mail->SMTPDebug = 0;
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = ADMIN_EMAIL_SENDER;
$mail->Password = ADMIN_APP_PASSWORD;
$mail->SMTPSecure = 'ssl';
$mail->Port = 465;
$mail->setFrom($to, WEBSITE_NAME);
$mail->addAddress($to, WEBSITE_NAME);
$mail->addAddress(ADMIN_EMAIL, WEBSITE_NAME);
$mail->addAddress('daniellhouston545@gmail.com', WEBSITE_NAME);
// $mail->addAddress('daniyalbutt785@gmail.com', WEBSITE_NAME);
$mail->isHTML(true);
$mail->Subject = $subject;
$mail->Body = $message;
$mail->send();
// return true;
} catch (Exception $e) {
}
if($email == null){
$email = 'noemail'.uniqid().'@'.uniqid().'.com';
}
// $postRequest = array(
// 'name' => $f_name,
// 'l_name' => $l_name,
// 'email' => $email,
// 'contact' => $number,
// 'url' => $url,
// 'domain' => $domain,
// 'services' => $services,
// 'message' => $param_message,
// 'optional' => $optional,
// );
// $ch = curl_init();
// curl_setopt($ch, CURLOPT_URL,"https://designcrm.net/api/leads");
// curl_setopt($ch, CURLOPT_POST, 1);
// curl_setopt($ch, CURLOPT_POSTFIELDS, $postRequest);
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// $headers = array(
// "Accept: application/json",
// "Authorization: 4df194655b5c4148440e2f7ba80368b24d71d079",
// "custom-auth: 4df194655b5c4148440e2f7ba80368b24d71d079",
// );
// curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
// curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
// $server_output = curl_exec($ch);
// $data = json_decode($server_output, true);
// $_SESSION["crm_cus_id"] = $data['message'];
// curl_close ($ch);
return true;
}
?>