Re: Replace credit card numbers with X ???
| From: | tg-php at gryffyndevelopment dot com | Date: | Tue, 25 Jan 2005 16:26:31 +0000 |
| Subject: | Re: Replace credit card numbers with X ??? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-207244@lists.php.net to get a copy of this message | ||
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.