Friday, 13 November 2015

PHP script for email verification or confirmation in php?

00:58

(1) first create table user:

create table user
(id int primary key auto_increment,

name varchar(200),
email varchar(200),
phone varchar(200),
password varchar(200),
com_code varchar(200));


(2)write code for connect.php file:

<?php

$con=mysql_connect("localhost","root","");
mysql_select_db("itexamtime",$con) or die(mysql_error());

?>

(3)write code for registerform.php file:
<?php


echo '<form action="insert1.php"   method="post">
      Name<input type=text name="name">
  Email<input type=email name="email">
  phone  <input type=text    name="phone">
  password<input type=password name="password">
  <input  type=submit  name=submit value=submit>';
 
  
?>

(4)write code for insert1.php file:



<?php
$name=$_POST['name'];
$email=$_POST['email'];
$phone=$_POST['phone'];
$password=$_POST['password'];
$com_code=md5(uniqid(rand()));
include_once("connect.php");

$sql="insert into user(name,email,phone,password,com_code)values('$name','$email','$phone','$password','$com_code')";

$result=mysql_query($sql) or die(mysql_error());

if($result)
  {
   $to = $email;
   $subject = "Confirmation from TutsforWeb to $username";
   $header = "ItexamTime: Confirmation LInk";
  
   $message .= "http://funmoviemasti.com/confirm.php?passkey=$com_code";

   $sentmail = mail($to,$subject,$message,$header);

   if($sentmail)
            {
   echo "Your Confirmation link Has Been Sent To Your Email Address.";
   }
   else
         {
    echo "Cannot send Confirmation link to your e-mail address";
   }

}

?>

(5)write code for confirm.php file:

<?php

include_once("connect.php");

$passkey = $_GET['passkey'];

 $sql="update user set com_code='1'  where com_code='$passkey'";

$result=mysql_query($sql) or die(mysql_error());

if($result)

{


echo "your account is active ";




}



?>

Written by

We are Creative Blogger Theme Wavers which provides user friendly, effective and easy to use themes. Each support has free and providing HD support screen casting.

1 comments:

  1. Thanks for sharing this information. awesome useful information about PHP. PHP training in Bangalore

    ReplyDelete

PHP Training Mumbai, PHP MySQL Training Mumbai, PHP Course Mumbai, PHP Institute Mumbai

 

© 2013 PHP TRAINING IN MUMBAI BY OM SIR . All rights resevered. Designed by OM SIR

Back To Top