Post new topic Reply to topic  [ 33 posts ] 
Author Message
 Post subject: PHP script: Let users create their own accounts
PostPosted: 2004-11-20 06:38 
http://denlou.ca/software/signup.zip

I created this software to interface with the MySQL database and a user to create their own accounts. This may have already been done, but here's my version.


Top
  
 
 Post subject:
PostPosted: 2005-03-15 00:35 
New user
New user

Joined: 2005-03-02 07:26
Posts: 3
I was searching the forums for something like this. I check that link, but it's invalid. If anyone know where i can get something with an auto registration. I will like maybe the owners of the domain be able to use a web interface, or just a webinterface that user can register their e-mail with a preassing domain name.

Thank you in advanced.

Jorge


Top
 Profile  
 
 Post subject:
PostPosted: 2005-03-15 09:45 
Developer

Joined: 2003-11-21 01:09
Posts: 6403
Location: Sweden
In hMailServer 4.0, the PHPWebAdmin has support for different administration levels. For example, you can give a user domain administration rights. With this, he can create accounts, etc and change settings for his domain.


Top
 Profile  
 
 Post subject:
PostPosted: 2005-03-29 08:36 
New user
New user

Joined: 2005-03-23 17:28
Posts: 16
Hi Martin
can you give me a tip on how to do that? All I can find is the ONE admin user / password combo in the config.php ... Does it work through the e-mail-account authentication? What do I need to set up to have more than one admin in PHPWebAdmin?
Thanks!
John


Top
 Profile  
 
 Post subject:
PostPosted: 2005-03-29 12:49 
Developer

Joined: 2003-11-21 01:09
Posts: 6403
Location: Sweden
Tip on how to do what?

As I said, the feature is avaialble in hMailServer 4.0. Are you using that version?


Top
 Profile  
 
 Post subject:
PostPosted: 2005-03-29 13:50 
New user
New user

Joined: 2005-03-23 17:28
Posts: 16
Ah, ok, I see, I have 3.4B69 installed - so you're really saying, it will be in v4? :) Would taking the PHPWebAdmin-Interface from v4 Beta B91 to v3.4 work (possibly upgrading the database as well)? (or is the ETE for the non-beta v4 close enough to wait?) - Sorry for all these questions Martin + Thanks for the great work!!

John


Top
 Profile  
 
 Post subject:
PostPosted: 2005-04-13 05:45 
New user
New user

Joined: 2004-11-22 08:37
Posts: 6
Location: Richmond/Vancouver, BC
Alright, I wrote some crude PHP code to interface with the MySQL DB, it's back up for all those who requested it..

http://denlou.ca/software/signup.zip

_________________
-Ryan L
http://denlou.ca/


Top
 Profile  
 
 Post subject:
PostPosted: 2005-04-13 08:43 
Developer

Joined: 2003-11-21 01:09
Posts: 6403
Location: Sweden
johnm:
Yes, it will be in v4. You can't use v4beta PHPWebAdmin in 3.4. The V4 beta utilizes a lot of new features in V4 that does not exist in 3.4.

I will hopefully put up v4.0 as "unstable" on the download page tomorrow.


Top
 Profile  
 
 Post subject:
PostPosted: 2005-04-13 11:24 
New user
New user

Joined: 2005-04-08 13:10
Posts: 5
so when you expecting that the version is stable?

_________________
<--ICT--> our way, to the high way.


Top
 Profile  
 
 Post subject: Denlou : Need help with your code !
PostPosted: 2005-05-16 02:37 
New user
New user

Joined: 2005-05-16 02:28
Posts: 1
Hi all !

This message is for Denlou !

Yo Dude ! i tried your code but can't get it to work !
All the variables are entered correctly (I think !).

A full example of the code would be helpful !

I get these warnings.

Warning: mysql_connect(): Can't connect to MySQL server on 'localhost' (10061) in C:\email\newac\index.php on line 49

Warning: mysql_select_db(): Can't connect to MySQL server on 'localhost' (10061) in C:\email\newac\index.php on line 50

Warning: mysql_select_db(): A link to the server could not be established in C:\email\newac\index.php on line 50
Unable to open database, contact your administrator!


Thanks for your help !

:twisted:


Top
 Profile  
 
 Post subject:
PostPosted: 2005-05-16 02:43 
New user
New user

Joined: 2004-11-22 08:37
Posts: 6
Location: Richmond/Vancouver, BC
Lines 24-28
Code:
//MySQL Information:
$mysql_host = "localhost"; //Host Name
$mysql_user = ""; //Username
$mysql_pass = ""; //Password
$mysql_db = "hmail"; //Database


