Jump to content

Masking Bank Details


tinks87

Recommended Posts

Hi,

Im developing a program and it contains bank details in some of the fields stored in the MySQL database.

As part of the upload, I need to find bank details and then mask them by replacing them with XXXXXX for security purposes.

 

An example of a field could be "TRANSFER 540021 61782457" and I need to replace to "TRANSFER XXXXXX XXXXX457"

 

Any ideas to the best possible method?

 

Maybe I would mask blocks of numbers (ie numbers in blocks of 6 or 9) to cover this...im not sure what the best possible way is.

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/236843-masking-bank-details/
Share on other sites

Basically a user can download their bank transactions and upload for analysis.

Only issue is that it contains bank details in transactions they have made.

 

I see your point about why storing them at all. But I need to store them for the user but leaving the last two digits visible so they can see where the transfer went.

 

Before the upload occurs, I want to remove any bank details for security purposes.

 

Thanks

<?php
/*
heres the transaction string
*/
$string = 'TRANSFER 540021 61782457';
/*
extract the numbers
*/
preg_match_all('/[0-9]+/', $string, $result, PREG_PATTERN_ORDER);
$result = $result[0];
if(count($result)) {
$number = implode('', $result);	
/*
get the last 3 digits to save in the db
*/
        $digits = 3;
        $to_save = substr($number, strlen($number)-$digits, $digits);
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.