Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8032911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:32:05+00:00 2026-06-05T01:32:05+00:00

I want to code a login script where a user enters the email id

  • 0

I want to code a login script where a user enters the email id and password and is taken to another page if both email and password are correct.
Also if the email and password are correct; the values get stored in DB.

Here’s the entire corrected-working-code:

    <?php
    if($_POST['submit']){
        $email = protect($_POST['email']);
        $password = protect($_POST['password']);
        $md5password=MD5($password);

        if(!$email || !$password){
            echo '<span style="color: red;" /><center>You need to fill in your <b>User Name</b> and <b>Password</b>!</center></span>';
        }else{
            $res = mysql_query("SELECT * FROM `employer` WHERE `email` = '".$email."'");
            $num = mysql_num_rows($res);

            if($num == 0){
                echo '<span style="color: red;" /><center>The <b>E Mail ID</b> you supplied does not exist!</center></span>';
            }else{
            $res = mysql_query("SELECT * FROM `employer` WHERE `email` = '".$email."' AND `password` = '".$md5password."'");
            $num = mysql_num_rows($res);

            if($num == 0){
                echo '<span style="color: red;" /><center>The <b>Password</b> you supplied does not match the one for that E Mail ID!</center></span>';}else{
                $row = mysql_fetch_assoc($res);

                $_SESSION['uid'] = $row['id'];
                echo "<center>You have successfully logged in!</center>";

                $time = date('U')+50;
                mysql_query("UPDATE `employer` SET `online` = '".$time."' WHERE `id` = '".$_SESSION['uid']."'");
                mysql_query("UPDATE employer (date) VALUES (NOW())");

                header('Location: loggedin_employer.php');
                }
            }
        }
    }
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T01:32:07+00:00Added an answer on June 5, 2026 at 1:32 am

    There’s a tutorial here and several dozen other places.

    But before you view that tutorial, check out the OWASP Authentication cheat sheet.

    Too many people build insecure systems. Don’t be one of those guys. OWASP is an excellent resource that all web developers should be intimately familiar with.

    And while you’re at it, you might want to consider Jeff Atwood’s excellent advice.

    Excerpt from Jeff’s article:

    It always pained me greatly that every rinky-dink website on the
    entire internet demanded that I create a special username and password
    just for them. Yes, if you’re an alpha geek, then you probably use a
    combination of special software and USB key from your utility belt to
    generate secure usernames and passwords for the dozens of websites you
    frequent. But for the vast, silent majority of normals, who know
    nothing of security but desire convenience above all, this means one
    thing: using the same username and password over and over. And it’s
    probably a simple password, too.

    Jeff also has another nice article on OpenId worth reading before embarking on your quest.

    And finally, and probably most importantly, Don’t Store Your Passwords Incorrectly! Given that most people use the same username/password everywhere, if YOUR site gets compromised, then ALL of their accounts could potentially be compromised.

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want user to provide login + password to login to my webapp. If
I want to use the following code to login to a website which returns
i want code to check whether the user in logged in or not. I
when user changes password I want to show message Successfully changed! and when user
I already have written a login and register script. The user can login to
Hey all, I am creating a login script that in one step, enters the
I am facing a problem in my login script written in powershell. I want
I have a login python script in which i want to take the username
I want code to run whenever I create a new object. For example, see
I want code for keeping 1 second delay in Flex. i.e. i want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.