public function __construct() { $this->_dbConnection = dbUtils::getConnection(); $this->_connection = $this->_dbConnection->open_db_connection(); date_default_timezone_set('America/Los_Angeles'); // all times are in PST }
$db_config = "../views/dbParameters.txt"; $db_handle = fopen($db_config, "w") or die("can't open file"); fwrite($db_handle, $data); fclose($db_handle); $db_config = "../setup/dbParameters.txt"; $db_handle = fopen($db_config, "w") or die("can't open file"); fwrite($db_handle, $data); fclose($db_handle); // writes constants $constantsData = "<?php\n\$schoolName = \"{$school_name}\";\n\$teamName = \"{$team_name}\";\n?>"; $constants = "../views/constants.php"; $db_handle = fopen($constants, "w") or die("can't open file"); fwrite($db_handle, $constantsData); fclose($db_handle); // sets up the table and database $dbConfig = dbUtils::getPropertiesConnection(); $register = new register(); $phonenumber = "N/A"; $dbConfig->createDatabase($db_name); // setting up tables include "dbConfig.php"; // registering mentor $register->register($mentor_name, $mentor_pass, $phonenumber, "Mentor"); echo "<div id=\"contentContainer\">\n\n\t\t<div class=\"header\">\n\t\t\t<!-- Install Purchase Order System -->\n\t\t</div>\n\n\t\t<div class=\"content\">"; echo "The PO system has been installed successfully. You may now log in <a href=\"../index.php\">here</a>."; echo "</div> <!--end content-->"; echo "</div>"; } else { echo "<div id=\"contentContainer\">\n\n\t\t<div class=\"header\">\n\t\t\t<!-- Install Purchase Order System -->\n\t\t</div>\n\n\t\t<div class=\"content\">"; echo "<center>"; echo "<table border=\"0\" width=\"400\"><tr><td>";
public function __construct() { $this->_serverurl = "http://robo.harker.org/"; $this->_dbConnection = dbUtils::getConnection(); $this->_connection = $this->_dbConnection->open_db_connection(); }
public function __construct() { $this->_dbConnection = dbUtils::getConnection(); $this->_connection = $this->_dbConnection->open_db_connection(); }
public function __construct() { $this->_dbConnection = dbUtils::getConnection(); $this->_connection = $this->_dbConnection->open_db_connection(); //$this->_nonRelationalDbConnection= dbUtils::getNonRelationalConnection(); }
/** * This is a small procedural page to set the activated field for the user's account */ // autoloader code // loads classes as needed, eliminates the need for a long list of includes at the top spl_autoload_register(function ($className) { $possibilities = array('../controllers' . DIRECTORY_SEPARATOR . $className . '.php', '../back_end' . DIRECTORY_SEPARATOR . $className . '.php', '../views' . DIRECTORY_SEPARATOR . $className . '.php', $className . '.php'); foreach ($possibilities as $file) { if (file_exists($file)) { require_once $file; return true; } } return false; }); $dbConnection = dbUtils::getConnection(); $resourceid = $dbConnection->selectFromTable("RoboUsers", "ActivationCode", $acode); $arr = $dbConnection->formatQueryResults($resourceid, "ActivationCode"); // this runs if the activation code is not in the database, which is what happens after a user activates his/her account for the first time. if (empty($arr) || is_null($arr[0])) { error_log("This account has already been activated."); echo 'This account has already been activated.'; return false; // cuts execution early } $bool = 1; // any nonzero value to indicated activated status $stuffing = "Activated"; // clears the activation code field for clarity $array = array("Activated" => $bool, "ActivationCode" => $stuffing); $dbConnection->updateTable("RoboUsers", "RoboUsers", "ActivationCode", $code, "UserID", $array, "ActivationCode = '{$code}'");
<?php /** * Created by PhpStorm. * User: peter wasonga * Date: 10/13/2015 * Time: 11:33 PM */ require_once 'dbUtils.php'; $db = new dbUtils(); $request = $_GET["q"]; if ($request == "byAge") { $response = $db->getAgeGroup('*', '*'); } elseif ($request == "byGender") { $response = $db->getGender('*', '*'); } elseif ($request == "byBloodGroupAplus") { $response = $db->getBloodGroup('APlus'); } elseif ($request == "byRegion") { $response = $db->getRegions('*'); } elseif ($request == "byTotalRequest") { $response = $db->getTotalRequest(); } elseif ($request == "byTotalMale") { $response = $db->getTotalMale(); } elseif ($request == "byTotalFemale") { $response = $db->getTotalFemale(); } echo json_encode($response);