Page 1 of 1

encrypt url for edit page or view data etc.

Posted: Fri Aug 30, 2024 7:39 pm
by lissa

Hi master,
how to encrypt url for edit page or view data etc in PHPMaker v2024.14?
Thanks


Re: encrypt url for edit page or view data etc.

Posted: Fri Aug 30, 2024 7:57 pm
by mobhar

Currently, there is no such feature.


Re: encrypt url for edit page or view data etc.

Posted: Fri Aug 30, 2024 8:03 pm
by lissa

is there another way?
because user can easily change ID 4 to 5 at the end of the url like this example http://localhost/cust/productsedit/4


Re: encrypt url for edit page or view data etc.

Posted: Fri Aug 30, 2024 8:07 pm
by mobhar

You may protect the certain record based on your own business-logic by using Row_Selected server event.


Re: encrypt url for edit page or view data etc.

Posted: Sat Aug 31, 2024 11:27 pm
by lissa

I tried with the following code,

$my_id = $rs["id_brand"];
if ($rs["id_brand"] != $my_id && CurrentPageID() == "edit") {
$this->terminate("brandlist");
}

how to make $rs["id_brand"] with $my_id value detected as manually changed in url by user?
is there a way that I don't know?

if I change the value of $my_id and specify the value manually the code runs well:

if ($rs["id_brand"] != "1" && CurrentPageID() == "edit") {
$this->terminate("brandlist");
}

Re: encrypt url for edit page or view data etc.

Posted: Sun Sep 01, 2024 2:16 am
by mobhar

That Row_Selected server event is not for that. As its name said, this event will be fired after a row is selected, and not when a row is updating.

If you want to prevent the record to be updated based on your own business logic, then you should use Row_Updating server event.