today I am facing the problem of authenticating users who are willing to register on our page. I want an email to be sent to each user while registering with a link in it to verify the account and (email)adress...
Does anyone have a resource for a script, I bet there are matching scripts for this purpose. I'm just tooooo lazy to write one for myself,
I wouldn't have posted here without having checked some things at least before... These resources all seem to be very scattered about real results. One can hardly distinguish if something is usefull or not, so I am asking you: Has anybody already made experience of some sort with scripts like that?
Here is how I do it - all Perl based, and I can mail you the scripts tommorow if you want to have a look:
Step 1
User completes form. Required fields: username, e-mail
Step 2
Script creates initial DB entries, with status field 'disabled' and sets a MD5 string in the verify column.
Step 3
Mail user the activiation mail, including a link to click for activiation. This link includes an encrypted version of the MD5 in the DB, along with the userid/username
Step 4
User clicks on link, and the script then verifies the MD5 string. If it matches, prompt for a password ( with verification ). Once the password is set, the account is enabled, and the verify column is set to NULL.
Then I also have some cleanwork at regular intervals, that basically remove the accounts that has not been verified in 72 hours.
This technique is inline with many other to ensure that the e-mail account exists before the account is activated. One reason for doing this, is that we may need to mail a re-activiation mail if the user forgets his/her password.
Let me know if you would like to have a look at the scripts.
In the ZIP file is a tar.gz file ( due to the forum restrictions ).
It contains a pure CGI example. All you have to do to get it to work is to set the database username and password in every file. Then copy it to /var/www/cgi-bin ( or equiv. ) and point your browser to http://127.0.0.1/cgi-bin/index.pl
O boy - I forgot - you should also use the supplied SQL file to create your DB. I just used the default test table and it's still setup like that.
Naturally I assume you use Linux, but it should still work with little/no modification on Windows and other platforms.
The e-mail doesn't actually work - you have to write your own code here. Rather, I print debug info to the web browser which is similar to the message that will be sent to the user's e-mail. You just copy the URL and paste it in the web browser. ( in Linux, double click the URL to select, and third-button-click to load in the same browser window ).
I use this as a framework only. I actually have a much larger framwork with theme integration etc., but I scaled down to present you with this.