simple forgot password code in php
Hello Friends Ajj Me Apko Btane Wala Hu Ki Aap Kis Parkar Easily Apni Website Me Login Registration Ke Sath Forgate Password Ka Option Add Kar Sakte Ho-
How Its Work-Ye Kaam Kese
Karega
Sabse Pehle To Jab Aap Isme
Email Id Enter Karoge Agar Wo Email Id Apke Database Me Available Hogi To Ye
Script Us Email Id Par Password Send Kar Degi By Using Php Mailer Libarary
Agar Wo Email Id Database Me
Available Nhi Hogi To User Ko Error Message Jayega Ki Apki Id Register Nahi Hai
Steps-
Sabse pehle do file create
kar lijiye-
·
Index.php
·
Forgate.php
Index.php-is
file me ek form create kar lijiye jese image me dikhaya gya hai
Forgate.php-is
file me niche diya gya forgate.php file ka code add kar lijiye copy karke
Ab apko
phpmailer libleray ki jarrurt padegi ise aap niche diye gye link se download
kar lijiye or extract kar lijiye
Ab aap ek
folder bnaiye or us folder ke ander index.php,forgate.php and php mailer liberary
ka folder extract kiya hai use sath me paste kar dijiye ek folder ke ander
Jo folder
extract kiya hai uska name -PHPMailer-master
kar dijiye
Also Read- How To Create Connection In Php
Forgate .php code me apko thoda change karna hai mere
niche btaye gye steps ko follow kare
·
Yanha username –apne
gmail id dale
·
Password-yanha
apne gmail id ka password dale
·
From-yanha be
apne gmail id dale
forgate.php
$conn=mysqli_connect("localhost","root","","forgate");
$email=$_POST["email"];//if it not work then you can use REQUEST Method
$query=mysqli_query($conn,"select * from forgate where email='$email'");
$row=mysqli_fetch_array($query);
require 'PHPMailer-master/PHPMailerAutoload.php';
$mail = new PHPMailer();
//Enable SMTP debugging.
$mail->SMTPDebug = 0;
//Set PHPMailer to use SMTP.
$mail->isSMTP();
//Set SMTP host name
$mail->Host = "smtp.gmail.com";//if you run program on webhosting then using your hosting host here
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
$mail->SMTPAuth = TRUE;
//enter your username and password here
$mail->Username = "yourmail@gmail.com";
$mail->Password = "yourpassword";
//If SMTP(simple mail transfer protocol) needs TLS encryption then set it
$mail->SMTPSecure = "false";
$mail->Port = 587;
//Set TCP port to connect to
$mail->From = "yourmail@gmail.com";
$mail->FromName = "enter form name ";
$mail->addAddress($row["email"]);
$mail->isHTML(true);
$mail->Subject = "forgate mail";
$mail->Body = "this is your password:".$row["pass"];
$mail->AltBody = "This is the plain text contant";
if(!$mail->send())
{
echo "your email id not exit";
}
else
{
echo "
your password has been sent successfully Check your email
"; }
Create Table And Database Using
Database name-Forgate
Table Name- Forgate
-- phpMyAdmin SQL Dump
-- version 4.7.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Apr 09, 2018 at
08:31 AM
-- Server version: 10.1.26-MariaDB
-- PHP Version: 7.1.8
SET SQL_MODE =
"NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT
*/;
/*!40101 SET
@OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET
@OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `forgate`
--
--
--------------------------------------------------------
--
-- Table structure for table
`forgate`
--
CREATE TABLE `forgate` (
`id` int(10) NOT NULL,
`email` varchar(100) NOT NULL,
`pass` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `forgate`
--
ALTER TABLE `forgate`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `forgate`
--
ALTER TABLE `forgate`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT;COMMIT;
/*!40101 SET
CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET
CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET
COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
Ab Aap Database Ke Code Ko Copy Karle Or Jo Apne Database Bnaya Tha Wanha Apko Sql Query Ka Option Show Hoga Wanha Is Code Ko Execute Karwa De Apka Table Atomatic He Create Ho Jayega
Ab Aap Php Phpmyadmin Me Jakar Apna Database Forgate Open Karke Isme Forgate Table Ke Ander Kuch Value Pase Kar De Email Id And Password
Ab Aap
Easily Ise Test Test Kar Sakte Hai
Is pArkar aap Easily apni Website me Login Registration Ke Sath Forgate Pawword ka Option Laga Sakte Ho
Aap Demo Check Kar Sakte Ho
Demo Website Se
Me Umid Karta Hu Ki Apko Mere Ye Post forgot password code in php mysqli
Achi Lagi Hogi Agar Apko Koi Be Problem A Rhe Hai Post Ke Regarding To Aap Comment Me Puch Sakte Ho Me Apki Puri Sahayata Karne Ki Koshish Karunga
Achi Lagi Hogi Agar Apko Koi Be Problem A Rhe Hai Post Ke Regarding To Aap Comment Me Puch Sakte Ho Me Apki Puri Sahayata Karne Ki Koshish Karunga
Thank You Tean Gajabwap Web In Hindi
1 comments:
Click here for commentssir bhut achi post hai me kaffi Time se ise dund raha tha bt ajj mila mujhe ye code
ConversionConversion EmoticonEmoticon