File "testpin.php"

Full path: /home/fsibplc/public_html/fsib/testpin.php
File size: 2.93 B (2.93 KB bytes)
MIME-type: text/x-php
Charset: utf-8

Download   Open   Edit   Advanced Editor   Back

<?php
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Pragma: no-cache");
header("Expires: 0");
//https://testgpin.qcashbd.com:18286
$curl = curl_init();
$date = time();
$ext = "FSIB".$date;
$fsib = base64_encode($ext);

    
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://103.210.61.6:18286/api/request/v1/gettoken',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>json_encode(array(
    "operation" => "GetTokenInfo",
    "bank_id" =>"Mzk=",
    "user_name" =>"RlNJQg==",
    "password" =>"SVRDIzIwMjUjQCE=",
    "external_id" => $fsib
  )),
  CURLOPT_HTTPHEADER => array(
    'Accept: application/json',
    'Content-Type: application/json',
    'Authorization: Basic '. base64_encode('FSIB:ITC#2025#@!')
  ),
  CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_SSL_VERIFYHOST => false,
    CURLOPT_FRESH_CONNECT => true,
    CURLOPT_FORBID_REUSE => true   
  
    //CURLOPT_HEADER => true
    // Prevent cURL from reusing connections
    // Proxy Port
));

$response = curl_exec($curl);

if ($response === false) {
    echo 'Curl error: ' . curl_error($curl);
}

curl_close($curl);
//echo $response;
$response1 = json_decode($response, true);

$encoded_url = $response1['redirecturl'];

$encrypted_data = base64_decode($encoded_url);

// Step 2: Load the RSA private key (assuming the private key is in a .pem file)
$private_key = file_get_contents('key.pem'); // Update with your private key path

if ($private_key === false) {
    echo "Failed to load private key.";
    exit();
}
// Step 3: Decrypt the data using the RSA private key
if (openssl_private_decrypt($encrypted_data, $decrypted_data, $private_key)) {
    // If decryption is successful, redirect to the decrypted URL
//  echo "<br>".$decrypted_data;
  $redirect_url = base64_decode($decrypted_data);
 // echo "<br>".$redirect_url;
     $SERVER = "localhost";
    $USERNAME = "fsibplc_soft_team";
    $PASSWORD ="Fsib@Soft@Team";
    $DATABASE = "fsibplc_account_opening";

    // Create connection
    $conn = new mysqli($SERVER, $USERNAME, $PASSWORD, $DATABASE);

    // Check connection
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }

    // Prepare and execute the INSERT statement
    $sql = "INSERT INTO track_ex_id (external_id) VALUES ('$ext')";
    if ($conn->query($sql) === TRUE) {
        echo "Record inserted successfully";
    } else {
        echo "Error inserting record: " . $conn->error;
    }

    $conn->close();
    header("Location: $redirect_url");
    exit();
} else {
    // If decryption fails, print an error
    echo "Decryption failed.";
}

//echo json_decode($response["redirecturl"]);



//$conn->close

?>