<?php


// Database connection settings
$host = "localhost";
$dbname = "ftfcvgse_sdetb";
$username = "ftfcvgse_sdetb";  // Change if using a different MySQL user
$password = "ftfcvgse_sdetb";  // Set password if required

try {
    $pdo = new PDO("mysql:host=$host;dbname=$dbname;charset=utf8mb4", $username, $password);
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
    die("Database connection failed: " . $e->getMessage());
}



date_default_timezone_set('Africa/Lagos');




// $query = $pdo->prepare("SELECT * FROM settings ORDER BY id DESC LIMIT 1");
// $query->execute();
// $row = $query->fetch(PDO::FETCH_ASSOC);

// if ($row) {
//     // Assign fetched values to variables for site-wide use
//   	$title=$row['title'];
// 				$id=$row['id'];
// 				$welc_head=$row['welc_head'];
// 			    $welc_msg=$row['welc_msg'];
// 				$url=$row['url'];
// 				$ceo=$row['ceo'];
// 				$domain=$row['domain'];
// 				$domain_name=$row['domain_name'];
// 				$phone=$row['phone'];
// 				$country=$row['country'];
// 				$state=$row['state'];
// 				$city=$row['city'];
// 				$email=$row['email'];
// 				$email2=$row['email2'];
// 				$copyright=$row['copyright'];
// 				$contact_email=$row['contact_email'];
// 					$developa=$row['developa'];
				
				
					
					
// 				$sell_rate=$row['sell_rate'];
// 				$buy_rate=$row['buy_rate'];
// 					$tr_rate=$row['tr_rate'];
// 						$wid_rate=$row['wid_rate'];
				
				
// 			// Currency Exchange Rates
//         $GHS = $row['GHS'];
//         $EUR = $row['EUR'];
//         $NGN = $row['NGN'];
//         $CAD = $row['CAD'];
//         $GBP = $row['GBP'];
//         $ZAR = $row['ZAR'];
//         $USD = $row['USD'];
//         $AUD = $row['AUD'];
//         $JPY = $row['JPY'];
//         $CNY = $row['CNY'];
//         $PHP = $row['PHP'];
//         $UAE = $row['UAE'];
//         $BRL = $row['BRL'];
//         $ARS = $row['ARS'];
				
				
// 					$reg_clients=$row['reg_clients'];
// 			$btc_sold=$row['btc_sold'];
// 			$btc_bought=$row['btc_bought'];
			
			
// 			 $news_head=$row['news_head'];
// 		   	$news_msg=$row['news_msg'];
				
				
// 				$about_head=$row['about_head'];
// 				$about_msg=$row['about_msg'];
				
// 					$service1=$row['service1'];
// 						$service2=$row['service2'];
// 							$service3=$row['service3'];	
							
// }















   // Fetch settings from database
    $stmt = $pdo->query("SELECT * FROM settings ORDER BY id DESC LIMIT 1");
    $row = $stmt->fetch(PDO::FETCH_ASSOC);
    
    if ($row) {
        $title = $row['title'];
        $id = $row['id'];
        $welc_head = $row['welc_head'];
        $welc_msg = $row['welc_msg'];
        $url = $row['url'];
        $ceo = $row['ceo'];
        $domain = $row['domain'];
        $domain_name = $row['domain_name'];
        $phone = $row['phone'];
        $country = $row['country'];
        $state = $row['state'];
        $city = $row['city'];
        $address = $row['address'];
        $email = $row['email'];
        $email2 = $row['email2'];
        $copyright = $row['copyright'];
        $contact_email = $row['contact_email'];
        $developa = $row['developa'];
       
       
        $password = $row['password'];
        $sell_rate = $row['sell_rate'];
        $buy_rate = $row['buy_rate'];

        // Currency Exchange Rates
        $NGN = $row['NGN'];
        $ZAR = $row['ZAR'];
        $GBP = $row['GBP'];
        $CNY = $row['CNY'];
        $CAD = $row['CAD'];
        $AUD = $row['AUD'];
        $EUR = $row['EUR'];
        $JPY = $row['JPY'];
        $GHS = $row['GHS'];
        $KRW = $row['KRW'];
        $TWD = $row['TWD'];
        $THB = $row['THB'];
        $MYR = $row['MYR'];
        $BRL = $row['BRL'];
        $ARS = $row['ARS'];
        $PHP = $row['PHP'];
        $AED = $row['AED'];
        
	$code=$row['code'];




















        // Statistics
        $reg_clients = $row['reg_clients'];
        $btc_sold = $row['btc_sold'];
        $btc_bought = $row['btc_bought'];

        // News & About Section
        $news_head = $row['news_head'];
        $news_msg = $row['news_msg'];
        $about_head = $row['about_head'];
        $about_msg = $row['about_msg'];

        // Services
        $service1 = $row['service1'];
        $service2 = $row['service2'];
        $service3 = $row['service3'];
        $whatsapp = $row['whatsapp'];
    } else {
        die("No settings found in the database.");
    }


?>
