In php projects, I generated a csrf token, entered it into the session and later compared it with the $_POST['token'] request. One now I need this functionality for github.pages. I found how to do the same using JS. But how and with what should I now compare this parameter in the php config?
<form class="" action="https://somewhere.com/form/form.php" method="POST" id="contact_form">
<input type="text" name="name" value="">
<input type="email" name="email" value="">
<input type="hidden" name="token" value="">
<a id="submitBtn" href="#"></a>
</form>
if($_POST['token']==?????){
//code
}
And is there a php analog of the bin2hex(random_bytes(32)) function in pure JS?