Jump to content

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

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.