HUB OF TUTORIALS
  • Business
  • Digital Marketing
  • Technology
    • HTML
    • CSS
    • jQuery
    • WordPress
    • Core PHP
    • Mysql
    • JAVA
    • Projects
    • Photography
  • Recipes
  • Others
  • Write for Us
HUB OF TUTORIALS
  • Business
  • Digital Marketing
  • Technology
    • HTML
    • CSS
    • jQuery
    • WordPress
    • Core PHP
    • Mysql
    • JAVA
    • Projects
    • Photography
  • Recipes
  • Others
  • Write for Us
  • Business
  • Digital Marketing
  • Technology
    • HTML
    • CSS
    • jQuery
    • WordPress
    • Core PHP
    • Mysql
    • JAVA
    • Projects
    • Photography
  • Recipes
  • Others
  • Write for Us
HUB OF TUTORIALS
  • Business
  • Digital Marketing
  • Technology
    • HTML
    • CSS
    • jQuery
    • WordPress
    • Core PHP
    • Mysql
    • JAVA
    • Projects
    • Photography
  • Recipes
  • Others
  • Write for Us
Core PHPCSSHTMLjQueryMysql

How to Create Email Verification Script in PHP

In this article, you will learn How to Create Email Verification Script in PHP.

user_registration table

CREATE TABLE IF NOT EXISTS `user_registration` (
  `id` int(11) NOT NULL,
  `name` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  `activationcode` varchar(255) NOT NULL,
  `status` int(11) NOT NULL,
  `postingdate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;

index.php

<html>
<head>
<title>Registration</title>
</head>
<body>
<form name="insert" action="insert.php" method="post">
<table width="100%"  border="0">
<tr>
<th height="62" scope="row">Name </th>
<td width="71%"><input type="text" name="name" id="name" value=""  class="form-control" required /></td>
</tr>
<tr>
<th height="62" scope="row">Email id </th>
<td width="71%"><input type="email" name="email" id="email" value=""  class="form-control" required /></td>
</tr>
<tr>
<th height="62" scope="row">Password </th>
<td width="71%"><input type="password" name="password" id="password" value=""  class="form-control" required /></td>
</tr>
<tr>
<th height="62" scope="row"></th>
<td width="71%"><input type="submit" name="submit" value="Submit" class="btn-group-sm" /> </td>
</tr>
</table>
</form>
</body>
</html>

insert.php

<?php
include_once("config.php");
if(isset($_POST['submit']))
{
$name=$_POST['name'];
$email=$_POST['email'];
$password=md5($_POST['password']);
$status=0;
$activationcode=md5($email.time());
$query=mysqli_query($con,"insert into user_registration(name,email,password,activationcode,status) values('$name','$email','$password','$activationcode','$status')");
 if($query)
 {
$to=$email;
$msg= "Thanks for new Registration.";
$subject="Email verification (huboftutorials.com)";
$headers .= "MIME-Version: 1.0"."\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1'."\r\n";
$ms.="<html></body><div><div>Dear $name,</div></br></br>";
$ms.="<div style='padding-top:8px;'>Please click The following link For verifying and activation of your account</div>
<div style='padding-top:10px;'><a href='http://www.huboftutorials.com/verification.php?code=$activationcode'>Click Here</a></div>
</div>
</body>
</html>";
mail($to,$subject,$ms,$headers);
echo "<script>alert('Registration successful, please verify in the registered Email-Id');</script>";
echo "<script>window.location = 'login.php';</script>";;
}
else
{
echo "<script>alert('Data not inserted');</script>";
}
}
?>

verification.php

<?php
include 'config.php';
if(!empty($_GET['code']) && isset($_GET['code']))
{
$code=$_GET['code'];
$sql=mysqli_query($con,"SELECT * FROM user_registration WHERE activationcode='$code'");
$num=mysqli_fetch_array($sql);
if($num>0)
{
$st=0;
$result =mysqli_query($con,"SELECT id FROM user_registration WHERE activationcode='$code' and status='$st'");
$result4=mysqli_fetch_array($result);
if($result4>0)
 {
$st=1;
$result1=mysqli_query($con,"UPDATE user_registration SET status='$st' WHERE activationcode='$code'");
$msg="Your account is activated";
}
else
{
$msg ="Your account has already activated, no need to activate again";
}
}
else
{
$msg ="Wrong activation code.";
}
}
?>

login.php

<html>
<head>
<title>Login</title>
</head>
<body>
<form name="insert" action="" method="post">
<font color="#FF0000"><?php echo $_SESSION['action1']; ?><?php echo $_SESSION['action1']="";?></font>
Email id
<input type="email" name="email" id="email" value=""  class="form-control" required />
Password
<input type="password" name="password" id="password" value=""  class="form-control" required />
<input type="submit" name="login" value="Submit" class="btn-group-sm" />
</form>
</body>
</html>
email checker email id checker email verifier form validation using javascript php validate email php validator
How to Delete Multiple Records from Database using PHPPrevHow to Delete Multiple Records from Database using PHPMarch 16, 2020
How to Get last id From Mysql Using PHPMarch 16, 2020How to Get last id From Mysql Using PHPNext
Search
Recent Posts
  • The Power of AI Writing Tools in Transforming Digital Marketing Strategies
  • What is the difference between web design and GUI design?
  • Transforming Your Business with JustEat Like App Excellence
  • The Role of Plagiarism Changers in Enhancing Content Quality
  • How Students Can Increase Their Academic Productivity With Paraphrase Tool?
Categories
  • Business
  • Core PHP
  • CSS
  • Digital Marketing
  • HTML
  • JAVA
  • Jobs
  • jQuery
  • Mysql
  • News
  • Others
  • Photography
  • Projects
  • Recipes
  • WordPress

  • How to Create List in HTML
  • How to use Iframe in HTML
  • How to Create a Table in HTML and CSS
  • How to Add New HTML Content using jQuery
  • CSS Property of List tag in HTML
  • How to use CSS for Table in HTML
  • How to Make Basmati Rice Recipe
  • How to Make Indian Kheer Recipe
  • How to Make Spicy Aloo Tikki
  • How to Make Aloo Matar Samosa
  • How to Make Cheese Potato Sandwich
  • How to Make Aloo Palak Methi
  • Company Visitors Management System
  • Complaint Management System using PHP
  • Directory Management System
  • Employee Record Management System
  • Hospital Management System using PHP
  • Vehicle Parking Management System

Copyright © 2022 Hub of Tutorials. All Rights Reserved. Designed by AS Webworks