function runDeleteDatabase($dbs) { $db = new Database(); $conn = $db->connectDatabase(); foreach ($dbs as $dbName) { $db->deleteDatabase($conn, $dbName); } }
function remove($dbs) { echo "Remove Duplicate Row\n\n"; $db = new Database(); $conn = $db->connectDatabase(); foreach ($dbs as $dbname) { $db->selectDatabase($conn, $dbname); $db->createTmpTable($conn, "products"); $db->insertIntoTmp($conn, "products"); $db->dropTable($conn, "products"); $db->renameTable($conn, "products"); echo $dbname . "\n"; } }
function deleteDatabase() { $db = new Database(); $conn = $db->connectDatabase(); $db->deleteDatabase($conn, $this->databaseName()); }
<?php require_once "../../include/config.php"; require "../database/Database.php"; require "Customer.php"; $db = new Database(); $db->connectDatabase(); //Check if the POST variable 'redirectType' is not null and if it isnt equals to logout if (isset($_POST['redirectType']) && strtolower($_POST['redirectType']) != "logout") { //Check if the user hasn't been logged in already. if (!isset($_SESSION['customer'])) { //Get the user details from the database. This can return null or it can return details. $user = $db->getCustomer($_POST['username'], $_POST['password']); //Switch through the post of redirectType switch (strtolower($_POST['redirectType'])) { //If the redirectType is login. case "login": if (!empty($user)) { new Customer($user); header("Location: http://" . $_SERVER['SERVER_NAME'] . "/faseovergang/index.php"); } else { echo "Invalid credentials"; } break; //If the redirectType is register. //If the redirectType is register. case "register": if (empty($user)) { $db->addCustomer($_POST['username'], $_POST['password']); header("Location: http://" . $_SERVER['SERVER_NAME'] . "/faseovergang/index.php?page=login"); } else {