yo utilizo esta funcion
Código PHP:
function encoded($ses)
{
$sesencoded = $ses;
$num = mt_rand(4,4);
for($i=1;$i<=$num;$i++)
{
$sesencoded =
base64_encode($sesencoded);
}
$alpha_array =
array('Y','D','U','R','P',
'S','B','M','A','T','H');
$sesencoded =
$sesencoded."+".$alpha_array[$num];
$sesencoded =
base64_encode($sesencoded);
return $sesencoded;
}//end of encoded function
function decoded($str)
{
$alpha_array =
array('Y','D','U','R','P',
'S','B','M','A','T','H');
$decoded =
base64_decode($str);
list($decoded,$letter) =
split("\+",$decoded);
for($i=0;$i<count($alpha_array);$i++)
{
if($alpha_array[$i] == $letter)
break;
}
for($j=1;$j<=$i;$j++)
{
$decoded =
base64_decode($decoded);
}
return $decoded;
}//end of decoded function
y lo utilizo asi:
Código:
<a href="view_orders.php?c=<?php echo encoded($com_id); ?>">Orders</a> |
y luego en view_orders.php
Código PHP:
$c=''.decoded($_REQUEST ['c']).'';
$db->execute("SELECT *,DATE_FORMAT(date_pickup, '%m-%d-%Y') as formatted_date FROM order_items WHERE com_id=".$c." ORDER BY order_number DESC");