\n" . "\n" . "\n"; return $js; } function display_error($msg, $center=true) { echo "
$msg

\n"; } function display_notification($msg, $center=true) { echo "
$msg

\n"; } function db_open($conn) { $db = mysql_connect($conn["host"] ,$conn["dbuser"], $conn["dbpassword"]); if (!$db) return false; if (!mysql_select_db($conn["dbname"], $db)) return false; return $db; } echo "\n"; echo "$title\n"; echo "\n"; echo "\n"; echo $js; echo " \n"; echo ""; echo "



"; echo "\n"; echo "\n"; echo "
FrontAccounting
\n"; echo "

"; echo "
$title
\n"; echo "
"; if (isset($_POST["submit"])) { if (!isset($_FILES['uploadfile']['tmp_name']) || !is_uploaded_file($_FILES['uploadfile']['tmp_name'])) { display_error("You must select an SQL script for update");; } else { include_once($path_to_root."/config_db.php"); if (!isset($_POST['user']) || !isset($_POST['passwd']) || $_POST['user'] == "") { display_error("You must select a user name and an optional password"); } else { foreach($db_connections as $id => $conn) { $conn['dbuser'] = $_POST['user']; $conn['dbpassword'] = $_POST['passwd']; if (!($db = db_open($conn))) { display_error("Wrong user name or password - ".mysql_error()); } else { if (!db_import($_FILES['uploadfile']['tmp_name'], $conn)) display_error("Bad SQL file or you have already updated the company: " . $id . " " . $conn['name']." - ".mysql_error()); else display_notification("Database has been updated for company: " . $id . " " . $conn['name']); } } } } } if (!isset($_POST['passwd'])) $_POST['passwd'] = ""; echo "
\n"; echo "\n"; text_row_ex("Database User", "user", 20); label_row("Password", ""); label_row("Upload Script", ""); submit_row("submit", "Update"); echo "
\n";; echo "

"; echo "
Choose from Database update scripts in SQL folder. No Datase is updated without a script.
\n"; echo "
"; echo "
\n"; echo "\n"; ?>