function getSCS() { $program = realpath("../app/SCSimulator/tan_generator"); $program_directory = substr($program, 0, strrpos($program, "/")); chdir($program_directory); $acctNum = selectAccountByUserId(getAuthUser()->userid)->ACCOUNT_NUMBER; $dbUser = "******"; $dbPass = "******"; $dbName = "bank_db"; $command = "./tan_generator pin {$acctNum} '{$dbUser}' '{$dbPass}' '{$dbName}'"; $output = shell_exec($command); return $output; }
require_once "../app/user.php"; require_once "../app/transaction.php"; startSession(true); //CSRF if (!isset($_POST['submit']) && !isset($_POST['upload'])) { clearCSRFToken(); createCSRFToken('newtransaction'); } // process form if (isset($_POST['submit']) && isset($_SESSION['newtransactiontoken']) && $_POST['newtransactiontoken'] == $_SESSION['newtransactiontoken']) { $recipient = $_POST['recipient']; $amount = $_POST['amount']; $description = $_POST['description']; $tan = $_POST['tan']; getDBCredentials(getAuthUser()->usertype); $sender = selectAccountByUserId(getAuthUser()->userid)->ACCOUNT_NUMBER; $transaction = createTransaction($sender, $recipient, $amount, $description, $tan); if ($transaction->value) { unset($_SESSION['newtransactiontoken']); header("Location: " . "view_transactions.php"); } if (!empty($transaction->msg)) { $showMsg = $transaction->msg; } } // process file if (isset($_POST['upload'])) { $upload = uploadTransactionFile(); if ($upload->value) { // execute C program $program = realpath("../app/file_parser");
function sendEmailWithPDF($userId, $email, $name, $subject, $body) { require_once 'PHPMailer/class.phpmailer.php'; $account = selectAccountByUserId($userId); $doc = generateUserPDF($account->ID); $password = randomPassword(); $mail = new PHPMailer(); $body = "Requested Tan Numbers are attached to the e-mail..\n\n<br /><br />Password:{$password}"; $mail->CharSet = 'UTF-8'; $mail->SetFrom('*****@*****.**', 'SecureCodingTeam6'); //Set the name as you like $mail->SMTPAuth = true; $mail->Host = "smtp.gmail.com"; // SMTP server $mail->SMTPSecure = "ssl"; $mail->Username = "******"; //account which you want to send mail from $mail->Password = "******"; //this is account's password $mail->Port = "465"; $mail->isSMTP(); $user = getSingleUser($userId); $mail->AddAddress($email, $name); $mail->Subject = $subject; $mail->MsgHTML($body); $doc->SetProtection(array('print', 'copy'), $password); $doc = $doc->Output('', 'S'); //Save the pdf file $mail->AddStringAttachment($doc, 'doc.pdf', 'base64', 'application/pdf'); if (!$mail->send()) { return false; } return true; }