Server IP : 68.65.122.142  /  Your IP : 18.118.139.82
Web Server : LiteSpeed
System : Linux server167.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User : glenirhm ( 1318)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/glenirhm/mygc.glenbowcollege.ca/admin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/glenirhm/mygc.glenbowcollege.ca/admin/admin2student_email_process.php
<?php
// We need to use sessions, so you should always start sessions using the below code.
session_start();

// If the user is not logged in redirect to the login page...
if (!isset($_SESSION['loggedin'])) {
	header('Location: index.html');
	exit;
}

include('../common/header_admin.php');

// Connect to the database
include('../common/connect.php');
include('../common/connectPDO.php');
include('../common/send_email.php');

// From PHPMailer code
require '../../composer/vendor/autoload.php';

$id = $_GET["id"];
$sql = "SELECT * FROM student WHERE id=$id";
$stmt = $pdo->query($sql);
while ($row = $stmt->fetch())
{
    echo 'First Name: ' . $row['fname'] . '<br>'.
    'Last Name: ' . $row['lname'] . '<br>'.
    'Email: ' . $row['email'] . '<br>';
    $destination = $row['email'];
}

$email_notice = "Following message with the marked attachments 
has been sent to the following student at the specified 
email address.<br>";
//sendEmail($host, $username, $password, $from, $destination, $subject, $body, $screen_message, $attachments)
sendEmail($EMAIL_HOST, $EMAIL_USERNAME, $EMAIL_PASS, $EMAIL_FROM, $destination, $_POST['subject'], 
$_POST['message'], $email_notice, $_POST['files']);

echo 'Subject: ' . $_POST['subject']. '<br>';
echo 'Message: ' . $_POST['message']. '<br><br>';
echo 'Attached Files: <br>';

if (isset($_POST['files'])){

    foreach ($_POST['files'] as $file) {
        echo $file . '<br>';
    }
}

?>