Hello, if any body can help me , why in the code bello the results is always null or 0?
because when i want to change the password it always shows me this message "The current password you entered is not correct!"
<?php
@session_start();
include("./pg_connect/pgdb.class.php");
$db = new PQDatabase();
// Check if current password is correct
$sql = "SELECT * FROM telecom.users WHERE username = '" . $_GET["u"] . "' AND password = '" . md5($_POST['current_pwd']) . "'";
$result = $db->getNumberOfRows($db->query($sql));
if ($result == null || $result == 0)
{
echo "{success: false, msg: 'The current password you entered is not correct!'}";
}
elseif ($_POST['new_pwd'] != $_POST['retype_pwd'])
{
echo "{success: false, msg: 'The new password and the retyped password are not identical!'}";
}
else
{
$db->query ("UPDATE telecom.users SET password = '" . md5($_POST['new_pwd']) . "' WHERE username = '" . $_SESSION["u"] . "'");
echo "{success: true, msg: 'The password was changed successfully!'}";
}
?>