Hallo peppeto, thanks for your post. I'm an absolute beginner, I'm flight attendant and have created a homepage for my colleagues.
I want to restrict my homepage to flight attendants only, everyone has a company email address ( firstname.lastname@swiss.com) Some of them forget username and password, they can request this login informations by entering their email address @swiss.com. The script echo with a email with login infos.
How do I integrate the email validation and where on my script below?
I think the email validation should look something like this:
//validate the email address
$email = "first_name.last_name@swiss.com";
and than if ($email_user == $email){
}
And here my script:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>password_request</title>
</head>
<body>
<?php // Script 5.2 - password_request.php
// Address error handing.
ini_set ('display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);
// In case register_globals is disabled.
$first_name = $POST['first_name'];
$last_name = $POST['last_name'];
$posting = $_POST['posting'];
// Create a name variable.
$name = $first_name;
// Print the message.
print "Thank you, <font color=\"red\">$name,</font> for your request. Check your inbox at crewmail for username and password.<br />
<p>$posting</p>";
// Send the email.
$body = "Thank you for visiting www.mydomain.info! Login: username=x, password=y";
mail ($_POST['email'], 'username=x, password=y', $body, "From: [email]paolo.portmann@swiss.com\r\nBcc:cspm@tele2.ch[/email]");
?>
</body>
</html>