Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Dedicated server web hosting provided by Guru-host.eu.
truncate part of the string

 
Post new topic   Reply to topic    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
shwekhaw2
Smarty n00b


Joined: 29 Apr 2012
Posts: 2

PostPosted: Sun Apr 29, 2012 3:55 am    Post subject: truncate part of the string Reply with quote

Hi we like to truncate the credit card number in order detail. The problem is that number is not constant. VISA/MASTERCARD/DISCOVER all 16 digits but AMEX only 15 digits. So length varies with card type. Card number is part of larger string so we cannot exclude the whole string either. One fix thing is the text 'Card number: " which comes before the numbers.

Anyway we can find the match for that fixed text and truncate 12 digits after that whatever they may be?

Thanks in advance.
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7036
Location: Lincoln Nebraska, USA

PostPosted: Sun Apr 29, 2012 4:06 am    Post subject: Reply with quote

I would truncate this in PHP before being passed to Smarty, or even truncate at the DB level before getting to PHP. You don't want full credit card numbers assigned to the template, that is not a secure approach to sensitive data.
Back to top
View user's profile Send private message Visit poster's website
shwekhaw2
Smarty n00b


Joined: 29 Apr 2012
Posts: 2

PostPosted: Sun Apr 29, 2012 4:37 am    Post subject: Reply with quote

This is on the admin side. They are encrypted in database and we store only for certain period. But we do need to show on admin side for some admin account. We want to truncate them for low level admin account. I am looking for answer if we can do this on smarty side.
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7036
Location: Lincoln Nebraska, USA

PostPosted: Sun Apr 29, 2012 3:37 pm    Post subject: Reply with quote

This may help you:

http://smarty.incutio.com/?page=modifier_stars
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP