<?php include "top.php"; //%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^% // // SECTION: 1 Initialize variables // // SECTION: 1a. // variables for the classroom purposes to help find errors. require_once '../bin/myDatabase.php'; $dbUserName = get_current_user() . '_reader'; $whichPass = "******"; //flag for which one to use. $dbName = strtoupper(get_current_user()) . '_UVM_Courses'; $thisDatabase = new myDatabase($dbUserName, $whichPass, $dbName); $debug = false; if (isset($_GET["debug"])) { // ONLY do this in a classroom environment $debug = true; } if ($debug) { print "<p>DEBUG MODE IS ON</p>"; } //%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^% // // SECTION: 1b Security // // define security variable to be used in SECTION 2a. $yourURL = $domain . $phpSelf; //%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^% //
<![endif]--> </head> <?php /* ##### Step one * * create your database object using the appropriate database username */ require_once '../bin/myDatabase.php'; $dbUserName = get_current_user() . '_reader'; $whichPass = "******"; //flag for which one to use. $dbName = strtoupper(get_current_user()) . '_UVM_Courses'; $thisDatabase = new myDatabase($dbUserName, $whichPass, $dbName); /* ##### html setup */ $phpSelf = htmlentities($_SERVER['PHP_SELF'], ENT_QUOTES, "UTF-8"); $path_parts = pathinfo($phpSelf); print '<body id="' . $path_parts['filename'] . '">'; /* ##### Step two * * open the file that contains the query */ $myfile = fopen("q06.sql", "r") or die("Unable to open file!"); $query = fread($myfile, filesize("q06.sql")); /* ##### Step three * Execute the query * */ $results = $thisDatabase->select($query); /* ##### Step four
$outputBuffer[] = ""; $debug = false; if (isset($_GET["debug"])) { $debug = true; } if ($debug) { print "<p>DEBUG MODE IS ON</p>"; } // include libraries require_once '../bin/myDatabase.php'; // set up variables for database $dbUserName = get_current_user() . '_admin'; $whichPass = "******"; //flag for which one to use. $dbName = strtoupper(get_current_user()) . '_UVM_Courses'; $thisDatabase = new myDatabase($dbUserName, $whichPass, $dbName); // Process file $file = fopen($url, "r"); /* the variable $url will be empty or false if the file does not open */ if ($file) { if ($debug) { print "<p>File Opened. Begin reading data into an array.</p>\n"; } /* This reads the first row which in our case is the column headers: * Subj # Title Comp Numb Sec Lec Lab Camp Code * Max Enrollment Current Enrollment Start Time End Time * Days Credits Bldg Room Instructor NetId Email */ $headers = fgetcsv($file); /* the while loop keeps exectuing until we reach the end of the file at * which point it stops. the resulting variable $records is an array with
<?php /* * This file is part of the symfony package. * (c) 2004-2006 Fabien Potencier <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ require_once __DIR__ . '/../../bootstrap/unit.php'; require_once $_test_dir . '/unit/sfContextMock.class.php'; $t = new lime_test(10); class myDatabase extends sfDatabase { function connect() { } function shutdown() { } } $context = sfContext::getInstance(); $database = new myDatabase(); $database->initialize($context); // parameter holder proxy require_once $_test_dir . '/unit/sfParameterHolderTest.class.php'; $pht = new sfParameterHolderProxyTest($t); $pht->launchTests($database, 'parameter');
$outputBuffer[] = ""; $debug = false; if (isset($_GET["debug"])) { $debug = true; } if ($debug) { print "<p>DEBUG MODE IS ON</p>"; } // include libraries require_once '../bin/myDatabase.php'; // set up variables for database $dbUserName = get_current_user() . '_admin'; $whichPass = "******"; //flag for which one to use. $dbName = strtoupper(get_current_user()) . '_UVM_Courses'; $thisDatabase = new myDatabase($dbUserName, $whichPass, $dbName); // -- Table structure for table `tblSections` $query = "DROP TABLE IF EXISTS tblEnrolls"; $results = $thisDatabase->delete($query); $query = "CREATE TABLE IF NOT EXISTS tblEnrolls ( "; $query .= "fnkCourseId int(11) NOT NULL, "; $query .= "fnkSectionId int(11) NOT NULL, "; $query .= "fnkStudentId int(11) NOT NULL, "; $query .= "fldGrade int(11) NOT NULL, "; $query .= "PRIMARY KEY (`fnkCourseId`,`fnkSectionId`,`fnkStudentId`)"; $query .= ") ENGINE=InnoDB DEFAULT CHARSET=utf8"; $results = $thisDatabase->insert($query); print "<p>tblEnrolls Created.</p>"; //get all the student id numbers $query = "SELECT pmkStudentId, 0 as numClasses FROM tblStudents"; $allStudents = $thisDatabase->select($query);
<?php include "top.php"; //%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^% require_once '../bin/myDatabase.php'; $dbUserName = get_current_user() . '_writer'; $whichPass = "******"; //flag for which one to use. $dbName = strtoupper(get_current_user()) . '_advising'; $thisDatabase = new myDatabase($dbUserName, $whichPass, $dbName); // SECTION: 1 Initialize variables // // SECTION: 1a. // variables for the classroom purposes to help find errors. $debug = false; if (isset($_GET["debug"])) { // ONLY do this in a classroom environment $debug = true; } if ($debug) { print "<p>DEBUG MODE IS ON</p>"; } //%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^% // // SECTION: 1b Security // // define security variable to be used in SECTION 2a. $yourURL = $domain . $phpSelf; //%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^% // // SECTION: 1c form variables
<?php $debug = false; //############################################################################ // // This page lists your tables and fields within your database. if you click on // a database name it will show you all the records for that table. // //############################################################################ require_once '../bin/myDatabase.php'; // set up variables for database $dbUserName = get_current_user() . '_reader'; $whichPass = "******"; //flag for which one to use. $dbName = strtoupper(get_current_user()) . '_UVM_Courses'; $thisDatabase = new myDatabase($dbUserName, $whichPass, $dbName); $phpSelf = htmlentities($_SERVER['PHP_SELF'], ENT_QUOTES, "UTF-8"); $path_parts = pathinfo($phpSelf); print '<body id="' . $path_parts['filename'] . '">'; $tableName = ""; if (isset($_GET['getRecordsFor'])) { // Sanitize the input to help prevent sql injection $tableName = htmlentities($_GET['getRecordsFor'], ENT_QUOTES); } print "<h2>Database: " . $dbName . "</h2>"; // print out a list of all the tables and their description // make each table name a link to display the record print "<section id='tables2'>"; print "<table>"; $query = "SHOW TABLES"; $results = $thisDatabase->select($query);