You need to fill these in, something like this...

Code:
//MySQL Information:
$mysql_host = "localhost"; //Host Name
$mysql_user = "username"; //Username
$mysql_pass = "password"; //Password
$mysql_db = "hmail"; //Database


The program is having trouble connecting to your database so make sure your mysql account information is correct.

_________________
-Ryan L
http://denlou.ca/


Top
 Profile  
 
 Post subject: this is a great script
PostPosted: 2005-08-17 07:00 
New user
New user

Joined: 2005-08-11 23:57
Posts: 8
I suggest making this topic sticky, since the script is excellent and just looking at the first few pages of topics I noticed about 5 different topics on this subject. That, or putting this script somewhere where it is accessible to people, so it doesn't get relegated to page 20 or so in this forum. Just put it in your web server directory and run after minor configuring. Written in PHP and easily modified for those who know it, though you don't necessarily have to know PHP for it to work correctly.

Some notes about it:

I removed the IMAP, POP, and SMTP variables in the configuration portion of the beginning of the script, as well as in the portion where these are echoed back to the user. I saw no use in relaying this to the user since they probably only care about access to webmail. Also, made a new variable, $domain_name, and replaced every instance of $temp_domain with this. For some reason $temp_domain wasn't working right. I still have some minor configuration to do for it, but it's working great now anyway. Finally, though I'm not sure, I don't think the $account_max variable should be listed as "2000000" but only as "2" for an account with a max size of 2 MB.

The only problem so far really is that the hmailserveradmin program doesn't seem to recognize the accounts created with this script. However, the database and server both do, so you can immediately start using your account after it is created. I don't know what's up with the admin program, but I really don't need to mess with the user accounts anyway.


Top
 Profile  
 
 Post subject: encryption
PostPosted: 2005-08-17 07:45 
New user
New user

Joined: 2005-08-11 23:57
Posts: 8
Another problem: this script does not encrypt the password before entering it into the database. To encrypt it, just change the mysql insert query from

Code:
$q3=mysql_query("INSERT INTO `hm_accounts` (`accountdomainid`,`accountaddress`,`accountpassword`,`accountactive`,`accountisad`,`accountmaxsize`) VALUES ('{$_POST['domain']}','{$_POST['user']}@$temp_domain,'{$_POST['pass1']}','$admin_default_activate','0','$account_max')")


to
Code:
$q3=mysql_query("INSERT INTO `hm_accounts` (`accountdomainid`,`accountaddress`,`accountpassword`,`accountactive`,`accountisad`,`accountmaxsize`) VALUES ('{$_POST['domain']}','{$_POST['user']}@$temp_domain,SHA('{$_POST['pass1']}'),'$admin_default_activate','0','$account_max')")


...basically, put SHA('password')

And to authenticate, use this function again in a select query comparing the user's attempted and stored passwords.

Now, does anyone know how to do this with SquirrelMail?


Top
 Profile  
 
 Post subject:
PostPosted: 2005-08-17 19:32 
New user
New user

Joined: 2004-11-22 08:37
Posts: 6
Location: Richmond/Vancouver, BC
Well the only reason that I never programmed this in originally is because SquirrelMail doesn't support it, you might want to see if SquirrelMail has a development forum and suggest that feature, though it can't be hard to do, I'll look into it when I get back, but I'm re-writting the code for this entire script if I do change code with SquirrelMail.


Top
 Profile  
 
 Post subject:
PostPosted: 2005-08-17 22:54 
Developer

Joined: 2003-11-21 01:09
Posts: 6403
Location: Sweden
I wouldn't use SHA('pass'). At least not if I want my users to be able to log on... hMailServer uses a MD5 checksum and not an SHA checksum. So MD5('pass') would be better. :)


Top
 Profile  
 
 Post subject: think I got it
PostPosted: 2005-08-18 02:49 
New user
New user

Joined: 2005-08-11 23:57
Posts: 8
That helped. I changed the "SHA" to "MD5". Didn't work, but then I added the "accountpwencryption" field to the insert query, with the value of "2". That worked. Here is new insert in case anyone cares.

Code:
$q3=mysql_query("INSERT INTO `hm_accounts` (`accountdomainid`,`accountaddress`,`accountpassword`,`accountactive`,`accountisad`,`accountmaxsize`,`accountpwencryption`) VALUES ('{$_POST['domain']}','{$_POST['user']}@$domain_name',MD5('{$_POST['pass1']}'),'$admin_default_activate','0','$account_max','2')") or die(mysql_error());
            


