to tylko powiec co pozmieniac

Zapytanie zrobilem od nowa i wykasowalem tabele uzytkownicy pozmienialem w haslo.php i w nowehaslo.php tzn chcialem zrobic przypomnienie hasla z tego skryptu :
http://www.forumweb.pl/porady-i-tutoriale-...nie-hasla,68870Wszystko poszlo okey prawie nawet bledy nie wyskakuja jak chce zmienic hasla to pisze ze jest "Aktualne hasło jest nieprawidłowe" a pisze poprawne haslo.A w przypomnij haslo "Informacje o nowym haśle zostaly wyslane na Twój adres e-mail." i na e-mail nic nie przychodzi a jak wpisze inny email kt nie jest w bazie pisze ze e-mail nie istnieje czyli prawie wszystko okey dam wam teraz pliczki na dol:
Zapytanie.sql
CREATE TABLE `uzytkownicy` (
`ID` int
(8
) NOT
NULL AUTO_INCREMENT PRIMARY
KEY ,`nick` VARCHAR( 50 ) NOT NULL ,
`haslo` VARCHAR( 32 ) NOT NULL ,
`email` VARCHAR( 50 ) NOT NULL ,
`activation_key` TEXT NOT NULL ,
`displayName` varchar(55) NOT NULL ,
`ranga` INT NOT NULL ,
`adverty` TEXT NOT NULL ,
`ip` TEXT NOT NULL ,
`ban` TEXT NOT NULL ,
`kupil` TEXT NOT NULL ,
`data` DATETIME NOT NULL
) ENGINE = MYISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
haslo.php
<?php
$_SESSION["ID"] = "24";
$result = mysql_query("SELECT * from users WHERE ID='" . $_SESSION["ID"] . "'"); if($_POST["currenthaslo"] == $row["haslo"]) {
mysql_query("UPDATE users set haslo='" . $_POST["newhaslo"] . "' WHERE ID='" . $_SESSION["ID"] . "'"); $message = "Hasło zostało zmienione";
} else $message = "Aktualne hasło jest nieprawidłowe";
}
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="styles.css" />
<script>
function validatehaslo() {
var currenthaslo,newhaslo,confirmhaslo,output = true;
currenthaslo = document.frmChange.currenthaslo;
newhaslo = document.frmChange.newhaslo;
confirmhaslo = document.frmChange.confirmhaslo;
if(!currenthaslo.value) {
currenthaslo.focus();
document.getElementById("currenthaslo").innerHTML = "Wymagany";
output = false;
}
else if(!newhaslo.value) {
newhaslo.focus();
document.getElementById("newhaslo").innerHTML = "Wymagany";
output = false;
}
else if(!confirmhaslo.value) {
confirmhaslo.focus();
document.getElementById("confirmhaslo").innerHTML = "Wymagany";
output = false;
}
if(newhaslo.value != confirmhaslo.value) {
newhaslo.value="";
confirmhaslo.value="";
newhaslo.focus();
document.getElementById("confirmhaslo").innerHTML = "Nie Ten sam";
output = false;
else { //Jeśli nie został wciśnięty przycisk wyświetlamy formularz
}
</script>
</head>
<body>
<form name="frmChange" method="post" action="" onSubmit="return validatehaslo()">
<div style="width:500px;">
<div class="message">
<?php if(isset($message)) { echo $message; } ?></div>
<table border="0" cellpadding="10" cellspacing="0" width="500" align="center" class="tblSaveForm">
<tr class="tableheader">
</tr>
<tr>
<td width="40%"><label>Aktualne hasło</label></td>
<td width="60%"><input type="haslo" name="currenthaslo" class="txtField"/><span id="currenthaslo" class="required"></span></td>
</tr>
<tr>
<td><label>Nowe hasło</label></td>
<td><input type="haslo" name="newhaslo" class="txtField"/><span id="newhaslo" class="required"></span></td>
</tr>
<td><label>Potwierdź hasło</label></td>
<td><input type="haslo" name="confirmhaslo" class="txtField"/><span id="confirmhaslo" class="required"></span></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="submit" value="Zmień" class="btnSubmit"></td>
</tr>
</table>
</div>
</form>
</body></html>
nowehaslo.php
<?php
/*
Password recovery v0.2 by DarV from darv.xaa.pl
Released under Creative Commons BY-SA 3.0 license:
*/
require("strony/db.php");
$domena = $_SERVER['HTTP_HOST'];
$skrypt= $_SERVER['SCRIPT_NAME'];
$parametry = $_SERVER['QUERY_STRING'];
$address = $domena . $skrypt. '?' . $parametry;
$headers = 'From: NADAWCA' . "\r\n" .
'Reply-To: NADAWCA' . "\r\n" .
if(isset($_GET['key'])) { }
$checkkey = 'SELECT * FROM uzytkownicy WHERE activation_key="'.$key.'"';
if(!$ck[1]) {
Nieprawidłowe lub używany klucz aktywacyjny.
';
}
}
$checkkey = 'SELECT * FROM uzytkownicy WHERE activation_key="'.$key.'"';
$uzytkownicyemail = $rekord['email'];
$newhash = sha1($new);
$query = "UPDATE uzytkownicy SET password='".$newhash."' WHERE activation_key='".$key."';";
$to = ''.$uzytkownicyemail.'';
$subject = 'Nowe Hasło';
$message = 'Witamy, aktualne hasło: '.$new.'';
mail($to, $subject, $message, $headers); $finish = "UPDATE uzytkownicy SET activation_key='0' WHERE email='".$uzytkownicyemail."';";
echo 'Nowe hasło zostało wysłane na podany adres e-mail.'; }
echo '<form method="post" action="#"> Twój e-mail: <input type="text" name="email"/>
<input type="submit" value="Wyślij hasło"/>';
}
if(isset($email) and
!filter_var
("$email", FILTER_VALIDATE_EMAIL
)) { echo 'Ten adres e-mail jest nieprawidłowy.'; }
$checkemail = mysql_query('SELECT * FROM uzytkownicy WHERE email="'.$email.'"'); if(!$checkemail[1]) {
E-mail nie istnieje';
}
elseif($checkemail[1]) {
$query = "UPDATE uzytkownicy SET activation_key='".$new."' WHERE email='".$email."';";
$to = ''.$email.'';
$subject = 'Nowe hasło';
$message = 'Witam, jeśli chcesz zmienić hasło na: http://'.$address.'key='.$new.'';
mail($to, $subject, $message, $headers) or
die ("Nie można wysyłać wiadomości e-mail"); echo 'Informacje o nowym haśle zostaly wyslane na Twój adres e-mail.'; }
}
?>
PROSZE O POMOC!! Podajcie co mam zmienic/poprawic lub dodac.Bo prawie wszystko jest okey tylko niechce jak juz mowilem wyslac emaila i zmienic hasla.