I am trying to secure or mask data-id="1" or ID in the URL, I want to use random numbers like this data-id= “518079”`.Though I found this method but getting the following error . Please help me to fix this or is there any else way. Please help
Error
Fatal error: Uncaught ArgumentCountError: Too few arguments to function createSecureId(), 1 passed in C:xampphtdocswebsiteappviewscl.php on line 70
Error line 70 is this one
<li class="nav-item"><a class="nav-link " href="javascript:void(0);" data-id="' . createSecureId($value1->cat_id) . '"><span>' . $value1->category . '</i></a></li>';
This the way to encrypt and decrypt I found
$idsecret = "@/@#?2/32kjhasfdkjhsdfe982394895723489uSDIUPSDYsdfupydsfuisyf3";
$shuffleseq = Array("5","3","20","16","9","27","29","23","4","0","21","24","7","6","12","14","11","30","28","22","18","2","15","17","10","25","26","8","13","1","19","31");
function createSecureId($id,$subkey) {
global $idsecret;
$hex = sprintf("%x",shuffleId($id));
$mac = md5($idsecret.$hex.$subkey.$idsecret);
$mac = substr($mac,0,8);
return $hex.$mac;
}
function readSecureId($str,$subkey) {
global $idsecret;
$l = strlen($str);
if ($l <= 8) return -1;
$hex = substr($str, 0, $l-8);
$mac = substr($str, -8, 8);
$vmac = md5($idsecret.$hex.$subkey.$idsecret);
$vmac = substr($vmac,0,8);
if ($mac !== $vmac) return -1;
sscanf($hex, "%x", $id);
return unshuffleId($id);
}