|
Posted by Tyrone Slothrop on 07/13/05 17:21
On Wed, 13 Jul 2005 07:42:33 +0000 (UTC), "sentinel"
<postmaster@elma.hr> wrote:
>where could be the problem?
>
>thakns.
>
>Tom
I could not find the problem in all of that code. Try something
simpler:
<?php
function updatePassword ()
{
if (md5 ($_POST['nova1'];) != md5 ($_POST['nova2'])) {
return ("Nova lozinka nije dobro ponovljena.);
}
$dbh = mysql_connect($hostname, $username, $password) or die("Unable
to connect to MySQL");
$selected = mysql_select_db("interni",$dbh) or die("Could not select
interni");
$rs = mysql_query("SELECT * FROM users where id='{$_GET['ui']}' AND
password=\"".md5($_POST['stara'])."\"");
if (mysql_num_rows($rs) < 1) {
return("Greka prilikom unosa izmjenjene lozinke u bazu.");
}
mysql_query ("UPDATE users SET password='".md5($_POST['nova1']."'
WHERE id='{$_GET['ui']}'";);
if (mysql_affected_rows () == 1) {
return ("Stara lozinka nije toèna.");
}
return ("Lozinka nije uspjeno promjenjena.");
}
?>
<font face="Trebuchet MS"><?=updatePassword()?></font>
<?mysql_close()?>
Why reassign variables and make all of those queries when and if..then
statements? This should work.
Navigation:
[Reply to this message]
|