# |
Jun 26th 2019, 09:43 |
challgren |
Sometimes I hate kotlin and need to come back to php for a while |
# |
Jun 26th 2019, 09:43 |
challgren |
Ah Im coding trying to finish up the android app Im working on |
# |
Jun 26th 2019, 09:43 |
neon1024 |
Dude, go to bed. |
# |
Jun 26th 2019, 09:42 |
neon1024 |
But why? |
# |
Jun 26th 2019, 09:42 |
neon1024 |
:O |
# |
Jun 26th 2019, 09:42 |
challgren |
Its 4:45am |
# |
Jun 26th 2019, 09:42 |
neon1024 |
Use the Maths Luke. |
# |
Jun 26th 2019, 09:42 |
neon1024 |
About? |
# |
Jun 26th 2019, 09:41 |
challgren |
But the 10 digit length there’s about 10,000,000,000 possible combinations |
# |
Jun 26th 2019, 09:39 |
neon1024 |
As would having a fixed number of digits |
# |
Jun 26th 2019, 09:39 |
neon1024 |
Also, surely limiting to numeric would also limit not only the number of codes which can be generated, but also increase the chance of collision |
# |
Jun 26th 2019, 09:38 |
neon1024 |
Would probably want a `while` condition here |
# |
Jun 26th 2019, 09:38 |
challgren |
Again tweak that to yours, I know its not 100% functional as written above |
# |
Jun 26th 2019, 09:37 |
chan |
@challgren @dereuromark @saithitlwin thanks you so much. i will try again. |
# |
Jun 26th 2019, 09:36 |
challgren |
Written quickly but theres the idea |
# |
Jun 26th 2019, 09:36 |
slackebot |
<challgren> |
# |
Jun 26th 2019, 09:34 |
saithitlwin |
@dereuromark can we define character set in uuid? I think it cann't. |
# |
Jun 26th 2019, 09:34 |
dereuromark |
this is also how my Slug behavior works :slightly_smiling_face: |
# |
Jun 26th 2019, 09:33 |
challgren |
@chan create a function that first generates a random result, then check your database for the result if it returns 0 results the random is good to use if it returns a result then try again and do the same check |
# |
Jun 26th 2019, 09:33 |
dereuromark |
then use UUIDs^^ |
# |
Jun 26th 2019, 09:32 |
chan |
@challgren @dereuromark thanks for your advices. but i don't want to use `rand() and mt_rand`. because of these methods can cause duplicate. |
# |
Jun 26th 2019, 09:31 |
challgren |
Use mt_rand() my random code was written so long ago so Im firing from the hip here |
# |
Jun 26th 2019, 09:30 |
dereuromark |
most use mt_rand() etc |
# |
Jun 26th 2019, 09:29 |
challgren |
Its simple you can add a recursive call to check the db for the rand result and if its in use try again |
# |
Jun 26th 2019, 09:28 |
challgren |
ANd the current epoch is 1 digits exact and would be hard to have duplicate serial numbers |
# |
Jun 26th 2019, 09:28 |
saithitlwin |
@challgren is rand() good? because rand() can generate duplicate code. |
# |
Jun 26th 2019, 09:27 |
challgren |
why not something simple as `rand(1000000000, 9999999999);` |
# |
Jun 26th 2019, 09:26 |
chan |
@challgren length exactly 10 |
# |
Jun 26th 2019, 09:25 |
challgren |
Min length? max length? |
# |
Jun 26th 2019, 09:25 |
chan |
@challgren numeric |
# |
Jun 26th 2019, 09:24 |
challgren |
Numeric or alpha? |
# |
Jun 26th 2019, 09:24 |
chan |
@saithitlwin yes |
# |
Jun 26th 2019, 09:23 |
saithitlwin |
@chan Do you mean code generator to use as serial number? |
# |
Jun 26th 2019, 09:02 |
challgren |
Pretty much unmanaged since November of last year. So no updates or anything like that were done, which is why I'm leaning towards exim |
# |
Jun 26th 2019, 09:01 |
challgren |
It's a cPanel server |
# |
Jun 26th 2019, 09:00 |
challgren |
The hosting provider restored the backup and did some fixes. |
# |
Jun 26th 2019, 09:00 |
challgren |
Nope I don't work for them anymore. And I heard about it from a former coworker |
# |
Jun 26th 2019, 08:59 |
kgb.acct.personal |
Uhm. No logs? Trace? |
# |
Jun 26th 2019, 08:59 |
challgren |
But the site that did get hacked has pissed off a lot of people so it could have been any entry method |
# |
Jun 26th 2019, 08:57 |
challgren |
Hmmmm, it's pretty locked down and I used the proper sanitization. IDK I didn't get the full details other than all the passwords didn't work and the failure message was a demand for 1 BTC. They ended up restoring to a backup 3 days before the incident |
# |
Jun 26th 2019, 08:56 |
kgb.acct.personal |
Leaving a dot (.) if it actually was a cve |