<?php
	session_start();
	include"../../connect/db.php"; 
?> 
 <?php
 $chap = $_SESSION['chap'];
        csrf_verify();
 	if( isset($_POST['amount']) ){
       
        $amount = mysqli_real_escape_string($con,$_POST['amount']);
        $bankname = mysqli_real_escape_string($con,$_POST['bankname']);
        $sortcode = mysqli_real_escape_string($con,$_POST['sortcode']);
        $accountnumber = mysqli_real_escape_string($con,$_POST['accountnumber']);
        $accountholder = mysqli_real_escape_string($con,$_POST['accountholder']);
        $description = mysqli_real_escape_string($con,$_POST['description']);
        

        
// Create a Unix timestamp for 12 May 2024, 11:10 PM
$timestamp = mktime(23, 10, 0, 5, 12, 2024);

// Format the timestamp into a readable date and time
$formattedDate = date("d M Y, h:i A", $timestamp);

echo $formattedDate;

function generateRandomCode() {
    $prefix = "ASP";
    $randomString = substr(str_shuffle("ABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 8);
    $randomNumber = rand(1000, 9999);
    
    return $prefix . "/" . $randomString . "-" . $randomNumber;
}

$randomCode = generateRandomCode();
echo $randomCode;


        $sql = mysqli_query($con,"SELECT * FROM users WHERE email = '$chap' ");
	
        $row = mysqli_fetch_assoc($sql);

        $kay = mysqli_query( $con,"INSERT INTO transactions (trans_id, user, description, d_o_t, type, status) VALUES ('$transId', '$chap', ' deposit of $currency$amount  $transId  , $d_o_t ', '$d_o_t', 'Pending', 'Review' ) " );

 		if( $kay ){
 		    
 			echo "success";
 		}
 			else{
 				echo "error";
 			}
 		}
 		else{
 			echo"error";
 		}
 	

 ?>