Email address login new

Here is an example of an email address login form in HTML and CSS:

HTML:

<form action="/login" method="post">
  <label for="email">Email:</label>
  <input type="email" id="email" name="email" required><br><br>
  <label for="password">Password:</label>
  <input type="password" id="password" name="password" required><br><br>
  <input type="submit" value="Login">
</form>

CSS:

form {
  width: 300px;
  margin: 40px auto;
  text-align: center;
}

label {
  display: block;
  margin-bottom: 10px;
}

input[type="email"], input[type="password"] {
  width: 100%;
  height: 40px;
  margin-bottom: 20px;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
}

input[type="submit"] {
  width: 100%;
  height: 40px;
  background-color: #4CAF50;
  color: #fff;
  padding: 10px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

input[type="submit"]:hover {
  background-color: #3e8e41;
}

This is just a basic example, and you will need to add additional functionality to handle the login process, such as validating the email and password, and authenticating the user. You will also need to add a backend script to process the login form submission.

Here is an example of a simple PHP script that handles the login process:

<?php
// Check if the form has been submitted
if ($_SERVER["REQUEST_METHOD"] == "POST") {
  // Get the email and password from the form
  $email = $_POST["email"];
  $password = $_POST["password"];

  // Check if the email and password are valid
  if (filter_var($email, FILTER_VALIDATE_EMAIL) && strlen($password) > 0) {
    // Authenticate the user
    // (This is a very basic example, you should use a more secure method to authenticate users)
    if (authenticateUser($email, $password)) {
      // Login successful, redirect to a secure page
      header("Location: secure.php");
      exit;
    } else {
      // Login failed, display an error message
      echo "Invalid email or password";
    }
  } else {
    // Invalid form data, display an error message
    echo "Invalid form data";
  }
}

// Function to authenticate the user
function authenticateUser($email, $password) {
  // This is a very basic example, you should use a more secure method to authenticate users
  // For example, you could use a database to store user credentials and check if the email and password match
  return true; // Replace with your actual authentication logic
}

This script checks if the form has been submitted, and if so, gets the email and password from the form. It then checks if the email and password are valid, and if so, authenticates the user using a simple function. If the authentication is successful, it redirects the user to a secure page. If the authentication fails, it displays an error message.

Again, this is a very basic example, and you should use a more secure method to authenticate users, such as using a database to store user credentials and checking if the email and password match.