ACC SHELL
<?php
define('WP_USE_THEMES', false);
require('../../../../wp-load.php');
$email = $_REQUEST['email'];
$postid = $_REQUEST['postid'];
$title = $_REQUEST['title'];
$file = $_REQUEST['file'];
if(is_email($email))
{
//update session vars for form use
$_SESSION['ssd_email'] = $email;
$_SESSION['ssd_email_validates'] = true;
//save the email to the db
$wpdb->insert($wpdb->justemails, array('email' => $email), array('%s'));
require_once(ABSPATH . "/wp-includes/class-phpmailer.php");
try {
$mail = new PHPMailer(true);
$mail->IsMail();
$mail->From = "SCACP" . "<scacp@scacp.cz>";
$mail->FromName = "SCACP";
$mail->Subject = "Stazeni souboru ";
$mail->Body = "Tento email si stáhl na webu Školení Greenbelt / Blackbelt soubor $title: $email ";
$mail->WordWrap = 150;
$mail->AddAddress('scacp@scacp.cz','SCACP');
$mail->AddCC('Michaela.Bohusova@dm-services.cz', 'Michaela Bohusova');
$mail->AddCC('Jiri.Ludvar@dm-services.cz', 'Jiri Ludvar');
$mail->Send();
} catch (Exception $e) {
echo $e->getMessage();
}
/*
require_once(ABSPATH . "/wp-includes/class-phpmailer.php");
//send email
$body = "Emailová adresa, která si zažádala stažení souboru: ";
$body.= $email
$subject = "Vyplněná adresa pro stažení souboru ";
$from = get_bloginfo('name') . "<" . get_bloginfo('admin_email') . ">";
$mail = new PHPMailer(); // defaults to using php "mail()"
$body = eregi_replace("[\]",'',$body);
$mail->From = get_bloginfo('admin_email');
$mail->FromName = get_bloginfo('name');
$mail->Subject = $subject;
$mail->MsgHTML($body);
$mail->AddAddress('Jiri.Ludvar@dm-services.cz','Jiri Ludvar');
if(!$mail->Send()) {
//echo "Mailer Error: " . $mail->ErrorInfo;
} else {
//echo "Message sent!";
}
*/
//if we're set to email file, email the file
$delivery = ssd_getOption("delivery");
if($delivery == "email_link" || $delivery == "email_attachment")
{
require_once(ABSPATH . "/wp-includes/class-phpmailer.php");
//send email
$to = $email;
$subject = "Your Requested File From " . get_bloginfo("name");
$from = get_bloginfo('name') . "<" . get_bloginfo('admin_email') . ">";
if($delivery == "email_attachment")
{
$body = "Your requested file is attached.";
//get the filename
$file = ssd_unswapChars($file);
//fix it if there is no leading http, etc
if(substr($file, 0, 1) == "/")
$file = "http://" . $_SERVER['HTTP_HOST'] . $file;
elseif(substr($file, 0, 4) != "http")
$file = "http://" . $_SERVER['HTTP_HOST'] . "/" . $file;
//serverfile
$serverfile = str_replace("http://" . $_SERVER['HTTP_HOST'], $_SERVER['DOCUMENT_ROOT'], $file);
$attachment = $serverfile;
}
else
{
$body .= "Download your file here: <a href=\"" . SSD_PLUGIN_URL . "/services/getfile.php?file=" . $file . "\">" . $title . "</a>";
$body .= "<br /><br /><small>Note: You must use the same computer and browser that you submitted your email address from to access the file.</small>";
}
$mail = new PHPMailer(); // defaults to using php "mail()"
$body = eregi_replace("[\]",'',$body);
$mail->From = get_bloginfo('admin_email');
$mail->FromName = get_bloginfo('name');
$mail->Subject = $subject;
$mail->MsgHTML($body);
$mail->AddAddress($email);
if($delivery == "email_attachment")
$mail->AddAttachment($attachment); // attachment
if(!$mail->Send()) {
//echo "Mailer Error: " . $mail->ErrorInfo;
} else {
//echo "Message sent!";
}
}
}
else
{
$_SESSION['ssd_email'] = "";
$_SESSION['ssd_email_validates'] = false;
$_SESSION['ssd_email_failed'] = true;
}
session_write_close();
//go back to where you came
if($postid)
wp_redirect(get_permalink($postid));
else
wp_redirect(get_bloginfo("home"));
?>
ACC SHELL 2018