Comments (3)
Huh, interesting! I hadn't thought of that method when I wrote it. Thanks
for the tip, I may integrate that in the future :)
On Sat, Sep 24, 2016 at 4:37 PM, Reinier Kors [email protected]
wrote:
Thanks for your response.
I now understand why you added it after digging a bit through the source
code 😄Although, for my suggestion, you wouldn't even have to add another select
query:In PDO you can use: PDO::lastInsertId
or for MySQLi you can use mysqli_insert_id();That's why I said it was unnecessary.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#35 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AH24Ao-7T1spPXhS674lbRTVKk7wWT2Nks5qtYoXgaJpZM4KErji
.
- bradley david
from php-login.
There are a few reasons. Primarily, I chose to go this direction because of
the application logic with sending verification emails to avoid unnecessary
database calls. When the user signs up and gets a valid response back from
the server, it then automatically sends an email to the user for
self-verification which is done using this user id. If we generated the ID
at the database level, we would have to then build an additional select
statement in the middle in order to pull out the new ID for this. Building
the GUID generation step into the PHP code simplifies this. It is
extremely unlikely that you would ever run into a collision, especially
for something like user ids.
If you are still concerned about it, you can either switch the second
option in the uniqid() function to true, which would increase the entropy
of the unique identifier from 13 characters to 23 (there will be a slight
performance impact, but this would be very minimal), or you could add the
functionality on the database end like you said and simply create an
additional select statement within the logic to pull that new ID out to
send for verification. This would create even more processing overhead
though, which is another reason I wouldn't recommend it.
On Fri, Sep 23, 2016 at 3:20 AM, xDiglett [email protected] wrote:
Why are we not auto incrementing the id in the database, but instead,
generating a uniqid.uniqid does not guarantee uniqueness of return value, and seems
unnecessary in this case.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#35, or mute the thread
https://github.com/notifications/unsubscribe-auth/AH24AjLKhf9bevHZ9bsMgRqhoT5fg1U0ks5qs328gaJpZM4KErji
.
- bradley david
from php-login.
Thanks for your response.
I now understand why you added it after digging a bit through the source code 😄
Although, for my suggestion, you wouldn't even have to add another select query:
In PDO you can use: PDO::lastInsertId
or for MySQLi you can use mysqli_insert_id();
That's why I said it was unnecessary.
from php-login.
Related Issues (20)
- Admin Reset User Passwords
- Solution to authentication problem MySQL 8
- i got this error after installation on local pc(XAMPP) HOT 4
- demo? HOT 3
- Freshinstall (automated)
- How to get username by javascript? HOT 1
- how to change smtp to PHP mail() HOT 1
- Bootsrap4 upgrade and documentation
- Having alot of issues upon installing HOT 12
- Short Login Time HOT 2
- Blank page after installation HOT 1
- issue on database
- Direct PDO queries
- Problems with API
- Bad Request
- Trying to access array offset on value of type bool HOT 1
- "PHP-Login-master/vendor/autoload.php " Is Missing HOT 5
- SMTP error: Authentication failed: Password command failed
- VCRUNTIME140.dll was not found
- Error trying to enter /login/ folder
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-login.