Mam problem z przypominaniem hasła. Niby jest wszystko ok bo sprawdza czy taki nick i mail istnieje w bazie ale jak już chcę sprawdzić czy e-mail jest przypisany do tego nicku to jak podam jakiś mail ale nie tego samego użytkownika, ale użytkownika innego, ale który istnieje w bazie to dalej wysyła hasło. Co z tym zrobić ? Kod:
<?php
$email= mysql_query ("SELECT user FROM base WHERE user='".trim($_POST['nick'])."'"); $nick= mysql_query ("SELECT email FROM base WHERE email='".trim($_POST['email'])."'"); $chmailnick= mysql_query ("SELECT email,user FROM base WHERE email='".trim($_POST['email'])."' AND user='".trim($_POST['nick'])."'");
if (!empty($_POST['email']) && !empty($_POST['nick'])) {
if ($chemail > 1 && $chnick > 1 && $chemail = $chnick) {
$mail= $_POST['email'];
$password= mysql_query("SELECT password FROM `base` WHERE `email`='".$_POST['email']."'"); $subject= 'Forgotten password';
$message= 'Yo, Your nick is: ' . $nick . 'Password: ' . $password;
$header= 'From: example@example.com';
mail ($mail, $subject, $message, $header);
echo 'Password has been sent :)';
}
else {
if ($chemail < 1) {
echo 'E-mail does not exist in the base';
}
if ($chnick < 1) {
echo 'Nick does not exist in the base'; }
if ($chnick != $chemail) {
echo 'E-mail does not fit to Nick'; }
}
}
else {
echo 'Type all information'; }
?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"> <meta http-equiv="Content-type" content="application/xhtml+xml; charset=iso-8859-2" /> <meta name="Description" content="Something" /> <meta name="Keywords" content="Something" /> <meta name="Author" content="Author " /> <link rel="Stylesheet" href="style.css" type="text/css" />
<form action="remind.php" method="post"> E-mail:
<input type="text" name="email" />Nick:
<input type="text" name="nick" /><input type="submit" value="Send" />