コード例 #1
0
ファイル: form2_1.php プロジェクト: rubberturtle/cs148
<?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;
//%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%
//
コード例 #2
0
ファイル: q06.php プロジェクト: rubberturtle/cs148
        <![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
コード例 #3
0
ファイル: populate-table.php プロジェクト: rubberturtle/cs148
$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
コード例 #4
0
ファイル: sfDatabaseTest.php プロジェクト: Phennim/symfony1
<?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');
コード例 #5
0
$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);
コード例 #6
0
ファイル: form.php プロジェクト: kyrabevins/cs148class
<?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
コード例 #7
0
ファイル: tables.php プロジェクト: rubberturtle/cs148
<?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);