Hello,

I have an online store and am proccessing payments through authorize.net

I want to put some of the order info in my database.

However I do not feel confertable storing the entire CC #

I would like to take lets say for VIsa and master card

1234-4567-1234-1322 and turn it into
xxxx-xxxx-xxxx-1322

and for American Express
1234-123456-12345 and turn it into
xxxx-xxxxxx-x2345

Any Ideas or what php function I should read up on?

Thanks
Chris

    What I would do....

    $cc  = "1234-4567-1234-1322";
    $new = "";
    for($i=0;$i<(strlen($cc)-4);$i++) {
       $new .= ($cc{$i} == "-") ? "-" : "x";
    }
    $new .= substr($cc,-4);
    echo $new;
      $card = "1234-123456-12345";
      
      $newNum = substr($card,0,(strlen($card)-4));
      $preg=preg_replace("#[0-9]#i","x",$newNum);
      echo $preg."".substr($card,-4,4);
      

      Not sure if that will work though

        Write a Reply...