NYCPHP Meetup

NYPHP.org

[nycphp-talk] design question: user self-registration

David Mintz david at davidmintz.org
Tue Aug 31 12:43:19 EDT 2010


[Not PHP-specific, but we all know the greatest minds in town are here, so
---]

Here's my dilemma. For reasons a little too boring and involved to go into
here, I have split the thing called User into two tables, one called
'people' that holds firstname, lastname, email, and other personal data. The
'users' table holds username, password, last_login timestamp, etc. Both
tables have a boolean 'active' so that I can disable user accounts and mark
people as, well, inactive and only interesting for historical reasons.

I want to provide a self-service user registration, with an email
verification thing. They submit their data, we email them a link to verify
that they control the email address they provided, bla bla, then the account
is enabled. So I thought I would go ahead and do the inserts, marking both
new records as 'inactive' pending email confirmation.

In some cases, though, there may already be a row in people corresponding to
the new user. If I attempt the insert and the email already exists I will
get a duplicate email error. But if I instead run an update on the
already-existing row, I will have done the update without first verifying
the email. I am therefore thinking that the pending person/user rows maybe
ought to be stored somewhere else temporarily. I am even thinking, maybe
serialize much of the person and user details, perhaps as JSON, since it's
just being crammed away temporarily pending verification.

What would you do?

Gratefully yours....



-- 
Support real health care reform:
http://phimg.org/

--
David Mintz
http://davidmintz.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20100831/66ec54b1/attachment.html>


More information about the talk mailing list