Email Verification in PHP: Part 2

This video to illustrates, verification of user email ID by sending a unique URL to be clicked by the user inorder to active his account, to further use the application.

Continuation of Email Verification in PHP: Part 1

login form
login.php

This is bit more than just a simple login form. Because, here we need to check if the user is present in our database, and next, if present, whether the user has activated his/her account or not.

 

This is just the login form. Below is the coding of log.php file which does all the decision making activities.

login action page
log.php



0)
 {
   echo 'Successfully logged in
'; $rs = mysql_query("SELECT actv from login where email='$u'"); $rw = mysql_fetch_array($rs); if($rw[0] == 0) { echo 'But please activate your email ID, before proceeding'; exit(); } else { $rs = mysql_query("SELECT name from login where email='$u'"); $rw= mysql_fetch_array($rs); echo "Account activated......

Welcome ".$rw[0].",

This website will be ready soon, and you'll be among the first to hear from us!
Until then, you can browse through our extensive collection of quality tweets submitted by our present members Retweet Club

Regards,
Satish, CEO Technotip IT Solutions and Training Center
"; exit(); } } else echo "
Login Failed"; ?>

again, we are making use of md5() encryption, inorder to check with the already encrypted data present inside the database.

$res = mysql_query("SELECT count(*) from login where(email='$u' and pass='$p')");

  $row = mysql_fetch_array($res);
 
 if($row[0]>0)
 {
   echo 'Successfully logged in
'; } else echo "
Login Failed";

with this we are checking if the user has already registered or not.

If he/she is a registered user, then we check if the account has been activated or not..

$rs =  mysql_query("SELECT actv from login where email='$u'");
   $rw =  mysql_fetch_array($rs);

   if($rw[0] == 0)
   {
  echo 'But please activate your email ID, before proceeding';
  exit();
   } 
   else
   {
              $rs = mysql_query("SELECT name from login where email='$u'");
              $rw= mysql_fetch_array($rs);
  echo "Account activated......

Welcome ".$rw[0].",

This website will be ready soon, and you'll be among the first to hear from us!
Until then, you can browse through our extensive collection of quality tweets submitted by our present members Retweet Club

Regards,
Satish, CEO Technotip IT Solutions and Training Center
"; exit(); }

Depending on whether the user has activated his/her account we display the appropriate message.

activate.php
This is the file to which the values will be sent to, once the user clicks on the link sent to his/her email.

Using the values sent by the user(upon clicking the link), this script checks the value against the database to see if its valid. If valid, it updates the act attribute value to 1, which indicated the user verified his/her account.



Your account activated
Login now'; } else echo "Wrong link bro!"; ?>

Video Tutorial: Part 2



YouTube Link: https://www.youtube.com/watch?v=Cm5Q0xlir-Q [Watch the Video In Full Screen.]



Other users:
We can make use of this application and allow or disallow some of the features of our application.
This technique highly helps in combating with the spam issues on the web.

You can purchase this simple script directly for as less as $1.95 get here.