RE: [PHP] Replace credit card numbers with X ???

2005-01-25 Thread Jay Blanchard
[snip]
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.
[/snip]

ROFLMMFAO! It's all been discussed before Joe! 

http://www.php.net/ereg_replace

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



Re: [PHP] Replace credit card numbers with X ???

2005-01-25 Thread Afan Pasalic
this is my way.
   $cc_stars = '';
   $cc_no_lenght = strlen($cc_number);
   $cc_info_first4 = substr($cc_number, 0, 4);
   $cc_info_last4 = substr($cc_number, (strlen($cc_number) - 4), 4);
   for($i=0; $i($cc_no_lenght-8); $i++) $cc_stars .= '*';
   $cc_number = $cc_info_first4 .$cc_stars. $cc_info_last4;
-afan
Joe Harman wrote:
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
 

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


[PHP] [Fwd: DNS.050125191312.29782 (Re: Re: [PHP] Replace credit card numbers with X ???)]

2005-01-25 Thread Afan Pasalic
Hey!
I just got this emai lfrom RIPN mail processor at Moscow ?!?!?!?!?
What's going on?
-afan
 Original Message 
Subject: 	DNS.050125191312.29782 (Re: Re: [PHP] Replace credit card 
numbers with X ???)
Date: 	Tue, 25 Jan 2005 19:13:27 +0300
From: 	RIPN NCC [EMAIL PROTECTED]
To: 	php-general@lists.php.net,[EMAIL PROTECTED]


Dear Madam/Sir,
Here are results of  processing your  request:
From:Afan Pasalic [EMAIL PROTECTED]
Subject: Re: [PHP] Replace credit card numbers with X ???
Date:Tue, 25 Jan 2005 10:06:21 -0600
Msg-Id:  [EMAIL PROTECTED]

this is my way.
unrecognized statment - line ignored.
$cc_stars = '';
unrecognized statment - line ignored.
$cc_no_lenght = strlen($cc_number);
unrecognized statment - line ignored.
$cc_info_first4 = substr($cc_number, 0, 4);
unrecognized statment - line ignored.
$cc_info_last4 = substr($cc_number, (strlen($cc_number) - 4), 4);
unrecognized statment - line ignored.
for($i=0; $i($cc_no_lenght-8); $i++) $cc_stars .= '*';
unrecognized statment - line ignored.
$cc_number = $cc_info_first4 .$cc_stars. $cc_info_last4;
unrecognized statment - line ignored.

-afan
unrecognized statment - line ignored.
Joe Harman wrote:
unrecognized statment - line ignored.
Hello,
unrecognized statment - line ignored.

unrecognized statment - line ignored.
I need to replace all the numbers of a credit card except for the last
unrecognized statment - line ignored.
4 with an 'X' ... can't seem to locate the string function for this...
unrecognized statment - line ignored.
can someone point me in the right direction here to what php item i
unrecognized statment - line ignored.
should be using.
unrecognized statment - line ignored.
Too many warnings (max. 2) - FATAL ERROR!

Thanks!
Joe

  


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

Your current request counter: 1.
You may send us 119 in this hour.
Thank you,
RIPN mail processor.
Tue Jan 25 19:13:27 MSK/MSD 2005
Moscow, Russia.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Replace credit card numbers with X ???

2005-01-25 Thread Jochem Maas
Joe Harman wrote:
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.
that'll be:
string php_replace_all_but_last_four_chars_of_creditcard_number(string input[, 
string pad_string])
actually that func doesn't exist - what you need to do (well its one way to do 
it)
is use a combination of substr() and str_pad() e.g:
echo str_pad(substr($cc, -4), 20, 'X', STR_PAD_LEFT);
where $cc is the previously checked/verified/sanitized creditcard no.
and 20 is the length of a creditcard no. - forgive me if I'm wrong about the CC
number length, I don't have a creditcard.
Thanks!
Joe
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Replace credit card numbers with X ???

2005-01-25 Thread tg-php
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 = XXX . 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



