This patch should resolve the issues of both bug 811042
and bug 764947.
It also should be good enough to resolve the potential
DOS with the FIXME comment in the function.
Instead of picking the first and last song id (two
queries) and randomly selecting 'valid' numbers between
them (more queries) it uses one mysql query with an
rand() orderby. With a db of 15000 songs this appears
to be quite fast, so I don't think performance will be
an issue.
There is also a simple fix in this patch that makes
sure that the number of seconds displayed for the song
length is always 2 digits (the leading 0 was missing
-- 2:6 instead of 2:06).
Random song list on index page should show 10 songs
Logged In: YES
user_id=78148
thanks for the patch. I tried it out and it works great for
fixing both issues. I can't remember why I wasn't using
ORDER BY RAND() in the first place and the SQL to limit the
selection to allowed songs.