public function testConnectSave() { $conn = self::$connection; $this->assertInstanceOf('TrackMePDO', connect_save($conn)); $conn["user"] = "******"; $this->assertNull(connect_save($conn)); }
<?php session_start(); require_once "database.php"; require_once "exporter/base.php"; // DMR didn't see where this was used so removed. // $requireddb = urldecode($_GET["db"]); // if ( $requireddb == "" || $requireddb < 7 ) // { // echo "<Result>5</Result>"; // die; // } $db = connect_save(); if (is_null($db)) { echo "<Result>4</Result>"; die; } $showbearings = 0; if (!isset($_SESSION["ID"])) { echo "<Result>Not Logged in or this is not a private system</Result>"; die; } $action = $_GET["a"]; // $username = urldecode($_GET["u"]); // $password = urldecode($_GET["p"]); $datefrom = urldecode($_GET["df"]); $dateto = urldecode($_GET["dt"]); $showbearings = urldecode($_GET["sb"]); $userid = $_SESSION["ID"]; $tripid = Exporter::normalize($db, $userid, $_GET); if ($action == "kml") {
$folder = $_POST["folder"]; $apikey = $_POST["googleapikey"]; $googleanalyticsaccount = $_POST["googleanalyticsaccount"]; $googleview = $_POST["googleview"]; $showmap = $_POST["showmap"]; $username = $_POST["username"]; $bgcolor = $_POST["bgcolor"]; $mapwidth = trim($_POST["mapwidth"], " px") . "px"; $mapheight = trim($_POST["mapheight"], " px") . "px"; $mapborder = trim($_POST["mapborder"], " px") . "px"; $bordercolor = $_POST["bordercolor"]; $mapalign = $_POST["mapalign"]; $date_format = $_POST["date_format"]; $html .= " </div>\n"; $connection = array('host' => $dbserver, 'name' => $dbname, 'user' => $dbuser, 'pass' => $dbpassword); $db = connect_save($connection); if (is_null($db)) { $html .= "ERROR: Failed to connect to database."; print $html; die; } if ($installtype == "newinstall") { $sql = file_get_contents("database.sql"); $db->exec($sql); // $html .= "Install Type: $installtype<br>\n"; $html .= "Database tables created successfully<br>\n"; } else { //will sql updates here in needed. // $html .= "Install Type: $installtype<br>\n"; $html .= "Database updated successfully<br>\n"; }