Пример #1
0
 DataExchange("w", $z_db_name, $sql);
 # Now lets pull back the client ID so that we can add their personal address details etc...
 $sql = "SELECT * FROM z_accounts WHERE ac_reseller_fk=" . $acc_fk . " ORDER BY ac_id_pk DESC";
 $clientid = DataExchange("l", $z_db_name, $sql);
 $sql = "INSERT INTO z_personal (ap_acc_fk,\r\n\t\t\t\t\t\t\t\t\tap_fullname_vc,\r\n\t\t\t\t\t\t\t\t\tap_email_vc,\r\n\t\t\t\t\t\t\t\t\tap_address_tx,\r\n\t\t\t\t\t\t\t\t\tap_postcode_vc,\r\n\t\t\t\t\t\t\t\t\tap_phone_vc) VALUES (\r\n\t\t\t\t\t\t\t\t\t" . $clientid['ac_id_pk'] . ",\r\n\t\t\t\t\t\t\t\t\t'" . Cleaner('i', $_POST['inFullName']) . "',\r\n\t\t\t\t\t\t\t\t\t'" . Cleaner('i', $_POST['inEmailAddress']) . "',\r\n\t\t\t\t\t\t\t\t\t'" . Cleaner('i', $_POST['inAddress']) . "',\r\n\t\t\t\t\t\t\t\t\t'" . Cleaner('i', $_POST['inPostCode']) . "',\r\n\t\t\t\t\t\t\t\t\t'" . Cleaner('i', $_POST['inPhone']) . "')";
 DataExchange("w", $z_db_name, $sql);
 # Now we add an entry into the bandwidth table, for the user for the upcoming month.
 $sql = "INSERT INTO z_bandwidth (bd_acc_fk, bd_month_in, bd_transamount_bi, bd_diskamount_bi) VALUES (" . $clientid['ac_id_pk'] . "," . date("Ym", time()) . ", 0, 0)";
 DataExchange("w", $z_db_name, $sql);
 # Create the MySQL account for the user...
 zapi_mysqluser_add(Cleaner('i', $username), $zdb);
 zapi_mysqluser_setpass(Cleaner('i', $username), Cleaner('i', $_POST['inPassword']), $zdb);
 # Now we create the user's home directory if it doesnt already exsist...
 zapi_filesystem_add(GetSystemOption('hosted_dir') . $username . "/");
 # Create the domain logs folder read for Apache...
 zapi_filesystem_add(GetSystemOption('logfile_dir') . $username . "/");
 # Create a default FTP account if set in the system options...
 if (GetSystemOption('auto_ftpuser') == "true") {
     # Get the current account ID for the new user...
     $acc_fk = $clientid['ac_id_pk'];
     $password = $_POST['inPassword'];
     $access_type = "RW";
     $homedirectoy_to_use = "/";
     # Just need to check that an account doesnt already exist with the same username....
     $sql = "SELECT * FROM z_ftpaccounts WHERE ft_user_vc='" . Cleaner('i', $username) . "' AND ft_deleted_ts IS NULL";
     $existsftp = DataExchange("t", $z_db_name, $sql);
     $permissionset = "\t\t<Option Name=\"FileRead\">1</Option>\r\n\t\t<Option Name=\"FileWrite\">1</Option>\r\n\t\t<Option Name=\"FileDelete\">1</Option>\r\n\t\t<Option Name=\"FileAppend\">1</Option>\r\n\t\t<Option Name=\"DirCreate\">1</Option>\r\n\t\t<Option Name=\"DirDelete\">1</Option>\r\n\t\t<Option Name=\"DirList\">1</Option>\r\n\t\t<Option Name=\"DirSubdirs\">1</Option>";
     if ($existsftp < 1) {
         if (ShowServerPlatform() == 'Windows') {
             zapi_ftpaccount_add(GetSystemOption('filezilla_root'), $username, $password, GetSystemOption('zpanel_version'), ChangeSafeSlashesToWin(GetSystemOption('hosted_dir') . $username), $permissionset);
         } else {
Пример #2
0
 # Check to make sure the Server is Windows before doing this..
 if (ShowServerPlatform() == 'Windows') {
     if (GetSystemOption('disable_hostsen') == 'false') {
         # Lets add the hostname to the HOSTS file so that the server can view the domain immediately...
         @exec("C:/ZPanel/bin/zpanel/tools/setroute.exe " . $domain . "");
         @exec("C:/ZPanel/bin/zpanel/tools/setroute.exe www." . $domain . "");
     }
 }
 # Work out what handlers to add and then lets do it...
 $handlers = "";
 if ($packageinfo['pk_enablephp_in'] == 1) {
     $handlers = GetSystemOption('php_handler');
 }
 if ($packageinfo['pk_enablecgi_in'] == 1) {
     $handlers = $handlers . "ScriptAlias /cgi-bin/ \"{$homedir}/_cgi-bin/\"\r\n<location /cgi-bin>\r\n" . GetSystemOption('cgi_handler') . "\r\nOptions ExecCGI -Indexes\r\n</location>";
     zapi_filesystem_add(GetSystemOption('hosted_dir') . $useraccount['ac_user_vc'] . $homedirectoy_to_use . "/_cgi-bin/");
 }
 # Now we get all error pages and prepare them for the vhost container...
 $errorpages = "ErrorDocument 403 /_errorpages/403.html\r\nErrorDocument 404 /_errorpages/404.html\r\nErrorDocument 500 /_errorpages/500.html\r\nErrorDocument 510 /_errorpages/510.html";
 if (!file_exists(GetSystemOption('hosted_dir') . $useraccount['ac_user_vc'] . $homedirectoy_to_use . '/_errorpages/')) {
     mkdir(GetSystemOption('hosted_dir') . $useraccount['ac_user_vc'] . $homedirectoy_to_use . "/_errorpages/", 0777);
     # Now lets copy the standard error pages across from the static directory (Added in ZPanel 4.0.3)
     @copy(GetSystemOption('static_dir') . "errorpages/403.html", GetSystemOption('hosted_dir') . $useraccount['ac_user_vc'] . $homedirectoy_to_use . "/_errorpages" . "/403.html");
     @copy(GetSystemOption('static_dir') . "errorpages/404.html", GetSystemOption('hosted_dir') . $useraccount['ac_user_vc'] . $homedirectoy_to_use . "/_errorpages" . "/404.html");
     @copy(GetSystemOption('static_dir') . "errorpages/500.html", GetSystemOption('hosted_dir') . $useraccount['ac_user_vc'] . $homedirectoy_to_use . "/_errorpages" . "/500.html");
     @copy(GetSystemOption('static_dir') . "errorpages/510.html", GetSystemOption('hosted_dir') . $useraccount['ac_user_vc'] . $homedirectoy_to_use . "/_errorpages" . "/510.html");
     # If the OS is Linux lets chmod them so they have full access
     if (ShowServerPlatform() != "Windows") {
         # Lets set some more permissions on it so it can be accessed correctly! (eg. 0777 permissions)
         @chmod(GetSystemOption('hosted_dir') . $useraccount['ac_user_vc'] . $homedirectoy_to_use . "/_errorpages/", 0777);
         @chmod(GetSystemOption('hosted_dir') . $useraccount['ac_user_vc'] . $homedirectoy_to_use . "/_errorpages" . "/403.html", 0777);