EDIT: I am creating a login and signup for a website. But, I am making it require a activation via email. I want to have them directed to a webpage that changed their "active" status in the database to 1 (boolean) so that they are then permitted to login. All I need now is to be able to change the value in the database
Create a table activations. When user signs up, create a random hash, and store it in this table along with his new user id. Then send an email, containing an url with the hash (for example, http://example.com/confirmation.php?hash=376728zhdif274thfj36
).
In your confirmation.php, you'd take the $_GET
value, query the database with it, and select the according user id, then run another query with the user id, in which you'd set his activation status.
Creating a new hash:
INSERT INTO activations (hash, userid) VALUES ($hash, $userid)
Selecting the userid with the hash:
SELECT userid FROM activations WHERE hash = $_GET['hash']
Updating the activation status with the user id from the query above:
UPDATE users SET active = 1 WHERE userid = $userid