|
@@ -24,11 +24,12 @@ if (isset($errors)) {
|
|
|
|
|
|
|
|
if (file_exists("config.php")) {
|
|
if (file_exists("config.php")) {
|
|
|
include 'config.php';
|
|
include 'config.php';
|
|
|
- mysql_select_db($dbName, $connection);
|
|
|
|
|
} else {
|
|
} else {
|
|
|
die("config.php must exist within the installation root folder!");
|
|
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?
|
|
// Did we properly receive the variables from the OGP agent?
|
|
|
|
|
|
|
|
if (isset($ftp_username) && isset($ftp_pass) && isset($rDir)) {
|
|
if (isset($ftp_username) && isset($ftp_pass) && isset($rDir)) {
|
|
@@ -72,14 +73,14 @@ if (isset($ftp_username) && isset($ftp_pass) && isset($rDir)) {
|
|
|
if ($errorCount == 0) {
|
|
if ($errorCount == 0) {
|
|
|
|
|
|
|
|
// Security checks
|
|
// Security checks
|
|
|
- $ftp_password_db = mysql_real_escape_string($ftp_pass);
|
|
|
|
|
- $ftp_username_db = mysql_real_escape_string($ftp_username);
|
|
|
|
|
- $rDir = mysql_real_escape_string($rDir);
|
|
|
|
|
|
|
+ $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'";
|
|
$SQL = "SELECT id FROM ftpaccounts WHERE ftpusername = '$ftp_username_db'";
|
|
|
- $Result = mysql_query($SQL, $connection);
|
|
|
|
|
|
|
+ $Result = execSQL($SQL, $connection);
|
|
|
|
|
|
|
|
if ($Result !== FALSE) {
|
|
if ($Result !== FALSE) {
|
|
|
- $count = mysql_num_rows($Result);
|
|
|
|
|
|
|
+ $count = countSQLResult($Result);
|
|
|
|
|
|
|
|
if ($count > 0) {
|
|
if ($count > 0) {
|
|
|
$errorCount++;
|
|
$errorCount++;
|
|
@@ -88,24 +89,24 @@ if (isset($ftp_username) && isset($ftp_pass) && isset($rDir)) {
|
|
|
|
|
|
|
|
// Make sure data enter is unique for homedir
|
|
// Make sure data enter is unique for homedir
|
|
|
$SQL = "SELECT id FROM ftpaccounts WHERE homedir = '$rDir'";
|
|
$SQL = "SELECT id FROM ftpaccounts WHERE homedir = '$rDir'";
|
|
|
- $Result = mysql_query($SQL, $connection);
|
|
|
|
|
|
|
+ $Result = execSQL($SQL, $connection);
|
|
|
|
|
|
|
|
if ($Result !== FALSE) {
|
|
if ($Result !== FALSE) {
|
|
|
- $count = mysql_num_rows($Result);
|
|
|
|
|
|
|
+ $count = countSQLResult($Result);
|
|
|
|
|
|
|
|
// Insert the data into the
|
|
// Insert the data into the
|
|
|
$SQL = "INSERT INTO ftpaccounts (ftpusername, password, homedir) VALUES ('$ftp_username_db', password('$ftp_password_db'), '$rDir')";
|
|
$SQL = "INSERT INTO ftpaccounts (ftpusername, password, homedir) VALUES ('$ftp_username_db', password('$ftp_password_db'), '$rDir')";
|
|
|
- $Result = mysql_query($SQL, $connection);
|
|
|
|
|
|
|
+ $Result = execSQL($SQL, $connection);
|
|
|
|
|
|
|
|
if ($Result !== FALSE) {
|
|
if ($Result !== FALSE) {
|
|
|
$success = 1;
|
|
$success = 1;
|
|
|
} else {
|
|
} else {
|
|
|
$errorCount++;
|
|
$errorCount++;
|
|
|
- $errors[] = "Error code " . mysql_errno($connection) . ": " . mysql_error($connection);
|
|
|
|
|
|
|
+ $errors[] = getSQLError($connection);
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
$errorCount++;
|
|
$errorCount++;
|
|
|
- $errors[] = "Error code " . mysql_errno($connection) . ": " . mysql_error($connection);
|
|
|
|
|
|
|
+ $errors[] = getSQLError($connection);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if ($errorCount > 0 && $success == 0) {
|
|
if ($errorCount > 0 && $success == 0) {
|
|
@@ -115,7 +116,7 @@ if (isset($ftp_username) && isset($ftp_pass) && isset($rDir)) {
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
$errorCount++;
|
|
$errorCount++;
|
|
|
- $errors[] = "Error code " . mysql_errno($connection) . ": " . mysql_error($connection);
|
|
|
|
|
|
|
+ $errors[] = getSQLError($connection);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|