2 && $update_dir[strlen($update_dir) - 1] == "/") { $end = strlen($update_dir) - 2; $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; ?>