PHP OTP Login Verification Script
ฝัง
- เผยแพร่เมื่อ 7 ก.ย. 2019
- In this video I will explain you about how to implement PHP OTP login verification script in localhost. OTP is an effective way of validating users.
In this script I am using sendgrid SMTP for sending otp emails.
For any queries and clarification feel free to comment.
For Best Hosting Plan Check:- 91weblessons.com/domain_hosting
Learn PHP Online with Me:- bit.ly/LearnPHPOnline
To help and support me(Donate Me):- bit.ly/ProgrammingWithVishalD...
Download source code from here bit.ly/2NCvz2W
#PHPScript #PHPOTP #PHPLogin
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
✅Subscribe: / @programmingwithvishal
I am a Digital Marketer by passion and a Developer by profession. With experience and expertise spanning around 10 years, in the Digital space.
Good amount of experience in development of web applications using PHP, .Net, JavaScript Library’s, Frameworks, CMS, API’s, Reporting tools and Payment Gateways. Skilled in digital viral marketing, technology innovation's, brand building and all phases of the Web development lifecycle with an expert in translating business requirements into technical solutions and fanatical about quality, usability, security, and scalability. Dealing with and resolving problems and issues which arise.
Guys if you are facing issue with Sendgrid SMTP try this GMAIL SMTP. Watch this th-cam.com/video/k7LSk9hOnJk/w-d-xo.html
thankyou so much for such an amazing video,,,,nd sir where r u from
@@ramaaryan9849 his name is vishal Gupta and he from Sarita vihar, Delhi.
@@cashbackloan6618 Now in Noida
Hlo bhai data base me id kaise exit kregi i want my google sheet list gmail ids ki ek database ki tra kaam kre
Bro aapko shortcut Mila kya
Vishal sir you are grate for those students those wants to learn programming thanku so much sir
Thank you sir, your video is very useful for higher, medium and lower students
when i click on submit , response:Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, bool given in C:\xampp\htdocs\ff\send_otp.php on line 6
not_exist, any help, thanks
Thanks a lot , It really helped me , Pls Post more videos on Basics of PHP , Better if subtitle Available , Thanks Once Again
Amazing way of teaching programming. Great👍👍
Thanks a lot
Thanks! It helped for my online old goods selling website project🙂subscribed your channel and liked the video
Glad it helped!
Can you pls once explain me how it worked because I am doing the same project I stucked at this point... it's urgent ...
hi Vishal! i using your code. but i want to comparing the value in database with the value in input when have someone input the otp. if they give input the value is equal with the value in database that's mean they can go next step. how can i set it up? thanks
OTP received in the database but not on the email id and the page is not redirected to the OTP verification page
Sir aap jese teacher ko m kab s search kr rha tha jo mujhe meri language m samjha sake
Sir mene aapka channel subscribe kr liya h m aapke video ko follow or like krta rahunga
thanx for share simple way
Thanks a lot.
after doing all things i'm not getting otp in my email n this showing invalid address : $emailyes ......why? my mail apssword are ri8 then why not working?
Vishal sir please help me I am trying to create a function but my function wasn't work the way I want...example of what I am trying to do example:- I have two basket, In first basket there are 5 mangoes and in second basket there are 10 mangoes. if require mangoes is less than 5 then pick from first basket else if require mangoes are more than 5 then pick 5 from first basket and pick remain mangoes from second basket.i am stuck and dont know how to do please help me or make one video
flutter code me sirf mobile number insert kare or 000webhost (phpmyadmin) pe save ho or OTP wpas mobile number pe aaye....
flutter se mobile number 000webhost pe save ho bhi rhe hai but opt nhi aa rhe hai...
Really it helped me a lot.after completing my task I was like ohh lovely .
Thanks a lot
Once again thanks a lot Neha
Sir , I have tried to run the source code but it's showing in SMTP file I don't know how to fix please guide me .
Please give me solution below mention function is not working. OTP is sent successfully to mysql and mail but hidden box in not viewed.
success:function(result){
if(result == 'yes'){
jQuery('.second_box').show();
jQuery('.first_box').hide();
}
This is 100% working , but i modify as per my way , i used phpmailer instead of send-grid
Can we use username instead of email? And then connect it to the database mail through a php script
Hello sir, i am from tamilnadu.. Can u please a upcoming tutorial in english.. Or subtitle.. It will really helped lot. Thanks from india♥️
He is from Delhi, India, and he is speaking Hindi.
Bro i am also tamil
@@hiheven4656 Bro? I was replying to somebody else who deleted their comment.
@@priyansh5233 ooh okay! really sry bro!!
I am also tamilnadu 💛🥰
No doubt.
You are the best!!
tum bahut badhiya kaam karta hai vishal bhai
SMTP -> ERROR : failed to connect to server: network is unreachable (101)
Called Mail() without being connect.
Kindly help me with this error 🙏 😔
This is great. I received otp to my mail but I strucked with an issue. The page is not redirecting to dashboard.php. What to do sir? I am using xampp. Help me sir
Echo yes not working ... In console it comes with yes as well as all smtp messages
Sir.
Agar mujhe isi code me User ka session create karne k baad main chahte hu ki agar user ki kuch aur bhi detail hamare database me hai wo yaha display ho jae. Wo kaise hoga.
Please help
Aapka videos me advanced script use hone laga hai...
thank you so much sir for this video
Thankyou so much sir
Such a good explanation sir
Thanks a lot Kishor.
Nice sir please make a video on payment gateway and QR code php script
hello sir great video but i have one query in my case otp is generated but it only storing in database i am not getting that otp on mail can u please help
when i click on send otp btn ....i received otp .. but otp text box not showing
Thank you for this
I have uploaded files in local server otp is saved in databse when i press send otp button but its not redirected to check otp button and also mail is also not received
Check your console, I guess there are some error
What we do if the email goes to spam folder ?
Thank you sir.
when i click send otp nothing happen
how to solve that problem
Bro can we send the otp to mobile number as well with this script. Kindly assist
Sir me 4 years bad dekh raha thanks for this mini project. Sir singup kye sath ey wala system kyse bnay gee please bata do please🙏🙏🙏
Account create and login with email opt
Im confuse where is the login_otp this file not found .
Sir why u store email in database, you have to create a video to submit email with OTP
Sir, link given to download is having smtp files only
its sooo easy when yo explain .. !!
Welcome Vineet
Nice and simple presentation
Thank you
Sir email ki jaga nunber se bhi kiya hum otp verify kr sakte h
You are great sir
Sir kya same chij laravel me register login k sath otp generate ksath bata sakte h
Sir, thank you for the php code for otp verification, Kindly help as i am receiving error as Please enter valid email though i have entered a valid email id and saved the same in the database
sir ye code work nhi ker rha ind fill kerne per otp frame nhi a rha
When I click on send otp, second box don't open and get error in my console saying - uncheck runtime.lastError: The message port closed before a response was received.
Please sent me screenshot. My email id phpvishal@gmail.com
@@ProgrammingwithVishal yes sir facing the same error but i have no errors.but the second box doesnt get redirected
Ek video Otp with time expiry with resend feature par banaiye
Similar bank Ka Otp page jaisa
Please
In smpt.sendgrit.net what should i write
Sir appne action= "confirmation. File ka code show nahi kiya
Hello sir.. It's really very helpful video but I have a question may I ask it individual??
Thanks and Email me at phpvishal@gmail.com
excellent explanation
Thanks a lot
Thanks for great video tutorial, there's one thing that I want to know, how to do so when we verify OTP, in database the column otp is still being his verified OTP, now it's disappearing when we verify the OTP, and do we got the method how to add one extra column named like "is_verified" with values "Yes/No". Please could you help me with it!
For this create a separate field "is_verified" in table. Once you generated OTP insert "No" in is_verified and after OTP verify update that is_verified to "Yes"
@@ProgrammingwithVishal and what about default disappearing otp when someone is verify it. I followed what happening when we are sending otp to user and understand that it appears in database when otp is generated but when we verify this otp is disappearing. How to change it?
That is because in check_otp.php line number 9, after OTP verification I am updating otp to blank.
@@ProgrammingwithVishal thanks it works!! Can you tell how to do is verified more details, if you will have a free time please, more code information))) please)
@@sardorjs3647 Steps -
1. Create a row "is_verified" in your table.
2. Now after checking if the email exists in the database just insert "No" in that table along with the generated OTP before sending email.
3. Now when the user enters correct OTP, update the value of "is_verified" to "Yes".
Thanks
Sir, I have a query related to logout.php.... can I use season_destroy(); then use the header to the index location?
session_destroy() jitna bhi session hoga sab khatam Kar dega. Now assume ki apke user and admin dono ka login Kiya hai, now session_destroy() admin and user dono ka session khatam Kar dega.
@@ProgrammingwithVishal thanks for a brief explanation sir, now I understand the limitation of season_destroy()in this problem.
I am on (Xampp) Localhost. How can I send emails from there?
php mailer
Smtp error 535 authentication failed
Plz help
Sir whatsapp server pr Maine change no to change no kai bar kiya fir time 24 hours hogaya to kiya server wale dekhe sakte h esa agar maine bar bar kiya
Samjha nahi main aap kya boal rahe wo. Apne comment email otp ke post pe kiya hai or aap whatsapp ki baat kar rahe ho
great sir
Sir I think you don't need to store OTP. You just set on session and verify. It will be more secure.
Session can be hacked via cookii
Sir can you please upload a video where user can put his all information and then that information gets stored in database and form the same database email id should be verifies
It's pretty simple. Use below link for insert data into table.
th-cam.com/video/_Xur7dkDMMc/w-d-xo.html
thank you sir
Welcome Akshay
Great sir
Sir I am facing problem when I click on SEND OTP button switch nahi ho raha hai can you please help me
Sir please reply me
Phone number based otp verifocation kese kre sir
Is pr b pls bnaiye ik video
@programming with Vishal sir make a video on how to send OTP on phone number ... please🙏🙏🙏
Noted.
when I press the send otp button its not working..please help
Check your Console. Have you changed the api details?
hi Vishal,
make a video about otp verification using mobile number in the web page verification.
Sure Avinash. But you can do that by yourself also. Just replace mail send coding to sms send coding. For SMS please follow my below video th-cam.com/video/kDEyqRFS0Z8/w-d-xo.html
Why this code is not working in live server??
Go to console and check error. May be openssl is not enable on your server
Hi, Thanks for uploading such great code. Can I have a database file so that I can import?
Thanks a lot Yogesh. Below is the link to download the source code and db file.
bit.ly/PHPOTPLoginVerificationScript
Great Sir but please mobile pe otp send karo then verify ek video ispe bi bna do
Sure will do in next video
@@ProgrammingwithVishal sir abhi tak aap nai ye video uplod nahi ki
not working bro when i click login nothing is happening
Because you are doing something wrong, check your browser console.
@@ProgrammingwithVishal same problem sir please help
@@techpatel18 Check console. Or email me at phpvishal@gmail.com
thank u sir for this course
sir i have a question
agar hum kisi registered aadmi ko otp vejna chahenge tow uske liye hume tow us admi ki mail ka password nehi pata hoga , and agar multiple people ko vejna chahenge then function me username and password pe kya change hoga
Please check th-cam.com/video/U8wyK_A66yY/w-d-xo.html
@@ProgrammingwithVishal okk sir , thank u
Sir mene iska code kiya or run bhi kiya lekin me jab email likhle send button pe click karta hoo to user ke table me otp to add ho jata he lekin user ko send nahi ho raha he pleas sir iska solutions bataye
Yaha pe humne sendgrid ka use kiya hai OTP ke liye, Sendgrid ne kuch changes kiye hai, Sendgrid ki jagha aap GMAIL SMTP use karo. Please follow th-cam.com/video/k7LSk9hOnJk/w-d-xo.html
Sir, this method is great but can you provide any alternative in which we don't have to store the OTP in database and we can just check it in the script??
Yes, store OTP in session then
@@ProgrammingwithVishal that's quite better than storing in database. Thanks a lot 😊👍!
@@rks1509 anyone can just get the otp without having to go to their email inbox, they can just see the cookies stored on the browser/local machine.
@@priyansh5233 yeah, you're right, I don't know what I was thinking about when this thought came into my mind, but yeah, not every user knows that we are using session variable to store it.. but yeah, u are right
Sir aap pls apna code editor change kr lijiye sar dukhta hai dekh ke
Sir can please send me data base file please I this that giving me error on 000webhost 🙏🙏🙏🙏
Download from below link bit.ly/2NCvz2W
greate tutorial sir
sample project make sir How to track user over LAN connectionin php
Here is solution.
th-cam.com/video/FN0t1IYYxvY/w-d-xo.html
Can you please do this same email otp in laravel
Sir after giving email address otp was generated in database but after it not going to second box for submitting otp
At 17:39 in your video u also got same problem. What I have to do sir
any solution to this???
Nice sir
सर इस तरह हम forgot password बना सकते है क्या
Sure will do shortly.
I follow the steps but getting error
Password not accepted from.server 535 authentication failed bad username and password
Error reet failed
Please reply
Nidhi, it's clearly showing your are using wrong username and password here. Also instead of SendGrid try gmail SMTP th-cam.com/video/k7LSk9hOnJk/w-d-xo.html
Thank you its work with gmail now but not with sendgrid . However when i send the otp to email id it send to my account and also updated in my database but it wont show the submit otp box after clicking the send otp button why these happening although i used your code but only part its not working is send otp box is not appear where i can put my otp code. Please can you kindly let me know for not working properly. Thank you once again.
May be you are getting space in response. Just use
result=result.trim();
after success:function(result){
yes i did the way you said but doesn't have any changed still same problem no display.
th-cam.com/video/12ryCL12Vr8/w-d-xo.html
aapne database ka name user daala or connection youtube se bnaya ??
Database ka naam TH-cam hai and table ka naam user hai
Thank you for the good information.
I've done the same thing, but there's no response when I press the "send otp" button. What's the reason?
Is there any error or response you are getting?
@@ProgrammingwithVishal
If I press F12 button on web page to check the network part,
"SMTP -> ERROR: Password not accepted from server: 535 Authentication failed: Bad username / password
SMTP -> ERROR: RSET failed:
SMTP -> NOTICE: EOF feeling checking if following the following from address failed: vishalphpyt@gmail.com : Called Mail() without being connected yes"
The error will be confirmed.
Recheck your configuration setting. Also change vishalphpyt@gmail.com to your sendgrid email id
@@ProgrammingwithVishal I modified the smtp_mailer() in the send_otp file to the id and password of my Google email. Is this the right way to do it?
There is still no response when the "send otp" button is pressed.
(When I enter an email that is not in the database, "Please enter valid email" is shown.)
An error occurs with the same content as before.
In the PHPOTPLoginVerificationScript\smtp\mailer file,
Do I have to modify the $mail->Username, $mail->Password, $mail->SetFrom part just like the smtp_mailer() in Sent_otp?
Use sendgrid account details instead of Gmail account details as per the tutorial
query for latest timestamp and a given condition? Please help
Sorry not getting you.
This is not working sir, in send_otp it is showing undefined email variable , plz reply sir i am stuck in it for 2 days🙏🏻🙏🏻
You are doing something wrong. Give me your PC access via anydesk or teamViewer
@@ProgrammingwithVishal okay sir
wow best video
Thanks Pritam
sir send otp pe cklick karne ke bad submit otp ki field nahi ati otp enter karne ke liye please give me a solution
Check console
gmail me agar double verificatio rahega toh mail nahi jayyega kya ? Bad Username
Yes, 2 step verification enable hoga toh SMTP work nahi karega
@@ProgrammingwithVishal Thanks
Sir polite request please tell him how to connect with SMTP server
Check
th-cam.com/play/PLWCLxMult9xfY_dsYicKGcCLhlZ6YXFMh.html
Bhaiya submit otp button or click krne se wo next page ko nhi jaa raha h . please help
submit se success result aane ke baad, javascript se redirect kar lo
Bhaiya I need help
Hello sir
Sir how send otp in mobile number
I can't connect my database please help me
This is error log occurred [24-Nov-2020 09:47:00 UTC] PHP Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: NO) in /home1/sangawl6/public_html/send_otp.php on line 3
[24-Nov-2020 09:47:00 UTC] PHP Warning: mysqli_query() expects parameter 1 to be mysqli, bool given in /home1/sangawl6/public_html/send_otp.php on line 5
[24-Nov-2020 09:47:00 UTC] PHP Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given in /home1/sangawl6/public_html/send_otp.php on line 6
Fatal error: Uncaught phpmailerException: Invalid address:
This error came when I hosted in go daddy
Yaha pe humne sendgrid ka use kiya hai OTP ke liye, Sendgrid ne kuch changes kiye hai, Sendgrid ki jagha aap GMAIL SMTP use karo. Please follow th-cam.com/video/k7LSk9hOnJk/w-d-xo.html
:Undefined index: email in C:\xampp\htdocs\otp\send_otp.php on line 4
not_exist
Kindly Help me