SQL question

Herminio Hernandez, Jr. herminio.hernandezjr at gmail.com
Mon Mar 6 20:38:32 MST 2017


Here is the string I am using 'UPDATE virtual_users SET
password=ENCRYPT(%p,concat('$6$',substring(sha(rand()),-16))), WHERE
email=%u LIMIT 1';

However, now roundcube is crashing and I am seeing this error

[06-Mar-2017 22:30:32 America/New_York] PHP Parse error:  syntax error,
unexpected '$' in
/var/www/roundcube/roundcubemail-1.2.1/plugins/password/config.inc.php on
line 106

Not sure what I am missing....



On Mon, Mar 6, 2017 at 5:27 PM, Matt Graham <mhgraham at crow202.org> wrote:

> On Mon, Mar 6, 2017 at 9:20 AM, Matt Graham <mhgraham at crow202.org> wrote:
>>
>>> I think this isn't quite right, because the salt has to end
>>> with a $ according to the man page for crypt.  I think you
>>> want CONCAT('$6$', SUBSTRING(SHA(RAND()), -16),'$')) but
>>>
>> On 2017-03-06 10:07, Herminio Hernandez, Jr. wrote:
>
>> I was following the tutorial the digital had. I am not a mysql expert
>> so you could be right.
>>
>
> Actually trying this with a recent mysql shows that "select
> encrypt('string','$6$d6066e43fb301519$');" and "select
> encrypt('string','$6$d6066e43fb301519');" return the same results.  So
> unlike the man page for crypt(), mysql adds the missing final $ for you. Or
> the crypt() function doesn't actually care.  So you're probably fine and
> it'll all work.
>
>
> --
> Crow202 Blog: http://crow202.org/wordpress
> There is no Darkness in Eternity
> But only Light too dim for us to see.
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.phxlinux.org
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.phxlinux.org/pipermail/plug-discuss/attachments/20170306/2e872b8c/attachment.html>


More information about the PLUG-discuss mailing list