Save Data Into MySQL Table :
<?php
include("connection.php");
if($_GET['register']=='true'){
if ($_POST["captcha"] != $_SESSION['security_code'] or
empty($_SESSION['security_code']))
{
$str="ERROR: Incorrect verification code!";
header("Location:register.php?msg=$str");
}
else
{
$fname = mysql_real_escape_string($_POST['fname']);
$lname = mysql_real_escape_string($_POST['lname']);
$email = mysql_real_escape_string($_POST['email']);
$password = mysql_real_escape_string(md5($_POST['password']));
$status = 'inactive';
mysql_query("insert into register set fname = '".$fname."',
lname = '".$lname."',
email = '".$email."',
password = '".$password."',
status = '".$status."'");
$iduser = mysql_insert_id();
/* You can write your activation mail program here */
/* Or You can redirect user to My account Page */
$str="Welcome to A2Z webhelp";
header("Location:welcome.php?msg=$str");
}
}
?>
Here we have used MD5 encoding to protect password. You can use any other password encoding options available in PHP.
If you doesn't want user's email verification then you can make $status='active' and
send the user to my account page.
Send Activation Mail to User:
$to = $email;
$from = "info@a2zwebhelp.com";
$subject = "Activate your Account";
$message = "<a href='http://www.a2zwebhelp.com/activete.php?email=".$email."'>
Click here</a> to activate your account.";
$headers = "MIME-Version: 1.0\r\nContent-type: text/html; charset=utf-8\r\n";
$headers .= "From: \"" . $from . "\" \r\n";
$headers .= "Reply-To: " . $to . "\r\n";
$message = utf8_decode($message);
mail($to, $subject, $message, $headers);
Create your activete.php file:
<?php
include("connection.php");
if($_GET['email']){
$email = mysql_real_escape_string($_GET['email']);
mysql_query("update register set status='active' where
email='".$email."' and status='inactive'");
$str="Welcome to A2Z webhelp";
header("Location:welcome.php?msg=$str");
}
?>
Now you can create your login.php file.
Other Login/ Registration Systemss
Login/ Register With Twitter
Login/ Register With Linked In
Login/ Register With Yahoo!
Login/ Register With Gmail
Login/ Register With Hotmail
Login/ Register With Email