Moved the Agents into their own repo. Kept the agent.pl just for reference
This commit is contained in:
parent
22381be29a
commit
8680a02b13
18132 changed files with 0 additions and 2569420 deletions
|
|
@ -1,129 +0,0 @@
|
|||
<?php
|
||||
// Adds users to the database
|
||||
// Variables
|
||||
$success = 0;
|
||||
|
||||
if (isset($_GET['username'])) {
|
||||
$ftp_username = $_GET['username'];
|
||||
}
|
||||
|
||||
if (isset($_GET['password'])) {
|
||||
$ftp_pass = $_GET['password'];
|
||||
}
|
||||
|
||||
if (isset($_GET['dir'])) {
|
||||
$rDir = $_GET['dir'];
|
||||
}
|
||||
|
||||
if (isset($errors)) {
|
||||
unset($errors);
|
||||
}
|
||||
|
||||
if (file_exists("config.php")) {
|
||||
include 'config.php';
|
||||
} else {
|
||||
die("config.php must exist within the installation root folder!");
|
||||
}
|
||||
|
||||
include_once 'db_functions.php';
|
||||
|
||||
// Did we properly receive the variables from the OGP agent?
|
||||
|
||||
if (isset($ftp_username) && isset($ftp_pass) && isset($rDir)) {
|
||||
|
||||
// We received all necessary variables. Process what we received.
|
||||
$errorCount = 0;
|
||||
$errorInstallInt = 0;
|
||||
|
||||
// OGP should be doing this validation... but it's not
|
||||
|
||||
// Custom directory validation
|
||||
|
||||
|
||||
if (substr_count($rDir, '/') < 2) {
|
||||
$errorCount++;
|
||||
$errors[] = "In order to prevent security risks, users cannot be granted access to the main directories in the root file system of the server. You must go down two directory levels! Example: /games/user1!";
|
||||
}
|
||||
|
||||
if (stripos($rDir, "/") === FALSE || stripos($rDir, "/") != 0) {
|
||||
$errorCount++;
|
||||
$errors[] = "You have not chosen a valid directory!";
|
||||
}
|
||||
|
||||
if ($rDir === "/var/www/" || stripos($rDir, "/var/www/") !== FALSE) {
|
||||
$errorCount++;
|
||||
$errors[] = "You may not create ftp accounts into the protected EHCP directories using this program. Create these accounts using EHCP software.";
|
||||
}
|
||||
|
||||
if (stripos($rDir, "\\")) {
|
||||
$errorCount++;
|
||||
$errors[] = "This is not a Windows machine... use the correct slash character for path...";
|
||||
}
|
||||
|
||||
// If the last character in the path is a slash (/) - Remove it from the string
|
||||
|
||||
if (substr_count($rDir, '/') >= 2 && $rDir[strlen($rDir) - 1] == "/") {
|
||||
$end = strlen($rDir) - 1;
|
||||
$rDir = substr($rDir, 0, $end);
|
||||
}
|
||||
|
||||
if ($errorCount == 0) {
|
||||
|
||||
// Security checks
|
||||
$ftp_password_db = escapeSQLStr($ftp_pass, $connection);
|
||||
$ftp_username_db = escapeSQLStr($ftp_username, $connection);
|
||||
$rDir = escapeSQLStr($rDir, $connection);
|
||||
$SQL = "SELECT id FROM ftpaccounts WHERE ftpusername = '$ftp_username_db'";
|
||||
$Result = execSQL($SQL, $connection);
|
||||
|
||||
if ($Result !== FALSE) {
|
||||
$count = countSQLResult($Result);
|
||||
|
||||
if ($count > 0) {
|
||||
$errorCount++;
|
||||
$errors[] = "The FTP username supplied already exists! Please enter another unique username!";
|
||||
} else {
|
||||
|
||||
// Make sure data enter is unique for homedir
|
||||
$SQL = "SELECT id FROM ftpaccounts WHERE homedir = '$rDir'";
|
||||
$Result = execSQL($SQL, $connection);
|
||||
|
||||
if ($Result !== FALSE) {
|
||||
$count = countSQLResult($Result);
|
||||
|
||||
// Insert the data into the
|
||||
$SQL = "INSERT INTO ftpaccounts (ftpusername, password, homedir) VALUES ('$ftp_username_db', password('$ftp_password_db'), '$rDir')";
|
||||
$Result = execSQL($SQL, $connection);
|
||||
|
||||
if ($Result !== FALSE) {
|
||||
$success = 1;
|
||||
} else {
|
||||
$errorCount++;
|
||||
$errors[] = getSQLError($connection);
|
||||
}
|
||||
} else {
|
||||
$errorCount++;
|
||||
$errors[] = getSQLError($connection);
|
||||
}
|
||||
|
||||
if ($errorCount > 0 && $success == 0) {
|
||||
unset($_POST['createFTP']);
|
||||
include 'admin/ftpCreateForm.php';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$errorCount++;
|
||||
$errors[] = getSQLError($connection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Log errors
|
||||
|
||||
if ($errorCount > 0) {
|
||||
addToLog($errors);
|
||||
}
|
||||
|
||||
// Return value:
|
||||
echo $success;
|
||||
?>
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
This FTP addon works with EHCP (www.ehcp.net)
|
||||
It allows OGP - the open game panel - to manage custom FTP user accounts
|
||||
|
||||
by own3mall
|
||||
*/
|
||||
|
||||
@include_once "/var/www/new/ehcp/config.php";
|
||||
|
||||
/**********************************
|
||||
* DB Creds *
|
||||
* ********************************/
|
||||
// Database credentials change if needed
|
||||
$server = 'localhost';
|
||||
$login = 'ehcp';
|
||||
|
||||
// Script should detect password automatically from EHCP config file above... but if not, please change the value down here.
|
||||
if(!isset($dbpass) || empty($dbpass)){
|
||||
$dbpass = 'changeme';
|
||||
}
|
||||
|
||||
$dbName = 'ehcp';
|
||||
$debug=false;
|
||||
|
||||
/**********************************
|
||||
* END DB Creds *
|
||||
* ********************************/
|
||||
|
||||
// Log File
|
||||
$logFile = 'ehcp_ftp_log.txt';
|
||||
|
||||
function addToLog($errors) {
|
||||
global $logFile, $debug;
|
||||
|
||||
if (!file_exists($logFile)) {
|
||||
$createLog = fopen($logFile, 'a+');
|
||||
|
||||
if (!$createLog) {
|
||||
trigger_error("Unable to create EHCP FTP Integration log file! Please create a file named \"ehcp_ftp_log.txt\" in the ogp_agent install directory under the EHCP folder with permissions of 777", E_USER_NOTICE);
|
||||
}
|
||||
fclose($createLog);
|
||||
}
|
||||
|
||||
if (!is_writable($logFile)) {
|
||||
$chPerm = chmod($logFile, 777);
|
||||
|
||||
if (!$chPerm) {
|
||||
trigger_error("The $logFile file is not writable. CHMOD failed. Please manually set the chmod to 777!", E_USER_NOTICE);
|
||||
}
|
||||
}
|
||||
$logContents = file_get_contents($logFile);
|
||||
|
||||
foreach ($errors as $err) {
|
||||
$logContents.= $err . "\n";
|
||||
if($debug){
|
||||
trigger_error($err, E_USER_NOTICE);
|
||||
echo $err . "\n";
|
||||
}
|
||||
}
|
||||
$updateLog = file_put_contents($logFile, $logContents);
|
||||
|
||||
if (!$updateLog) {
|
||||
trigger_error("Unable to write errors to the log file of $logFile", E_USER_NOTICE);
|
||||
}
|
||||
}
|
||||
|
||||
// Create the database connection
|
||||
if(function_exists("mysql_connect")){
|
||||
$connection = mysql_connect($server, $login, $dbpass);
|
||||
if ($connection) {
|
||||
mysql_select_db($dbName, $connection);
|
||||
}
|
||||
}else{
|
||||
$connection = mysqli_connect($server, $login, $dbpass, $dbName);
|
||||
}
|
||||
|
||||
if(!$connection){
|
||||
$errToLog[] = 'Unable to connect to the EHCP MySQL database using provided credentials! Please update your config.php settings!';
|
||||
addToLog($errToLog);
|
||||
die('Unable to connect to the EHCP MySQL database using provided credentials! Please update your config.php settings!');
|
||||
}
|
||||
?>
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
<?php
|
||||
function execSQL($SQL, $connection){
|
||||
if($connection){
|
||||
if(function_exists("mysql_query")){
|
||||
return mysql_query($SQL, $connection);
|
||||
}else{
|
||||
return mysqli_query($connection, $SQL);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function countSQLResult($Result){
|
||||
if(function_exists("mysql_num_rows")){
|
||||
return mysql_num_rows($Result);
|
||||
}else{
|
||||
return mysqli_num_rows($Result);
|
||||
}
|
||||
}
|
||||
|
||||
function getSQLError($connection){
|
||||
if(function_exists("mysql_error")){
|
||||
return "Error code " . mysql_errno($connection) . ": " . mysql_error($connection);
|
||||
}else{
|
||||
return "Error code " . mysqli_errno($connection) . ": " . mysqli_error($connection);
|
||||
}
|
||||
}
|
||||
|
||||
function getSQLRow($Result){
|
||||
if(function_exists("mysql_fetch_assoc")){
|
||||
return mysql_fetch_assoc($Result);
|
||||
}else{
|
||||
return mysqli_fetch_assoc($Result);
|
||||
}
|
||||
}
|
||||
|
||||
function getSQLRowArray($Result){
|
||||
if(function_exists("mysql_fetch_row")){
|
||||
return mysql_fetch_row($Result);
|
||||
}else{
|
||||
return mysqli_fetch_row($Result);
|
||||
}
|
||||
}
|
||||
|
||||
function escapeSQLStr($str, $connection){
|
||||
if(function_exists("mysql_real_escape_string")){
|
||||
return mysql_real_escape_string($str);
|
||||
}else{
|
||||
return mysqli_real_escape_string($connection, $str);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
<?php
|
||||
if (file_exists("config.php")) {
|
||||
include 'config.php';
|
||||
} else {
|
||||
die("config.php must exist within the installation root folder!");
|
||||
}
|
||||
include_once 'db_functions.php';
|
||||
|
||||
// Deletes passed in user account from database
|
||||
|
||||
// Unless the actual delete command fails, success should be 1... we don't care if the account doesn't exist.
|
||||
$success = 1;
|
||||
$errorCount = 0;
|
||||
|
||||
if (isset($errors)) {
|
||||
unset($errors);
|
||||
}
|
||||
|
||||
if (isset($_GET['username'])) {
|
||||
$userToDelete = $_GET['username'];
|
||||
}
|
||||
|
||||
if (!isset($userToDelete)) {
|
||||
$errorCount++;
|
||||
$errors[] = "No username was passed to the form.";
|
||||
} else {
|
||||
$SQL = "SELECT ftpusername FROM ftpaccounts WHERE ftpusername = '$userToDelete'";
|
||||
$Result = execSQL($SQL, $connection);
|
||||
|
||||
if ($Result !== FALSE && countSQLResult($Result) == 1) {
|
||||
$row = getSQLRowArray($Result);
|
||||
$unameDeleted = $row[0];
|
||||
}else{
|
||||
$errorCount++;
|
||||
$errors[] = "The specified user $userToDelete does not exist within the databse. No actions were taken!";
|
||||
}
|
||||
|
||||
if (isset($unameDeleted)) {
|
||||
$SQL = "DELETE FROM ftpaccounts WHERE ftpusername = '$userToDelete'";
|
||||
$Result = execSQL($SQL, $connection);
|
||||
if ($Result !== FALSE) {
|
||||
$success = 1;
|
||||
} else {
|
||||
$errorCount++;
|
||||
$errors[] = getSQLError($connection);
|
||||
$success = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Log errors
|
||||
|
||||
if ($errorCount > 0) {
|
||||
addToLog($errors);
|
||||
}
|
||||
|
||||
// Return value:
|
||||
echo $success;
|
||||
?>
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
<?php
|
||||
// Returns a list of all custom FTP users
|
||||
// Only custom users are setup when tying into the EHCP FTP API
|
||||
$countNotNull = 0;
|
||||
$users_list = "";
|
||||
$success = 0;
|
||||
$errorCount = 0;
|
||||
|
||||
if (isset($errors)) {
|
||||
unset($errors);
|
||||
}
|
||||
|
||||
if (!isset($connection)) {
|
||||
include "config.php";
|
||||
}
|
||||
|
||||
include_once 'db_functions.php';
|
||||
|
||||
if (!isset($connection)) {
|
||||
die("Problem setting up connection!");
|
||||
} else {
|
||||
$SQL = "SELECT ftpusername, homedir, domainname, status FROM ftpaccounts";
|
||||
$Result = execSQL($SQL, $connection);
|
||||
|
||||
if ($Result !== FALSE) {
|
||||
$count = countSQLResult($Result);
|
||||
|
||||
if ($count > 0) {
|
||||
|
||||
while ($row = getSQLRow($Result)) {
|
||||
|
||||
// Only show custom entries... do not allow to modify EHCP accounts.
|
||||
// domainname field will be NULL for custom FTP entries
|
||||
|
||||
if (!empty($row['homedir']) && (empty($row['domainname']) || $row['domainname'] === NULL) && (empty($row['status']) || $row['status'] === NULL)) {
|
||||
$countNotNull++;
|
||||
$username = $row['ftpusername'];
|
||||
$dir = $row['homedir'];
|
||||
$users_list.= $username . "\t" . $dir . "/./\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ($countNotNull == 0) {
|
||||
$errorCount++;
|
||||
$errors[] = "There are no custom FTP accounts yet in the EHCP database!";
|
||||
}
|
||||
} else {
|
||||
$errorCount++;
|
||||
$errors[] = "No FTP accounts exist from the ftpaccounts table!";
|
||||
}
|
||||
} else {
|
||||
$errorCount++;
|
||||
$errors[] = getSQLError($connection);
|
||||
$success = 0;
|
||||
}
|
||||
|
||||
// Log errors
|
||||
|
||||
if ($errorCount > 0) {
|
||||
addToLog($errors);
|
||||
}
|
||||
}
|
||||
|
||||
// Return the user list
|
||||
echo $users_list;
|
||||
?>
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
<?php
|
||||
$countNotNull = 0;
|
||||
$user_details = "";
|
||||
$success = 0;
|
||||
$errorCount = 0;
|
||||
|
||||
if (isset($errors)) {
|
||||
unset($errors);
|
||||
}
|
||||
|
||||
if (!isset($connection)) {
|
||||
include "config.php";
|
||||
}
|
||||
|
||||
include_once 'db_functions.php';
|
||||
|
||||
if (isset($_GET['username'])) {
|
||||
$ftp_account = $_GET['username'];
|
||||
}
|
||||
|
||||
if (!isset($connection)) {
|
||||
die("Problem setting up connection!");
|
||||
} else
|
||||
if (isset($ftp_account)) {
|
||||
$SQL = "SELECT ftpusername, homedir FROM ftpaccounts WHERE ftpusername = '$ftp_account'";
|
||||
$Result = execSQL($SQL, $connection);
|
||||
|
||||
if ($Result !== FALSE) {
|
||||
$count = countSQLResult($Result);
|
||||
|
||||
if ($count == 1) {
|
||||
if ($row = getSQLRow($Result)) {
|
||||
// Only show custom entries... do not allow to modify EHCP accounts.
|
||||
if (!empty($row['homedir'])) {
|
||||
$countNotNull++;
|
||||
$username = $row['ftpusername'];
|
||||
$dir = $row['homedir'];
|
||||
$user_details.= "Username" . " : " . $username . "\n";
|
||||
$user_details.= "Directory" . " : " . $dir . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ($countNotNull == 0) {
|
||||
$errorCount++;
|
||||
$errors[] = "There are no custom FTP accounts yet in the EHCP database!";
|
||||
}
|
||||
} else {
|
||||
$errorCount++;
|
||||
$errors[] = "No FTP accounts exist with the given username of $ftp_account";
|
||||
}
|
||||
} else {
|
||||
$errorCount++;
|
||||
$errors[] = getSQLError($connection);
|
||||
$success = 0;
|
||||
}
|
||||
|
||||
// Log errors
|
||||
|
||||
if ($errorCount > 0) {
|
||||
addToLog($errors);
|
||||
}
|
||||
}
|
||||
|
||||
// Return the user list
|
||||
echo $user_details;
|
||||
?>
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
$curDir = getcwd();
|
||||
if(chdir("/var/www/new/ehcp/")){
|
||||
require ("classapp.php");
|
||||
$app = new Application();
|
||||
$app->connectTodb(); # fill config.php with db user/pass for things to work..
|
||||
|
||||
$app->addDaemonOp('syncftp', '', '', '', 'sync ftp for nonstandard homes');
|
||||
}
|
||||
chdir($curDir);
|
||||
?>
|
||||
|
|
@ -1,144 +0,0 @@
|
|||
<?php
|
||||
if (file_exists("config.php")) {
|
||||
include 'config.php';
|
||||
} else {
|
||||
die("config.php must exist within the installation root folder!");
|
||||
}
|
||||
|
||||
include_once 'db_functions.php';
|
||||
|
||||
// Updates ftpuser's password
|
||||
$success = 0;
|
||||
$errorCount = 0;
|
||||
|
||||
if (isset($errors)) {
|
||||
unset($errors);
|
||||
}
|
||||
|
||||
if (isset($_GET['username'])) {
|
||||
$ftp_username = $_GET['username'];
|
||||
}
|
||||
|
||||
if (isset($_GET['password'])) {
|
||||
$arrOfVals = trim($_GET['password']);
|
||||
}
|
||||
|
||||
if (isset($arrOfVals) && !empty($arrOfVals)) {
|
||||
$arrOfVals = explode("\n", $arrOfVals);
|
||||
$arrOfVals = array_filter($arrOfVals);
|
||||
|
||||
foreach ($arrOfVals as $passIn) {
|
||||
$passIn = trim($passIn);
|
||||
|
||||
// Replace all tabs or spaces
|
||||
$pattern = '/\s+/';
|
||||
$passIn = preg_replace($pattern, ' ', $passIn);
|
||||
$keyAndVal = explode(' ', $passIn);
|
||||
|
||||
if (count($keyAndVal) == 2) {
|
||||
$arr[$keyAndVal[0]] = $keyAndVal[1];
|
||||
}
|
||||
|
||||
if (isset($arr['new_password']) && !empty($arr['new_password'])) {
|
||||
$ftp_pass = $arr['new_password'];
|
||||
}
|
||||
|
||||
if (isset($arr['Directory']) && !empty($arr['Directory'])) {
|
||||
$update_dir = $arr['Directory'];
|
||||
}
|
||||
|
||||
if (isset($arr['orig_user']) && !empty($arr['orig_user'])) {
|
||||
$ftp_old_username = $arr['orig_user'];
|
||||
}
|
||||
|
||||
if (isset($arr['Username']) && !empty($arr['Username'])) {
|
||||
$ftp_username = $arr['Username'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($ftp_username) || !isset($update_dir)) {
|
||||
$errorCount++;
|
||||
$errors[] = "No FTP accounts could be modified! Updated username and homedir were not sent by the panel.";
|
||||
} else {
|
||||
|
||||
if (substr_count($update_dir, '/') < 2) {
|
||||
$errorCount++;
|
||||
$errors[] = "In order to prevent security risks, users cannot be granted access to the main directories in the root file system of the server. You must go down two directory levels! Example: /games/user1!";
|
||||
}
|
||||
|
||||
if (stripos($update_dir, "/") === FALSE || stripos($update_dir, "/") != 0) {
|
||||
$errorCount++;
|
||||
$errors[] = "You have not chosen a valid directory!";
|
||||
}
|
||||
|
||||
if ($update_dir === "/var/www/" || stripos($update_dir, "/var/www/") !== FALSE) {
|
||||
$errorCount++;
|
||||
$errors[] = "You may not create ftp accounts into the protected EHCP directories using this program. Create these accounts using EHCP software.";
|
||||
}
|
||||
|
||||
if (stripos($update_dir, "\\")) {
|
||||
$errorCount++;
|
||||
$errors[] = "This is not a Windows machine... use the correct slash character for path...";
|
||||
}
|
||||
|
||||
// If the last character in the path is a slash (/) - Remove it from the string
|
||||
|
||||
if (substr_count($update_dir, '/') > 2 && $update_dir[strlen($update_dir) - 1] == "/") {
|
||||
$end = strlen($update_dir) - 1;
|
||||
$update_dir = substr($update_dir, 0, $end);
|
||||
}
|
||||
|
||||
if ($errorCount == 0) {
|
||||
|
||||
// Security checks
|
||||
|
||||
if (isset($ftp_pass)) {
|
||||
$ftp_password_db = escapeSQLStr($ftp_pass, $connection);
|
||||
}
|
||||
|
||||
$ftp_username_db = escapeSQLStr($ftp_username, $connection);
|
||||
|
||||
$SQL = "SELECT * FROM ftpaccounts WHERE ftpusername = '$ftp_username_db'";
|
||||
|
||||
$Result = execSQL($SQL, $connection);
|
||||
|
||||
if ($Result !== FALSE) {
|
||||
$count = countSQLResult($Result);
|
||||
if ($count != 1) {
|
||||
$errorCount++;
|
||||
$errors[] = "FTP User " . $ftp_username . " does not exist in the database. Account information cannot be updated";
|
||||
} else {
|
||||
|
||||
// Update user's password data into DB:
|
||||
$SQL = "UPDATE ftpaccounts SET ";
|
||||
|
||||
if (isset($ftp_password_db)) {
|
||||
$SQL.= "password=password('$ftp_password_db'), ";
|
||||
}
|
||||
$SQL.= "homedir='$update_dir' WHERE ftpusername='$ftp_username_db'";
|
||||
$Result = execSQL($SQL, $connection);
|
||||
|
||||
if ($Result !== FALSE) {
|
||||
$success = 1;
|
||||
} else {
|
||||
$errorCount++;
|
||||
$errors[] = getSQLError($connection);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$errorCount++;
|
||||
$errors[] = getSQLError($connection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Log errors
|
||||
|
||||
if ($errorCount > 0) {
|
||||
addToLog($errors);
|
||||
}
|
||||
|
||||
// Return value:
|
||||
echo $success;
|
||||
?>
|
||||
|
|
@ -1,76 +0,0 @@
|
|||
<?php
|
||||
if (file_exists("config.php")) {
|
||||
include 'config.php';
|
||||
} else {
|
||||
die("config.php must exist within the installation root folder!");
|
||||
}
|
||||
|
||||
include_once 'db_functions.php';
|
||||
|
||||
// Updates ftpuser's password
|
||||
$success = 0;
|
||||
$errorCount = 0;
|
||||
|
||||
if (isset($errors)) {
|
||||
unset($errors);
|
||||
}
|
||||
|
||||
if (isset($_GET['username'])) {
|
||||
$ftp_username = $_GET['username'];
|
||||
}
|
||||
|
||||
if (isset($_GET['password'])) {
|
||||
$ftp_pass = trim($_GET['password']);
|
||||
}
|
||||
|
||||
if (!isset($ftp_username) || !isset($ftp_pass)) {
|
||||
$errorCount++;
|
||||
$errors[] = "No FTP accounts could be modified! Updated username and password were not sent by the OGP upload functions.";
|
||||
} else {
|
||||
|
||||
if ($errorCount == 0) {
|
||||
|
||||
// Security checks
|
||||
$ftp_password_db = escapeSQLStr($ftp_pass, $connection);
|
||||
$ftp_username_db = escapeSQLStr($ftp_username, $connection);
|
||||
$SQL = "SELECT * FROM ftpaccounts WHERE ftpusername = '$ftp_username_db'";
|
||||
$Result = execSQL($SQL, $connection);
|
||||
|
||||
if ($Result !== FALSE) {
|
||||
$count = countSQLResult($Result);
|
||||
|
||||
if ($count != 1) {
|
||||
$errorCount++;
|
||||
$errors[] = "The account information was not updated because the FTP username $ftp_old_username never existed in the first place and cannot be modified";
|
||||
} else {
|
||||
|
||||
if ($row = getSQLRow($Result)) {
|
||||
$recordID = $row['id'];
|
||||
}
|
||||
|
||||
// Update user's password data into DB:
|
||||
$SQL = "UPDATE ftpaccounts SET password=password('$ftp_password_db') WHERE ftpusername='$ftp_username_db'";
|
||||
$Result = execSQL($SQL, $connection);
|
||||
|
||||
if ($Result !== FALSE) {
|
||||
$success = 1;
|
||||
} else {
|
||||
$errorCount++;
|
||||
$errors[] = getSQLError($connection);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$errorCount++;
|
||||
$errors[] = getSQLError($connection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Log errors
|
||||
if ($errorCount > 0) {
|
||||
addToLog($errors);
|
||||
}
|
||||
|
||||
// Return value:
|
||||
echo $success;
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue