vendredi 30 septembre 2016

Generating a random value, and inserting to the db in php

Alright so I am trying to generate a random value, using random_bytes, tell the user his unique ID, and then insert to the database.

I'm using isset so I tried doing $id = bin2hex(random_bytes(16)) but it generates another ID when the user clicks the Register button, meaning the value he saved is not the one that was inserted to the database.

Basically, a random identifier that is generated for him and he needs to save in order to log in (serves as the username).

Thanks!




Aucun commentaire:

Enregistrer un commentaire