����JFIF��H�H����Exif��MM�*���� ��3����V�����3������3�(��������������������3�����
Server IP : 162.0.232.25 / Your IP : 18.225.92.251 Web Server : LiteSpeed System : Linux premium276.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : kwacuqig ( 988) PHP Version : 8.2.26 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/kwacuqig/learn.skilltainment.org/ |
Upload File : |
<?php include './sidebar.php'; include './navbar.php'; //Define name spaces use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\SMTP; use PHPMailer\PHPMailer\Exception; //Include required phpMailer files require './PHPMailer/PHPMailer.php'; require './PHPMailer/SMTP.php'; require './PHPMailer/Exception.php'; if (isset($_POST['submit'])) { $name = strtolower($_FILES['attach']['name']); $type = $_FILES['attach']['type']; $size = $_FILES['attach']['size']; $tmp_name = $_FILES['attach']['tmp_name']; $subject = htmlentities($_POST['subject']); $body = nl2br($_POST['body']); $_SESSION['subject'] = $subject; $_SESSION['body'] = $body; $pm = " <!DOCTYPE html> <html lang=\"en\"> <head> <meta charset=\"UTF-8\"> <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"> <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"> </head> <body> <div style=\"background-color:rgba(0,0,0,0.1);padding:1rem;\"> <p>$body</p> <br><br> <center> <div class=\"padding:5px;text-align:center;background-color:#c9c8c8;\"> Skilltainment © " . date('Y') . " </div> </center> </div> </body> </html> "; //uploading the attached file to temp_upload directory if (!empty($name)) { $location = 'temp_upload/'; move_uploaded_file($tmp_name, $location.$name); } //Create instance of phpMailer $mail = new PHPMailer(); //Enable verbose debug output // $mail->SMTPDebug = SMTP::DEBUG_SERVER; //set mailer to use smtp $mail->isSMTP(); //define smtp host $mail->Host = "smtp.gmail.com"; //enable smtp authentification $mail->SMTPAuth = "true"; //set type of encryption (ssl/tls) //TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; //set port to connect smtp $mail->Port = "587"; //465 for ssl //set gmail username $mail->Username = "beatonndaba@gmail.com"; //set gmail password $mail->Password = "tsxngatucbssjwbm"; //Set email format to HTML $mail->isHTML(true); //set email subject $mail->Subject = $subject; //set sender email $mail->setFrom("beatonndaba@gmail.com", "Skilltainment"); //reply to $mail->addReplyTo("info@skilltainment.org"); //Email body $mail->Body = $pm; //Add Address $mail->addAddress('beatondawa@gmail.com'); //query to select all emails available in our database $query = "SELECT * FROM `users` ORDER BY `email` DESC"; $query_run = mysqli_query($conn, $query) or die(mysqli_error($conn)); while ($row = mysqli_fetch_array($query_run)) { //Add recipient $mail->addBCC($row['email']); } //add attachments only if name is not empty if(!empty($name)){ //attachments $mail->addAttachment("./temp_upload/$name"); } //Finally send email if ($mail->Send()) { unset($_SESSION['subject']); unset($_SESSION['body']); ?> <script type="text/javascript"> document.addEventListener("DOMContentLoaded", function(event) { swal("SUCCESS", "Email was sent successfully", "success"); }) </script> <?php } else { ?> <script type="text/javascript"> document.addEventListener("DOMContentLoaded", function(event) { swal("ERROR", "<?php echo 'Email could not be sent. Mailer Error: {' . $mail->ErrorInfo . '}'; ?>", "error"); }) </script> <?php } //delete the file from server if (!empty($name)) { //attachments @unlink('./temp_upload/' . $name); } //Closing smtp connection $mail->smtpClose(); } ?> <div class="container-fluid pt-4 px-4"> <div class="row g-2"> <div class="col-12"> <div class="bg-secondary rounded h-100 p-4"> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" enctype="multipart/form-data"> <div class="form-floating mb-3 mt-2"> <input type="text" name="subject" class="form-control" id="floatingInput" placeholder="Playlist Title" value="<?php echo isset($_SESSION['title']) ? $_SESSION['title'] : ''; ?>" required> <label for="floatingInput">Subject</label> </div> <div class="form-floating mb-3"> <textarea class="form-control" name="body" placeholder="Leave a comment here" id="floatingTextarea" style="height: 150px;" required><?php echo isset($_SESSION['details']) ? $_SESSION['details'] : ''; ?></textarea> <label for="floatingTextarea">Body </div> <input type="file" name="attach" id="file-2" class="inputfile inputfile-2" data-multiple-caption="{count} files selected" multiple/> <label for="file-2"> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="17" viewBox="0 0 20 17"> <path d="M10 0l-5.2 4.9h3.3v5.1h3.8v-5.1h3.3l-5.2-4.9zm9.3 11.5l-3.2-2.1h-2l3.4 2.6h-3.5c-.1 0-.2.1-.2.1l-.8 2.3h-6l-.8-2.2c-.1-.1-.1-.2-.2-.2h-3.6l3.4-2.6h-2l-3.2 2.1c-.4.3-.7 1-.6 1.5l.6 3.1c.1.5.7.9 1.2.9h16.3c.6 0 1.1-.4 1.3-.9l.6-3.1c.1-.5-.2-1.2-.7-1.5z" /> </svg> <span>Attach File</span> </label> <div style="font-size:12px;">Optional</div> <button type="submit" name="submit" class="btn btn-primary py-3 w-100 my-4"><i class="fa fa-envelope"></i> Send</button> </form> </div> </div> </div> </div> <script> document.querySelector("title").innerText = "Send Mail"; document.querySelectorAll(".navbar-nav a")[2].classList.add("active"); </script> <?php include './footer.php'; ?>