PHP MySQL: decrypt a column value from a MySQL row that was encypted upon insertion and parse to JSON -


everything working, want decrypt db column containing credit card number database following example:

$decp = $crypt->decrypt($encp); 

the row in question is:

'number' => $row['cardnumber'], 

the entire code is:

// cards $jsonresult = $conn->query("select nameoncard, cardnumber, cardtype, carddate, ccvcode                                 cy_user_credit_cards                                 accountnumber='$accountnumber'"); $creditcard = []; while ($row = mysqli_fetch_assoc($jsonresult)) {     array_push($creditcard, [         'name'   => $row['nameoncard'],         'number' => $row['cardnumber'],         'type' => $row['cardtype'],         'date' => $row['carddate'],         'ccv' => $row['ccvcode']     ]); }      // convert array json string , echo     $ccjson = json_encode($creditcard);     echo $ccjson; $conn->close(); 

i think want this:

// cards $jsonresult = $conn->query("select nameoncard, cardnumber, cardtype, carddate, ccvcode                                 cy_user_credit_cards                                 accountnumber='$accountnumber'"); $creditcard = []; while ($row = mysqli_fetch_assoc($jsonresult)) {     array_push($creditcard, [         'name'   => $row['nameoncard'],         'number' => $crypt->decrypt($row['cardnumber']),         'type' => $row['cardtype'],         'date' => $row['carddate'],         'ccv' => $row['ccvcode']     ]); }      // convert array json string , echo     $ccjson = json_encode($creditcard);     echo $ccjson; $conn->close(); 

keep in mind, not want store of these credit card details in database if not absolutely necessary. urge elsewhere handle credit card payments.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -