Hello Phphelp forum,
I am new here and new to php. I am struggling to secure a form. I am new to sessions. I am hoping to fight spam and unwanted posts. I decided to try giving my submit button a random name like a token: bin2hex(random_bytes(32)). I also store this value in a session variable. I try comparing the two values but nothing works. If I print_r post array and echo the session variable they both match. yet all of my comparison or isset attempts fail.
I’ve tried $testoutput = $_SESSION[‘buttonname’]; if (isset($_POST[$testoutput])) { …bla bla
is it possible to compare and check input fields with a variable name?
the purpose of this test leads to random input bait for bots. if the input is hidden via css and randomly named, then bots will have to measure all of the possibilities to know if the input is bait. all hidden inputs can be ignored.
atleast tell me if it is possible to handle a variable
Thank You so very much. I am tired of fighting this one.