|
28 | 28 | $v_password = escapeshellarg($_POST['v_password']); |
29 | 29 | $v_type = $_POST['v_type']; |
30 | 30 | $v_charset = $_POST['v_charset']; |
| 31 | + if (empty($_POST['v_notify'])) $v_notify = 'off'; |
31 | 32 |
|
32 | 33 | // Check for errors |
33 | 34 | if (!empty($errors[0])) { |
|
53 | 54 | unset($v_password); |
54 | 55 | unset($output); |
55 | 56 | } else { |
| 57 | + if (empty($v_notify)) { |
| 58 | + list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"]); |
| 59 | + if ($_POST['v_type'] == 'mysql') $db_admin_link = "http://".$http_host."/phpMyAdmin/"; |
| 60 | + if ($_POST['v_type'] == 'pgsql') $db_admin_link = "http://".$http_host."/phpPgAdmin/"; |
| 61 | + |
| 62 | + $to = $panel[$user]['CONTACT']; |
| 63 | + $subject = "Database Credentials"; |
| 64 | + $hostname = exec('hostname'); |
| 65 | + $from = "Vesta Control Panel <noreply@".$hostname.">"; |
| 66 | + $mailtext = "Hello ".$panel[$user]['FNAME']." ".$panel[$user]['LNAME'].",\n"; |
| 67 | + $mailtext .= "your ".$_POST['v_type']." database has been created successfully.\n\n"; |
| 68 | + $mailtext .= "database: ".$user."_".$_POST['v_database']."\n"; |
| 69 | + $mailtext .= "username: ".$user."_".$_POST['v_dbuser']."\n"; |
| 70 | + $mailtext .= "password: ".$_POST['v_password']."\n\n"; |
| 71 | + $mailtext .= $db_admin_link."\n\n"; |
| 72 | + |
| 73 | + $mailtext .= "--\nVesta Control Panel\n"; |
| 74 | + send_email($to, $subject, $mailtext, $from); |
| 75 | + } |
56 | 76 | $_SESSION['ok_msg'] = "OK: database <a href='/edit/db/?database=".$user."_".$_POST['v_database']."'><b>".$user."_".$_POST['v_database']."</b></a> has been created successfully."; |
57 | 77 | unset($v_database); |
58 | 78 | unset($v_dbuser); |
|
0 commit comments