KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

How to encrypt and decrypt the values passed in the url #2051

Closed Abhishek opened this topic on on May 3 - 2 comments

Abhishek commented on May 3

Dear Team, I have a problem with of how to encrypt and decrypt the values passed in the url

url code:

return "<a  href='abc.php?employeeFirstName=" . $row['employeeFirstName']. $branchString." & start=" . $this->params["dateRange"][0] . " & end=" . $this->params["dateRange"][1] . "'target=\"subreport\">$value</a>";

encrypt code:

return "<a  href=performanceenquiryindex.php?employeeFirstName=$encryptId1.$encryptId2&start=$encryptId3&end=$encryptId4 target=\'subreport\'>$value</a>";

decryptcode:

$Abc= new abc([

if(isset($_GET['employeeFirstName']))
    {
		
	$employeeFirstName=decrypt_url($_GET["employeeFirstName"]);
	}
	if(isset($_GET['brnchName']))
    {
		
	$brnchName=decrypt_url($_GET["brnchName"]);
	}
	if(isset($_GET['start']))
    {
		
	$start=decrypt_url($_GET["start"]);
	}
	if(isset($_GET['end']))
    {
		
	$end=decrypt_url($_GET["end"]);
	}
]);
$Abc->run()->render();
Abhishek commented on May 4

Dear Team, In the previous post I have asked you you pass the values from main report to sub report and for that you have provided solution for me and I have done with it. And below is the link of the previous post.

And now could you please help me on you should I pass those values by encrypt and how do I decrypt it in my sub reports. And above is the code which I have tried to achieve the concept but could not.

So could you please help me on how to encrypt and decrypt those values.

KoolReport commented on May 4

To make thing simple, you do this:

(1) In the formatValue function, you do:

$data = base64_encode(json_encode([
    "employeeFirstName"=>$row["employeeFirstName"],
    "brnchName"=>$this->params["brnchName"],
    "start"=>$this->params["dateRange"][0],
    "end"=>$this->params["dateRange"][1],
]));

return "<a href='performanceenquiryindex.php?data=$data'>Details</a>";

(2) In the performanceenquiryindex.php, you do:

$data = json_decode(base64_decode($_GET["data"]),true);

$report = new performanceenquiry($data);

(3) Inside performanceenquiry class you can check params:

var_dump($this->params);

You can see if you have "employeeFirstName", "brnchName", "start" and "end" date.

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
None yet

None