<?php

static $conn;

if (!isset($conn)) {

	$servername = "localhost";
	$database = "rockccbq_rocketta";
	$username = "rockccbq_rocketttt";
	$password = ",%+q%RXbz}9P";
	
	try {
		$conn = new PDO("mysql:host=$servername;dbname=$database", $username, $password);
	} catch (Exception $exception) {
		die('An unexpected error occurred. Connection failed.');
	}
}

if (!function_exists('sendTradeExpiredMail')) {
    function sendTradeExpiredMail($accountId, $trade_type)
    {
    
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, "accountId=$accountId&trade_type=$trade_type");
        curl_setopt($ch, CURLOPT_URL, 'https://rocketta.io/email/send_trade_expired_mail');
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
        curl_setopt($ch, CURLOPT_FORBID_REUSE, true);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 1);
        curl_setopt($ch, CURLOPT_DNS_CACHE_TIMEOUT, 10);
        curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
        curl_exec($ch);
        curl_close($ch);
    }
}