poniedziałek, 31 sierpnia 2015

PHP registration form with email confirmation

In this tutorial I will focus on registration from with email confirmation.

  1. First we have to create tabel in MySQL with user data and with field "auth_code". To this field script will insert unique number and send this number to email.
  2. Create vriable with unique id number $kod = uniqid();
  3. Modify SQL insert statement to insert this number to tabel with users mysql_query("INSERT INTO uzytkownicy (..., kod_aktywacyjny) VALUES (..., $kod)");
  4. Using mail function send mail with link and this number to email
  5. After click on link the next script has to get this number from url and compare it with number from database and show message that account was activated