Re: Replace credit card numbers with X ???

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In addition to what was mentioned already, using ereg_replace, if you're pulling the CC# string out of a database of off of some POST data or something, just use a substr() function to pull the last 4 digits and prepend a bunch of X's.

$ccnum = "342342522342342";  # fake CC #, prob not even correct # of digits :)
$maskedccnum = "XXXXXXXXXXX" . substr($ccnum,strlen($ccnum)-5,4);


If you're trying to do it in a form, realtime as the user enters it, you'd have to use some funky javascript or do something with a password form type or something.  But sounds like you want it like when you display an invoice afterwards or display a "Would you like to use this CC that's already on file?" type thing without exposing the whole CC#.

-TG

= = = Original message = = =

Hello,

I need to replace all the numbers of a credit card except for the last
4 with an 'X' ... can't seem to locate the string function for this...
can someone point me in the right direction here to what php item i
should be using.

Thanks!
Joe


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux