Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

newbie asking a stupid question

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
e1front
Smarty n00b


Joined: 14 Jun 2003
Posts: 1

PostPosted: Sat Jun 14, 2003 10:30 am    Post subject: newbie asking a stupid question Reply with quote

I have my soft cart configured to display the credit card for customers for some wierd reasons
so we started to have complains about that
so we want to display the first 4 digits and the last 4 digits of the credit card number ...
the problem is , i only know "truncate", but this doesn't satisfy the job

here is how the process goes,
we fetch the credit card number corresponding to the user login name
we decrypt the credit card number in .php page
we have the code to display the credit card number in the .tpl template
so we need to display 1111222233334444
as 1111....4444

aslo should i decrypt the first 4 and the last 4 digits only, or there is no such a thing???

please remember i am a really newbie here,
so i need more clarification

thanks
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Sat Jun 14, 2003 12:54 pm    Post subject: Reply with quote

hi e1front:

My suggestion is to consider not sending the complete CC # to the template at all. Instead chop it up in PHP before you assign it to the template.

Either of the following which (should) do a 1234abcde5678 => 1234#####5678 type conversion-- but I didn't test them.

[php:1:d921103be0]<?php
$cc = substr($cc, 0, 4) . str_repeat('#', strlen($cc)-Cool . substr(strrev($cc), 0, 4);

// or using a regular expression...
$cc = preg_replace('!\d{4,4}(.)*\d{4,4}!u', '#', $cc);
?>[/php:1:d921103be0]
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    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