Decryption Data after getting from database

Decryption Data after getting from database

asif_shahzad87asif_shahzad87 Posts: 3Questions: 0Answers: 0
edited February 2014 in General
HI all,

I am using datatables and i want to decrypt data after getting it from database. how can i do this ..... ? There is no issue in getting data from database. i am facing problems in decrypting data after getting it from database, in other words i want to convert javascript string into php string to decrypt it.

Here is my code ......

[code]

$('#example1').dataTable( {
"bProcessing": true,
"bServerSide": true,
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"sAjaxSource": "Server-Processing.php?colums=<?php echo $str ?>&&table=<?php echo $table ?>&&where_clause=<?php echo $WHERE ?>&&unique=<?php echo $unique_colum ?>",

"bAutoWidth": false,
"sDom": '<"H"Tfr>t<"F"ip>',

"aoColumns": [

{
"sName": "ID",
"bSearchable": false,
"bSortable": false,
"fnRender": function (oObj) {
return "" + oObj.aData[0] + "";
}
},

{
"sName": "test",
"bSearchable": false,
"bSortable": false,
"fnRender": function (oObj) {

[quote] <?php echo mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, 'oObj.aData[1] ', MCRYPT_MODE_ECB, $iv) ?> ; [/quote]

}
..........................................
......................................
.............
[/code]

[quote] Note: I am using PHP to encrypt and decrypt data [/quote]

Thanks in advance

Replies

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin
    Since you are using server-side processing, you must update your PHP script to do the decrypt before it sends the data back to the client.

    Allan
  • asif_shahzad87asif_shahzad87 Posts: 3Questions: 0Answers: 0
    In which way i need to update my php script ? can you elaborate please ?

    In given example, i just want to to convert javascript string say "abc" into php string say $xyz

    <?php

    var abc = oObj.aData[1];

    $xyz = abc;

    mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $xyz, MCRYPT_MODE_ECB, $iv)

    ?>
  • asif_shahzad87asif_shahzad87 Posts: 3Questions: 0Answers: 0
    Thanks a lot Allan ....... After updating of PHP script its working fine ......
This discussion has been closed.