CodeIgniter Forums
Prevent duplicate db's row - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Prevent duplicate db's row (/showthread.php?tid=81385)

Pages: 1 2


Prevent duplicate db's row - pippuccio76 - 02-22-2022

HI , sorry for english , i have several anchor that create a row and redirect to modify this record . If i press the anchor 3 times before internet change page , are created 3 rows . How can i prevent this ?


RE: Prevent duplicate db's row - iRedds - 02-22-2022

Don't press 3 times.
https://codeigniter.com/user_guide/libraries/throttler.html


RE: Prevent duplicate db's row - pippuccio76 - 02-22-2022

(02-22-2022, 11:37 PM)iRedds Wrote: Don't press 3 times.
https://codeigniter.com/user_guide/libraries/throttler.html

This can be used for a single user?


RE: Prevent duplicate db's row - iRedds - 02-23-2022

Maybe.


RE: Prevent duplicate db's row - kenjis - 02-23-2022

Do not use anchor to create a row.


RE: Prevent duplicate db's row - pippuccio76 - 02-23-2022

(02-23-2022, 12:31 AM)kenjis Wrote: Do not use anchor to create a row.

Anchor or form Is the same for this problem, or not?


RE: Prevent duplicate db's row - iRedds - 02-23-2022

(02-23-2022, 12:31 AM)kenjis Wrote: Do not use anchor to create a row.

I agree with @kenjis .
In addition, this is not a REST approach.
By sending a POST request, you can add a CSRF check, which should not allow you to send more than 1 request with the same csrf token.


RE: Prevent duplicate db's row - pippuccio76 - 02-23-2022

(02-23-2022, 01:58 AM)iRedds Wrote:
(02-23-2022, 12:31 AM)kenjis Wrote: Do not use anchor to create a row.

I agree with @kenjis .
In addition, this is not a REST approach.
By sending a POST request, you can add a CSRF check, which should not allow you to send more than 1 request with the same csrf token.
Same problem with form , if i click on Button submit several time are created One row for every click


RE: Prevent duplicate db's row - iRedds - 02-23-2022

(02-23-2022, 02:25 AM)pippuccio76 Wrote: Same problem with form , if i click on Button submit several time are created One row for every click

With CSRF protection?


RE: Prevent duplicate db's row - pippuccio76 - 02-23-2022

(02-23-2022, 02:42 AM)iRedds Wrote:
(02-23-2022, 02:25 AM)pippuccio76 Wrote: Same problem with form , if i click on Button submit several time are created One row for every click

With CSRF protection?
Yes in .env is set to true