Re: [PHP] Replace credit card numbers with X ???

2005-01-25 Thread Jochem Maas
Jay Blanchard wrote:
[snip]
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.
[/snip]
ROFLMMFAO! It's all been discussed before Joe! 

http://www.php.net/ereg_replace
not-too-serious
wtf :-), I can't find any particular mention of his problem on that page
 (and I know how to use the CTRL+f keycombo in firefox, thanks for asking :-).
regardless of whether ereg_replace() would satisfy his needs pointing him at
that page without explaination is a bit stupid - the guy obviously doesn't
have even half a clue with regards to string manipulation - therefore I think
its safe to assume that regexps are a bit out of his league.
but then again if he is working with (_other_peoples_) creditcard numbers
he should probably:
a, know this shit.
or
b, be capable of finding the answer in the manual.
n'est pas?
anyway I had fun remembering exactly what ROFLMMFAO meant :-), and the tinge
of RTFM at Joe was probably justified - and even if it wasn't I condone it :-)
is it fair game to throw someone an RTFM after you have helped them?
/not-too-serious
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] [Fwd: DNS.050125191312.29782 (Re: Re: [PHP] Replace credit card numbers with X ???)]

2005-01-25 Thread Richard Davey
Hello Afan,

Tuesday, January 25, 2005, 4:12:43 PM, you wrote:

AP Hey!
AP I just got this emai lfrom RIPN mail processor at Moscow ?!?!?!?!?

Join the club.. everyone who posts gets one. Annoying, no?

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I am not young enough to know everything. - Oscar Wilde

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



RE: [PHP] [Fwd: DNS.050125191312.29782 (Re: Re: [PHP] Replace credit card numbers with X ???)]

2005-01-25 Thread Mike Johnson
From: Richard Davey [mailto:[EMAIL PROTECTED] 

 Hello Afan,
 
 Tuesday, January 25, 2005, 4:12:43 PM, you wrote:
 
 AP Hey!
 AP I just got this emai lfrom RIPN mail processor at Moscow ?!?!?!?!?
 
 Join the club.. everyone who posts gets one. Annoying, no?
 
 Best regards,
 
 Richard Davey

My personal favorite is when someone requests a read receipt on
listmail. I wonder what their inbox looks like when 500 people send one
back all in the space of five minutes.


-- 
Mike Johnson Smarter Living, Inc.
Web Developerwww.smartertravel.com
[EMAIL PROTECTED]   (617) 886-5539

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



Re: [PHP] [Fwd: DNS.050125191312.29782 (Re: Re: [PHP] Replace credit card numbers with X ???)]

2005-01-25 Thread Afan Pasalic
Not at all... Actually, I enjoy  :-D
I just wonder what's going on and is it problem on my side or... Now I 
breath easier...

;-)
-afan

Richard Davey wrote:
Hello Afan,
Tuesday, January 25, 2005, 4:12:43 PM, you wrote:
AP Hey!
AP I just got this emai lfrom RIPN mail processor at Moscow ?!?!?!?!?
Join the club.. everyone who posts gets one. Annoying, no?
Best regards,
Richard Davey
 

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


Re: [PHP] [Fwd: DNS.050125191312.29782 (Re: Re: [PHP] Replace credit card numbers with X ???)]

2005-01-25 Thread John Nichel
Mike Johnson wrote:
From: Richard Davey [mailto:[EMAIL PROTECTED] 


Hello Afan,
Tuesday, January 25, 2005, 4:12:43 PM, you wrote:
AP Hey!
AP I just got this emai lfrom RIPN mail processor at Moscow ?!?!?!?!?
Join the club.. everyone who posts gets one. Annoying, no?
Best regards,
Richard Davey

My personal favorite is when someone requests a read receipt on
listmail. I wonder what their inbox looks like when 500 people send one
back all in the space of five minutes.
I usually just delete those without a second glance, but you may be on 
to something...if we all send the read receipt, then maybe the user will 
get tired of all the receipts and turn it off. ;)

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php