Re: Create login procedure...
| From: | Justin French | Date: | Tue, 24 Sep 2002 08:48:58 +0000 |
| Subject: | Re: Create login procedure... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-117388@lists.php.net to get a copy of this message | ||
on 24/09/02 7:20 PM, Christian Ista (mailing-list@istasofts.com) wrote:
> Hello,
>
> I change the procedure to create an account for users. For the moment,
> the user (to create and log in), have to create an account with e-mail +
> password. I'd like to create a procedure to check the e-mail (login)
> validity. But I'd like to check if the e-mail used exist or not.
>
> The procedure, I'd like implement :
> 1. User create new account (enter : fisrt name, last name, e-mail,
> password, ....)
yup
> 2. An e-mail is send to user to check if e-mail exist. In the e-mail, my
> first idea is to send with an auto-generated number
i generate a random 5 digit number before inserting into the DB. I then
insert the information WITH the confirm code as one colum.
i then obtain the ID of the row I just inserted into the users table, and
then i send an email with a link like:
'to confirm your membership, please click on this link (or copy into your
browser).
http://site.com/confirm.php?id=45&code=12856'
They click on the link, and if the confirm code matches for the right ID,
then we're confirmed. I change the confcode column to 1, and use this as a
test to ensure a user is confirmed.
not bullet proof, but a good start.
make sure the link is short, to avoid line wrapping etc...
> 3. User have to join a specific page to enter the auto-generated number
> to check the validity.
Yup
> My question are :
> 1. What do you think about this procedure ? your advise, idea are welcome
see above... in theory, good start.
> 2. Is it possible with mySQL to delete user after for example 2 days, if
> the user not confirm the subscription ?
to AUTOMATE a procedure on the server, you need a cron job (unix) or
scheduled task (win). another option is to have a clean-out tool as part of
your admin tools... just a simple link you click on every so-often which
looks for unconfirmed users more than X hours old. The way to check this
would be to ensure you insert a time stamp of some description as a column
of your user table (stamp_added) for example.
whether you automate it, or clean out manually every few days, the thoery is
the same.
your user table might look something like:
id|email|first|last|pass|confcode|stampadded|stamplastlogin
or you mgiht choose to split stuff like stampAdded, stampLastLogin, and even
the confirmation code into separate relational tables...
Justin