Location: PHPKode > projects > l2jweb > change_passwd.php
<?
function crypt_p($pass)
{
    return base64_encode(pack('H*', sha1(utf8_encode($pass))));
}
if (@$_GET['post'] == true)
{
    if ($_POST['passwd'] != $_POST['passwd2'])
    {
        $smarty->assign('CHANGEPASSWDMSG', 'The new passwords doesn\'t match');
        $content = $smarty->fetch('change_passwd.tpl');
    } else
    {
        $sql = 'CALL change_passwd("' . $_SESSION['admin'] . '","' . crypt_p($_POST['old_passwd']) .
            '", "' . crypt_p($_POST['passwd']) . '");';
        $sql_id = $db->query($sql);
        if ($db->affected_rows($sql_id) != 0)
        {
            $content = 'Password updated successfully!';
        } else
        {
            $content = 'There was an error. Please contact our team if you encounter this issue more then once.';
        }

    }
} else
    $content = $smarty->fetch('change_passwd.tpl');
?>
Return current item: l2jweb