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
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

Link to comment
Share on other sites

Thanks neil.johnson!

 

That manages the masking issue but do you know how to find the numbers that need masking in the first place?

I mean if the string is "TRANSFER 540021 61782457", how do I find just the 540021 or 61782457 within the string?

Link to comment
Share on other sites

<?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);
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.