I don't think there are any other problems with doing it this way, and having users register email accounts using this script, but I'm by no means an expert. Anyone have any thoughts on potential problems?


Top
 Profile  
 
 Post subject:
PostPosted: 2005-08-23 05:51 
New user
New user

Joined: 2005-03-06 20:21
Posts: 7
Hi, I was wonderin if I could ask you a question regarding the registration script please.

I followed your changes as posted.

I have multiple domains setup in hmail server.

in the registration page, the domains show up as a drop down menu.

I go through the registration and everything is sort of fine. EXCEPT: in the hmail server control panel and in the mysql database, the @domain.com part of the new account created is not written off. So, lets say if I created an account of "hello@domain.com", then, "hello" shows up under the domain.com accounts however NOT as hello@domain.com, but rather simply as "hello@", without the domain.com portion..... THEREFORE an error is created and both the server admin of hmail and the mysql consider it as incomplete and error registration and it doesn't work...

I think in the index.php /registration form, after choosing the domain name in the drop down menu, somehow it doesn't get trasferred to the database....

I'm not a programmer.

Could you please help me fix this?

Also, would you mind tell me how I could add a: "New Registration", "lost your password" to the login page that would go to this form page and comeback to the login page?

if you have a script that is made nice already available, and if you don't mind sharing it, I'd love it!

my email is: dralibak@yahoo.com

Thank you.

Ali


Top
 Profile  
 
 Post subject:
PostPosted: 2005-08-24 02:05 
New user
New user

Joined: 2005-03-06 20:21
Posts: 7
Hi, nobody has read this post? or no-one has an answer ? ! :)

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: 2005-10-09 13:37 
Developer

Joined: 2003-11-21 01:09
Posts: 6403
Location: Sweden
You probably didn't receive an answer because creating such a thing requires you to write at least a 30-40 lines of PHP code. Find a PHP developer that can help you with this. :)


Top
 Profile  
 
 Post subject:
PostPosted: 2005-11-09 02:17 
New user
New user
User avatar

Joined: 2005-11-08 05:33
Posts: 10
Location: Sweden
alibak wrote:
Hi, I was wonderin if I could ask you a question regarding the registration script please.

I have multiple domains setup in hmail server.

in the registration page, the domains show up as a drop down menu.
I go through the registration and everything is sort of fine. EXCEPT: in the hmail server control panel and in the mysql database, the @domain.com part of the new account created is not written off. So, lets say if I created an account of "hello@domain.com", then, "hello" shows up under the domain.com accounts however NOT as hello@domain.com, but rather simply as "hello@", without the domain.com portion..... THEREFORE an error is created and both the server admin of hmail and the mysql consider it as incomplete and error registration and it doesn't work...


Hi , check the $q3 query for {$_POST['user']}@$domain_name

change $domain_name to $temp_domain
And your dropp list inserts to the db should work fine unless you altered code along with that ..


Top
 Profile  
 
 Post subject: Just a quick thought!
PostPosted: 2006-06-01 00:03 
New user
New user

Joined: 2006-05-23 00:41
Posts: 6
For those who wonder if this code is working the way it should... I found there was a small problem with the bottom part of the script... I couldnt seem to get this working when it seemed simple enough!

Heres what I did

Find somewhere around line 130 on your script, where it says
Code:
<form action=\"index.php?mode=do\" method=\"POST\">


I had to rename where it says "index.php" to what I renamed my script as , say , "signup.php" . I guess where I origionally has an index.php in my root folder when I re-named it in orser to use it locally it didnt work. Simple fix,

The following codes were changed as well:


change $domain_name to $temp_domain

hope this some-what helps you out!


Top
 Profile  
 
 Post subject: Re: PHP script: Let users create their own accounts
PostPosted: 2006-09-04 07:04 
New user
New user

Joined: 2006-09-04 07:02
Posts: 8
Location: Brisbane, Australia
denlou wrote:
http://denlou.ca/software/signup.zip


