I need to encrypt / decrypt the original MySQL ID printed on the HTML, then revert to the original ID on the backend.
Ex:
$var = $arr['id']; // 120
<table>
<tr>
<td>Logradouro tal e tal, 123</td>
<td> <button class='excluirRegistro' data-id='<?php echo $var; ?>'>Excluir</button> </td> // data-id='120'
</tr>
</table>
I would like to encrypt something like:
$varCrypt = funcao( $var, 'crypt' ); // 012980123324312
<table>
<tr>
<td>Logradouro tal e tal, 123</td>
<td> <button class='excluirRegistro' data-id='<?php echo $var; ?>'>Excluir</button> </td> // data-id='012980123324312'
</tr>
</table>
Subsequently receive in the variable:
$id = $_GET['idregistro']; // 012980123324312
$id = funcao( $id, 'decrypt' );
$id = "120"; // ID original
The scenario is as follows, a table with the address registers registered by the user, with a related button to edit and delete the record.