*EDIT-- if you are talking php and you've got root, there ain't much you can't do. Start by being real, true to yourself and others and get learning. No matter your age, sex, race, coding is great but there's absolutely no room for pretenders. Help will come 100000 times faster and of better quality if you lay the facts down and detailed. Words like dilema gets you *busted* on the scale of "i want to help you" to "figure it out yourself, master!".
-----------------------
original:
What do you want? i understand you want to add a user with your script when someone registers.
I also understand you are good at php from this "I'm not really adept in *.sh but I'm good with PHP."
If you qualify yourself as 'good' with php:
- you have some programmation knowledge, ie "code logic"
- you undoubtedly know mysql
Considering you have both things i just wrote, what's the question again?
Seriously. Even if bash scripting is not your sauce, a coder understands code logic. a coder gets simple string stuff.. or shouldn't he?? damn trivial question.
this is php, at it's most basic and soon deprecated if not already...oh.. yeah i guess you know classes and objects with php--good as you are. I didn't take a chance i wrote the simplest code ever.
<?php
$dbhost = "localhost";
$dbusername = "root";
$dbpassword = "";
$database = "vmail";
mysql_connect($dbhost,$dbusername,$dbpassword);
mysql_select_db($database) or die ( "Unable to select database");
#this will list your domains
$sql = mysql_query("SELECT * FROM domain ORDER BY domain ASC");
while($row = mysql_fetch_array($sql)){
$domain = $row['domain'];
echo "$domain" . PHP_EOL;
}
#this will delete a domain
$sql = "DELETE FROM domain WHERE domain = '$domain'";
mysql_query($sql);
# just a way of doing it, you phpmaster -- laugh at errors, that's off the top of my hat.
$username = mysql_real_escape_string($_POSTwhatever...);
$domain = mysql_real_escape_string(some $_POST value you got back, you know, coder.);
$admin = 0;
$global_admin = 0;
$password = 'whatever';
$hash = shell_exec("doveadm pw -s 'ssha512' -p '$password'"); #now use google if you are lost, coder.
$sql = mysql_query("INSERT INTO mailbox SET username = '$username@$domain', password = '$hash', name = '$username', domain = '$domain', isadmin = $admin, isglobaladmin = $global_admin, maildir = '$domain/$username', created = '$time_now', local_part = '$username'");
How many mail servers have you tried before finding this awesome piece of software you said?
Dillema doesn't even apply to your question. Ignorance and pretention do, tho.
Sorry. You are getting what you deserve while paying for others at the same time.