php - How to register mails with shell_exec and plesk 11? -
i want create free e-mail service. i'm using vserver 200gb (for first time) on debian 6 parallels plesk 11 backend.
now want simple php script guests register new mail (for themselves).
i've asked programming friend if me, did.
he has written script this:
<form method="post" action=""> <input type='hidden' name='submitted' id='submitted' value='1'/> <label for='email' >email address:</label> <input type='text' name='email' id='email' maxlength="50" /> <br> <label for='password' >password*:</label> <input type='password' name='password' id='password' maxlength="50" /> <input type="submit" name="submit" value="submit" /> </form> <? function sanitize($data) { $data = strip_tags(trim($data)); $search = array('/[^a-za-z0-9\. -\!\?\(\)\<\>\@]/'); $data = preg_replace($search, '', $data); return $data; } if(isset($_post['email'])){ // strip out unwanted stuff $_post['email'] = sanitize($_post['email']); $_post['password'] = sanitize($_post['password']); if (filter_var($_post['email'], filter_validate_email)) { $email = $_post['email']; } else { echo "invalid email<br>"; $_post['email'] = null; return; } $password = $_post['password']; shell_exec ("/usr/local/psa/bin/./mail --create $email -passwd $password -mailbox true"); echo "your account '$email' has been setup password '$password'"; } ?>
looks work, i've tested it, shell_exec doesn't work correctly. (index.php permissions @ 755) have file index.php don't need more first time, i'll code other stuff when index.php works fine.
i've read bit plesk , creation of mails. have written, shell_exec disabled in plesk default , have activate it.
i don't know how , can that.. know solution?
thanks in advance!!
plesk doesn't disable shell_exec function default.
if think so, check php setting of subscription or file /var/www/vhosts/system/domain.tld/etc/php.ini (this path 11.5)
btw, using php code can avoid execute system commands api-rpc requests. here example of api request plesk creates mailbox: http://download1.parallels.com/plesk/pp11/11.5/doc/en-us/online/plesk-api-rpc/34502.htm
and here code examples php: http://download1.parallels.com/plesk/pp11/11.5/doc/en-us/online/plesk-api-rpc/33181.htm
Comments
Post a Comment