Apologies for the slooow reply, but is this script still available somewhere? The above link returns a 404 :(

Cheers,
Kingo


Top
 Profile  
 
 Post subject: Re: PHP script: Let users create their own accounts
PostPosted: 2006-09-23 03:19 
New user
New user

Joined: 2006-09-23 03:17
Posts: 1
Location: Athens, Greece
denlou wrote:
http://denlou.ca/software/signup.zip


This link doesen't work! :roll:


Top
 Profile  
 
 Post subject:
PostPosted: 2006-09-24 05:52 
New user
New user

Joined: 2004-11-22 08:37
Posts: 6
Location: Richmond/Vancouver, BC
wow, I just reinstalled HMail for another project, it's been a while since I wrote that. You know, I think I saw it the other day on one of my hard drives, but god knows where the copy of that software is now.


Top
 Profile  
 
 Post subject:
PostPosted: 2006-11-05 14:37 
New user
New user

Joined: 2006-11-04 23:26
Posts: 2
Does ahyone have the code they could send me at all? The link doesn't work anymore


Top
 Profile  
 
 Post subject:
PostPosted: 2007-02-22 11:30 
New user
New user
User avatar

Joined: 2007-02-22 11:09
Posts: 25
Location: Portugal
Please take a look at the following post:

http://www.hmailserver.com/forum/viewto ... 4027#44027

_________________
aka: Bruno Vaz

hMailServer-4.3.1-B253 + phpwebadmin + roundcubemail-0.1beta2.2 + clamwin-0.88.7


Top
 Profile  
 
 Post subject:
PostPosted: 2007-08-29 12:46 
New user
New user

Joined: 2006-10-03 16:28
Posts: 18
can someone plz make the signup code downloadable.


Top
 Profile  
 
 Post subject:
PostPosted: 2007-08-29 12:56 
Site Admin
User avatar

Joined: 2005-07-29 16:18
Posts: 13792
Location: UK
Follow Cableguys's link.


Top
 Profile  
 
 Post subject: Re: PHP script: Let users create their own accounts
PostPosted: 2009-08-23 12:15 
New user
New user

Joined: 2009-08-23 12:09
Posts: 1
Yes I will follow that. Seems very reliable. It is worth a try.

Thanks a lot.


Pret immobilier


Top
 Profile  
 
 Post subject: Re: PHP script: Let users create their own accounts
PostPosted: 2010-08-05 15:58 
New user
New user

Joined: 2010-08-05 15:57
Posts: 1
Sorry to revive an old topic. When I add users using a SQL query in hMail v5.3.3, the user gets added to the domain in the database but when mail is sent to this user, I can see the message arriving to a generic mailbox; NOT to the user it was meant for.
Any insight?


Top
 Profile  
 
 Post subject: Re: PHP script: Let users create their own accounts
PostPosted: 2010-08-09 14:03 
Developer

Joined: 2010-04-24 23:16
Posts: 5891
Location: Michigan, USA
Yeah best to start your own thread & link to ones you feel might be related.

I'd say add a user with hmail's admin GUI/web & test it to make sure it goes to the user's box & your setup is how you think then add a user the way you're trying now & compare the SQL rows to see if you missed something like enabling the user or typo or putting in wrong db/table, etc.. If that doesn't work try restarting hmail service after adding to see if it's a caching issue.
Bill

_________________
hMailServer build LIVE on my servers: 5.4-B2014011501
Latest test builds: http://www.hmailserver.com/forum/viewtopic.php?f=10&t=21420
Urgent? Bored? JOIN US ON IRC!
DOGE ME: DSqtEcqP3Qv6Tj2XrGNpDmEUkSBcpBsuWk


Top
 Profile  
 
 Post subject: Re: PHP script: Let users create their own accounts
PostPosted: 2011-07-15 17:45 
New user
New user

Joined: 2011-07-14 18:39
Posts: 7
Bill48105 wrote:
Yeah best to start your own thread & link to ones you feel might be related.

I'd say add a user with hmail's admin GUI/web & test it to make sure it goes to the user's box & your setup is how you think then add a user the way you're trying now & compare the SQL rows to see if you missed something like enabling the user or typo or putting in wrong db/table, etc.. If that doesn't work try restarting hmail service after adding to see if it's a caching issue.
Bill


Bill,

Having a similar issue and I feel it is appropriate to post on this thread because I have the same thing happening and can't quite understand some of the lingo you are using (I am on the forum at the request of my boss to help trouble shoot some IT issues). Very similar issue happening here with the generic mailbox. They are going to the right domain, but for some reason they are going to a general inquiry box instead of the individual employee to which the mail was supposedly targeted. I hope I am being understandable...It's like there is a filter pushing the mail aside...


Top
 Profile  
 
 Post subject: Re: PHP script: Let users create their own accounts
PostPosted: 2011-07-15 20:25 
Site Admin
User avatar

Joined: 2005-07-29 16:18
Posts: 13792
Location: UK
thedealer. Start a new thread with your issues or your post will be deleted.

Also read this viewtopic.php?f=6&t=12211

_________________
If at first you don't succeed, bomb disposal probably isn't for you! ヅ


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 33 posts ] 


Who is online

Users browsing this forum: No registered users and 8 guests



Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group