I am trying to write code for a php form, that a user fills in and chooses a user name and password. They also have to provide an email address. Once they submit their registration details I would like to send them a confirmation email containing their username and password...does anyone know how I would go about doing this? Is there anywhere I could get some sample code, even just as a starting point? Thanks a million in advance to anyone who could help me!!
If you check i think the last page of the tutorial you can get the whole source code for the entire login system.. I found it works pretty well, however, there are a few things you might want to fix in it: 1, its written with register globals on.. this make certain parts of it difficult to understand and also not as secure.. Secondly, it contains no distinction between user types, if that is important for you.. For instance if you want like an administration page for the site owner, who would have to login and have 'admin' priviledges, you will hvae to implement that.. but it is fairly complete other than that..
How it works is a user picks his username and password.. his password gets md5'd..There is also a built in hidden hash variable that you specify in one of the login include files. This password is md5'ed in the confirmation and concatenated with the md5 of your password and put into a link in an email to the person who signed up.. when he clicks the link, the system checks to see if it matches the md5 for his pw and the system... this way a user couldnt auto confirm by just getting the md5 of his own pw and putting it in the querystring... I forget all the rest of the details.. but i think thats basically how it works.
and one more thing, it doesnt use sessions, so you will have to rely entirely on cookies which seems a bit outdated (i think the tutorial was written 3 years ago or more)
It's just simple logic really.
After you've done your duplicate checking and all that you just create a unique string.
After doing so you can insert it into the DB along with their user data, then email them with the URL to click on.
The URL page will look for a variable in the $_GET global, if it sees it then all it needs to do is lookup the string in the DB and if it's found just for example remove anything in that field or change it to a Y/1 whatever you choose to show they are active etc.
I'll drop you a URL later when I get in from work if someone else hasn't done so.
Thanks everyone for your help! I found code that works, when i submit an email address to the database it sends a confirmation email containing the username and password. My only problem is...I'm using my college mail server ( I have this set in my php.ini config file). So when I try to submit an email address to the database, it will only let me use submit college email addresses. Does anyone know of a way that I could set it that it will return a confirmation email to any email address??