<?php 
include 'config.php';
include 'db.php';

include 'mailer/vendor/autoload.php';

use PHPMailer\PHPMailer\PHPMailer;

require_once "mailer/PHPMailer.php";
require_once "mailer/SMTP.php";
require_once "mailer/Exception.php";

 function sendMail($email, $subject, $message){

    $mail = new PHPMailer();
    //SMTP Settings (use default cpanel email account)
    $mail->isSMTP();
    $mail->Host = "webtechs.com.ng"; //
    $mail->SMTPAuth = true;
    $mail->Username = "support@webtechs.com.ng"; // Default cpanel email account
    $mail->Password = '@@mailpass##'; // Default cpanel email password
    $mail->Port = 465; // 587
    $mail->SMTPSecure = "ssl"; // tls

    //Email Settings
    $mail->isHTML(true);
    $mail->setFrom('support@webtechs.com.ng','zenvest'); // Email address/ Bank bane shown to reciever
    $mail->addAddress($email);
    $mail->AddReplyTo("support@webtechs.com.ng", "zenvest"); // Email address/ Bank bane shown to reciever
    $mail->Subject = $subject;
    $mail->MsgHTML($message);
    $send = $mail->Send();
    return $send;
}


function generateRandomCode($length = 6) {
    $characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; // Uppercase letters and digits
    $code = '';
    for ($i = 0; $i < $length; $i++) {
        $index = rand(0, strlen($characters) - 1);
        $code .= $characters[$index];
    }
    return $code;
}


function getRandomStrings() {
    $rnumbs = "1234567890123";
    $tnumbs = str_shuffle($rnumbs);
    $tnumbs = substr($tnumbs, 0, 30);
    return $tnumbs;
  }



	
function text_input($data) {
  $data = trim($data);
  $data = stripslashes($data);
  $data = htmlspecialchars($data);
  return $data;
}




?>