262 COMMENTS

  1. HELLO, IT’S A HUMBLE REQUEST

    Please tell me how to add profile picture functionality in this Login/SignUp…

    Please, Please, and Please

  2. i did solve the error u just need to use phpmailer instead of ()mail

    u need to install php mailer in your vs code
    first open your terminal in vs code and paste this composer require phpmailer/phpmailer
    then it will be success.
    second modify the controllerUserData.php “if user signup button” change the old to this

    // Include PHPMailer
    use PHPMailer\PHPMailer\PHPMailer;
    use PHPMailer\PHPMailer\Exception;

    require ‘C:\xampp\htdocs\Login\vendor\autoload.php’; // If using Composer
    // require ‘path/to/PHPMailer/src/Exception.php’;
    // require ‘path/to/PHPMailer/src/PHPMailer.php’;
    // require ‘path/to/PHPMailer/src/SMTP.php’; // If not using Composer

    //if user signup button
    if(isset($_POST[‘signup’])){
    $name = mysqli_real_escape_string($con, $_POST[‘name’]);
    $email = mysqli_real_escape_string($con, $_POST[’email’]);
    $password = mysqli_real_escape_string($con, $_POST[‘password’]);
    $cpassword = mysqli_real_escape_string($con, $_POST[‘cpassword’]);

    if($password !== $cpassword){
    $errors[‘password’] = “Confirm password not matched!”;
    }

    $email_check = “SELECT * FROM usertable WHERE email = ‘$email’”;
    $res = mysqli_query($con, $email_check);

    if(mysqli_num_rows($res) > 0){
    $errors[’email’] = “Email that you have entered is already exist!”;
    }

    if(count($errors) === 0){
    $encpass = password_hash($password, PASSWORD_BCRYPT);
    $code = rand(999999, 111111);
    $status = “notverified”;

    $insert_data = “INSERT INTO usertable (name, email, password, code, status)
    values(‘$name’, ‘$email’, ‘$encpass’, ‘$code’, ‘$status’)”;

    $data_check = mysqli_query($con, $insert_data);

    if($data_check){
    $mail = new PHPMailer(true);

    try {
    //Server settings
    $mail->isSMTP();
    $mail->Host = ‘smtp.gmail.com’; // Set the SMTP server to send through
    $mail->SMTPAuth = true;
    $mail->Username = ‘your_email_address’; // SMTP username
    $mail->Password = ‘your app password’; // SMTP password
    $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; // Enable TLS encryption
    $mail->Port = 587; // TCP port to connect to

    //Recipients
    $mail->setFrom(‘your_email_address’, ‘Mailer’);
    $mail->addAddress($email); // Add a recipient

    // Content
    $mail->isHTML(true);
    $mail->Subject = ‘Email Verification Code’;
    $mail->Body = “Your verification code is $code”;

    $mail->send();

    $info = “We’ve sent a verification code to your email – $email”;
    $_SESSION[‘info’] = $info;
    $_SESSION[’email’] = $email;
    $_SESSION[‘password’] = $password;
    header(‘location: user-otp.php’);
    exit();
    } catch (Exception $e) {
    $errors[‘otp-error’] = “Message could not be sent. Mailer Error: {$mail->ErrorInfo}”;
    }
    } else {
    $errors[‘db-error’] = “Failed while inserting data into database!”;
    }
    }
    }

    third rename this path to your path.
    require ‘C:\xampp\htdocs\Login\vendor\autoload.php’; // If using Composer

    fourth to get the app password you must go to google user accounts then find the security>on f2A authentication>search app password>create app>paste the password no space. $mail->Password = ‘your app password’; // SMTP password

    fifth do not use this link https://www.codingnepalweb.com/configure-xampp-to-send-mail-from-localhost/ because i tried to work on this and its showing error and the only solution is to use the phpmailer.

  3. ?php require_once “controllerUserData.php”; ?>

    THIS WORK?~

    IS this correct for the other pages I want to control access to?

  4. How to Set Google ReCaptcha In Your Login & Signup Form with Email Verification using PHP and MySQL PHP.

    Please Help Sir.

  5. Hey there CodingNepal, this is awesome! But I have a problem. I keep on getting errors even though I started both Apache and MySQL on xampp and I made the userform table and imported the file. Could you do a video on making this whole login and signup system? It would be great help. Thanks.

  6. I have successfully configured the files and the smtp settings in xampp. Now it says the verification code has been sent to the email but no verification code is received? Can you please help me out here

  7. Please how can I password protect the user profile settings page after login, where the user have to enter their registered password only, without username or email to gain Access

  8. You are the best @CodingNepal.. Thank you for this wonderful blog and for releasing your source code…. Much love from Nigeria

  9. Hello,
    Everything works perfectly with Mysql and my web server. I was able to customize the colors and translated into French all the pages. On the other hand, when I try to translate “notverified” and “verified” by “non” and “oui” in the file “controllerUserData.php”, the email sends me the verification code and after having added it and weighed on the button, it still asks me for the code and I can not go further in the operation.
    Can you help me?
    Thank you for this wonderful system.
    From Québec, Canada

  10. Create Video on creating database for this project

    Because when i click on sign up button it says – Failed while inserting your data into database

    Please…

  11. Hi Bro Impressive Work, I have used these scripts for a long time and it working on a local and live servers with a little tweak.

    Can you add csrf protection in the next version and when will your next versin be out?

  12. Hi I downloaded your project it works good. However I tried changing around stuff on the css page like background color and stuff but when I save and reload the content doesn’t change on the html page. Do you know why ?

  13. helloo bro
    you have a wondeful project but i have tried to use it on one of my html website but it gives me error pls can you just write to me how to do that or integrate if its possible please i am pleading in the name of God please”’thanks…

  14. Why it doesn’t send a OTP in my email address but the code is available in the server and if i use the test.php file it can send the message “Hi, there…This is a test email send from Localhost.” to the email. Is the controllerUserData.php code has the problem?

  15. Always when I used to search any coding at last I used to put coding Nepal because here everything is like beautiful and I like this website one day I will make a video about this but this website will be treasure to you and me at finally with fun I really enjoy it with myself you also search anything by here defiantly you can gain an understanding mode hope this enjoyment is great

  16. Hi bro codingnepal I saw your video but I have confused because I saw two different videos of sending email messages and they’re 1:mail ()function
    2:smtp,
    So what are the difference between these two methods

  17. Can i use this codes on my website? i will give credits at the bottom.
    I will style these forms as much as i can just i need the php codes for i know a bit php but not so much advanced php and i was looking for sth just like this

  18. Thanks a lot for the source code sir, everything is working properly but only one thing is showing error , and that is “forget password” option.
    in that after entering the email ,when i click on “continue” it shows error .
    The requested URL was not found on this server.

    Apache/2.4.48 (Win64) OpenSSL/1.1.1k PHP/8.0.9 Server at localhost Port 80

    can you plz help me in solving that ?
    rest of the files are perfect

  19. Hello
    first of all i will like to appreciate your work. You are doing a great and awesome job. Thank you.
    Now my question: How can remove the otp verification option form the form?

  20. Could you please show about phpmyadmin setup for this form? Like how to place otp and verification status from phpmyadmin

    • Please, read the blog properly. You don’t need to set up or create a database for this login form. I already provided a SQL file that creates a required table, columns.

  21. hey codingNepal pls tell like if i add this page i want that after all these steps my original website opens…how to do that?

  22. your code works fine on localhost, but on live server it was showing error on signup “failed while inserting data in database”. i am using namecheap hosting where creating new database will save db name as “diamqpuj_userform” and not how i want “userform” and it saves username like that as well. i did change my connection file with db name as “diamqpuj_userform” same with username as well but still it is showing error don’t know why.

    • I’m really sorry for this but please make sure ads are showing on this site because your browser may have blocked the ads.

  23. Hii please help me I am student and I am learning it.

    Querry: When I sign-up in this it’s show unable to send data into database and too many errors I am unable so solve it please help me. and Make Video on how to create My SQL database and connect database to this login, sign-up system please reply me. and make video I am waiting for you.

    • Maybe, your config file database name is not matched with your database. Please read the blog for it.

  24. if yes please let me know the configuration, if no then what steps i need to follow , as i don’t have xampp if you need me to install it i will do it or any other solution except installation please provide i am waiting

  25. is there anyway to configure it to wampp server please let me know i love your coding tutorials please solve my problem

    • Hello, I’m really sorry because I haven’t used wamp so please install xampp and follow the steps for this login form.

  26. You guys are the best pls is there any tutorial on how to create a login form/registration form that when the user enters a specific code it registers the user and will lead the user to a page where he can save files and get those files back pls help me out am a new developer and finding it difficult

  27. I did was change my email in the controllerUserData.php and configure xampp settings, still getting the error alert: Failed while sending code!

  28. hi what does this mean?

    Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:wamp64wwwportalcontrollerUserData.php on line 33

  29. Hi Coding Nepal, all your codes works so well! and it has helped along the way! But now Is there to make this like a membership system. I need your help on that.

  30. Can you please make these scripts with PDO (prepared elements)? I'm using this for my school project, and my host needs scripts with PDO.
    Thanks! Your code helped, but I'm afraid that I need to ask this little favor of yours again.

  31. Hey Bro! Nice Work!
    I want to ask that can we connect this to html site?
    Like After Complete signing up, redirect to html site? Is It Possible Or We Need PHP Site?
    please reply.
    BTW THANKS FOR AWESOME STUFF

  32. works perfectly. but still didn't recieve any mail. xampp is configured and all but i still didn't receive the code in my gmail. followed other's suggestion like enabling IMAP in gmail setting and less secure. still didn't recieve the code. any suggestions?

  33. You have to verify or compare user password with SHA because your DB passwords are encrypted and when user try to login, his/her password is in plain text so you've to compare it with SHA. I recommended do not use SHA. It can decrypt easily. Use password_hash.

  34. Hi, SUPER TY. All work fine. Can you help me with this?, Im trying put this function for encrypt the password.

    function l2j_encrypt($password){
    return base64_encode(pack("H*", sha1(utf8_encode($password))));

    I encrypt the password in (signup-user.php / new-password.php). But, I can't use the password with this encrypt here (login-user.php). TY again <3, im wait for your answer.

  35. Warning: mail(): Failed to connect to mailserver at "localhost:8080" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:xampphtdocsTDM202grcontrollerUserData.php on line 33

  36. Warning: mail(): Failed to connect to mailserver at "localhost:8080" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:xampphtdocsTDM202grcontrollerUserData.php on line 118

  37. Hi, I have been getting this errors this errors frequently "Failed while inserting data into database!"

    I think The problem is from the data_check, I have tried selecting before inserting, but unto no avail, kindly help check the code again. Thanks

  38. Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:XAMPP1htdocsloginformcontrollerUserData.php on line 33
    Signup Form

  39. My browser is taking forever to download the source code. Infact, it is just showing "The file will start downloading in 30 seconds time", but nothing happens after the said 30 seconds.

    Another thing, do you have a tutorial on how to auto arrange popular Posts using post hits/visits, and configuring social media sharing buttons

  40. Warning: mail(): SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. 22sm22663187pfn.190 – gsmtp in C:xampphtdocsLogin and Signup Form with Email Verification – PHPcontrollerUserData.php on line 33

    what should i do sir. please help

  41. Nice Job! But I have a problem it says "Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:xampphtdocscontrollerUserData.php on line 33" My code is the same as yours |Failed while sending code!" Can you help me?

  42. Hii,
    i have one error when i register new account it shows

    "Failed while inserting data into database!"
    i had check my database name but its correct so where is problem.
    please help me to solve this error

  43. Failed while sending code!
    I was trying to implement it in my hosting .But I am getting this error. But data perfectly saved in database,since I changed few necessary changes to connect with my hosting databases.Now my question is why I am facing this error?
    please help me and thanks a lot for this great tutorial.

  44. Create a php file inside the HTDOCS folder with .php extension and paste the following codes in this file then put the receiver email and sender email address in the mentioned fields.

  45. Warning: mail(): SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. 78sm5550625pfz.211 – gsmtp in C:xampphtdocsLogin and Signup Form with Email Verification – PHPcontrollerUserData.php on line 33 (Failed while sending code)

    where the last php file should be save and with which name plz specify.

  46. good job
    What is the step to take after downloading the files and programming Xampp ? Where should I place my php file in " How to configure XAMPP to send Mail from Localhost in PHP ?"

    • even i had the problem with this then i figured out that you’ve got to create the database first by importing the sql file then this error will disappear inshallah.

LEAVE A REPLY

Please enter your comment!
Please enter your name here