[campsite-dev] Question for Mugur
  • Vote Up0Vote Down importimport
    Posts: 0Member
    I am modifying the code in User.php and ran across this section of code
    in the function isValidPassword() that was added by Mugur:

    --------------------------------------------------------
    $queryStr = "SELECT Password, OLD_PASSWORD('$userPasswordSQL') AS
    OLDPassword FROM Users "
    . " WHERE Id = '".mysql_real_escape_string($this->getUserId())."' ";
    if (!($row = $g_ado_db->GetRow($queryStr))) {
    return false;
    }
    if ($row['Password'] == $row['OLDPassword']) {
    return true;
    }
    --------------------------------------------------------

    I had never seen the "OLD_PASSWORD()" function before and I looked it up
    and it says its a synonym for the PASSWORD() function. I'm confused by
    this section of code because right above this, the same check is done.
    So why is it done twice?

    - Paul
  • 1 Comment sorted by
  • Nevermind, i figured it out...


    Paul Baranowski wrote:
    > I am modifying the code in User.php and ran across this section of code
    > in the function isValidPassword() that was added by Mugur:
    >
    > --------------------------------------------------------
    > $queryStr = "SELECT Password, OLD_PASSWORD('$userPasswordSQL') AS
    > OLDPassword FROM Users "
    > . " WHERE Id = '".mysql_real_escape_string($this->getUserId())."' ";
    > if (!($row = $g_ado_db->GetRow($queryStr))) {
    > return false;
    > }
    > if ($row['Password'] == $row['OLDPassword']) {
    > return true;
    > }
    > --------------------------------------------------------
    >
    > I had never seen the "OLD_PASSWORD()" function before and I looked it up
    > and it says its a synonym for the PASSWORD() function. I'm confused by
    > this section of code because right above this, the same check is done.
    > So why is it done twice?
    >
    > - Paul
    >
    >