in your user table add 2 new columns called "validated" and "activation_id"
upon registration create a random string and store it in column "activation_id" (write 0 into column "validated")
send a mail to the user containing a like like
http://www.example.com/active.php?id=[i]the activation_id you generated[/i]
in activate.php update your user table: set "validated" to 1 where "activation_id" holds the value the user provided via $_GET['id']
in your login make sure you only allow logging in if "validated" = 1