Пример #1
0
function dropDownQueryForRental($attr_name, $table, $target)
{
    echo "<h2> Rent Equipment </h2>";
    echo "<form method=\"POST\" action=\"" . $target . "\"><select name =\"equip\">";
    echo "<option value=\"\">Select...</option>";
    $string = "select " . $attr_name . " from " . $table;
    $result = executePlainSQL($string);
    while ($row = OCI_Fetch_Array($result, OCI_BOTH)) {
        echo "<option value=\"" . $row[0] . "\">" . $row[0] . "</option>";
    }
    echo "<input type=\"text\" value=\"Quantity...\" name=\"qty\">";
    echo "<input type=\"text\" value=\"Member ID\" name=\"memID\">";
    echo "</select><input type=\"submit\" class=\"pure-button\" value=\"Rent\">";
    echo "</form>";
}
Пример #2
0
function populateTables()
{
    require 'setup.php';
    echo "<b>Populating tables...</b> <br>";
    // execute all "INSERT INTO" SQL statements in setup.php
    foreach ($insertArray as &$subArray) {
        foreach ($subArray as &$subStatement) {
            global $db_conn;
            // for variable scope in inner loop
            executePlainSQL($subStatement);
            global $verbose;
            if ($verbose) {
                echo $subStatement . "<br>";
            }
            OCICommit($db_conn);
        }
        if ($verbose) {
            echo "<br>";
        }
    }
}
Пример #3
0
            } else {
                $update_pw_q = "UPDATE Customer SET password = '******'new_pw'] . "' WHERE cid = " . $cid;
                executePlainSQL($update_pw_q);
                OCICommit($db_conn);
                ?>
				<script type="text/javascript"> 
					alert("Password successfully updated!");
					location: "profile.php";
				</script>
				<?php 
            }
        }
    }
    // Fetch the customer profile based on the cid from cookies
    $q = "select * from Customer where cid = '" . $cid . "'";
    $result = executePlainSQL($q);
    $row = OCI_Fetch_Array($result, OCI_BOTH);
    $cname = $row['CNAME'];
    $email = $row['EMAIL'];
    $addr = $row['ADDRESS'];
    $phone = $row['PHONE'];
    $passport_country = $row['PASSPORT_COUNTRY'];
    $passport_num = $row['PASSPORT_NUM'];
    OCILogoff($db_conn);
}
?>
<div class="content-customer-area">

<p>Edit your profile:</p>
<form class="pure-form pure-form-aligned" method="POST" action="profile.php">
    <fieldset>
Пример #4
0
function printLayOver($firstid, $secondid)
{
    $layover = oci_fetch_row(executePlainSQL("select F2.departtime-F1.arrivaltime from Flight F1, Flight F2\n\t\t\t\t\t\t\t\t\twhere F1.fid='{$firstid}' AND F2.fid='{$secondid}'"));
    $layovertime = parseDate($layover[0], 2);
    echo "<br>Lay over for {$layovertime}";
}
Пример #5
0
        // Insert reservation tuple into make_res
        // (resid, cid, pclass, ticket_num)
        executePlainSQL("insert into make_res values (\r\n\t\t\t\t\t\tresid_sequence.nextval," . $_COOKIE['cid'] . "," . $_POST['makeres_classint'] . "," . $_POST['makeres_numtickets'] . ")");
        OCICommit($db_conn);
        // res_includes(fid, resid, resorder)
        $fids = array($_POST['fid1'], $_POST['fid2'], $_POST['fid3']);
        foreach ($fids as $key => $value) {
            //echo $fids[$key]."<br>";
            if ($fids[$key] != "") {
                executePlainSQL("insert into res_includes values (" . $value . ",\r\n\t\t\t\t\tresid_sequence.currval," . number_format($key + 1) . ")");
            }
        }
        OCICommit($db_conn);
        executePlainSQL("insert into payment values(\r\n\t\t\t\tpayid_sequence.nextval," . $_POST['credit'] . "," . $_COOKIE['cid'] . ")");
        OCICommit($db_conn);
        executePlainSQL("insert into deter_pay values(\r\n\t\t\t\tpayid_sequence.currval,\r\n\t\t\t\tresid_sequence.currval," . $_POST['makeres_totalcost'] . ")");
        OCICommit($db_conn);
        // Confirmation dialog
        ?>
		<script type="text/javascript"> 
			alert("Payment successful. Proceed to adding bags");
			location = "baggage.php";
		</script>
		<?php 
    } else {
        //print_r($res);
        echo "Your flight itinerary:";
        printDetails($res, 0, 0);
        ?>
		<br><br>The summary of your ticket order:
		<table class="pure-table">
Пример #6
0
                $tuple = array(":bind1" => $_POST['oldName'], ":bind2" => $_POST['newName']);
                $alltuples = array($tuple);
                executeBoundSQL("update tab1 set name=:bind2 where name=:bind1", $alltuples);
                OCICommit($db_conn);
            } else {
                if (array_key_exists('dostuff', $_POST)) {
                }
            }
        }
    }
    if ($_POST && $success) {
        //POST-REDIRECT-GET -- See http://en.wikipedia.org/wiki/Post/Redirect/Get
        header("location: oracle-test.php");
    } else {
        // Select data...
        $result = executePlainSQL("select * from Customer");
        printResult($result);
    }
    //Commit to save changes...
    OCILogoff($db_conn);
} else {
    echo "cannot connect";
    $e = OCI_Error();
    // For OCILogon errors pass no handle
    echo htmlentities($e['message']);
}
/* OCILogon() allows you to log onto the Oracle database
   The three arguments are the username, password, and database
   You will need to replace "username" and "password" for this to
   to work. 
   all strings that start with "$" are variables; they are created
Пример #7
0
     $deletesearchby = $_POST['deletesearchby'];
     $searchedvalue = $_POST['searchedvalue'];
     executePlainSQL("delete from {$tablename}" . " where {$deletesearchby} = '{$searchedvalue}'");
     OCICommit($db_conn);
     // save selection for next load
     setcookie("deletesearchby", $deletesearchby);
 }
 if ($_POST && $success) {
     //POST-REDIRECT-GET -- See http://en.wikipedia.org/wiki/Post/Redirect/Get
     header("location: admin.php");
     // default will check if there is any table already selected and output that
 } else {
     if (strcmp($_COOKIE['tabchoice'], "") !== 0 && strcmp($_COOKIE['tabchoice'], "default") !== 0) {
         $tabchoice = $_COOKIE['tabchoice'];
         $cols = executePlainSQL("select column_name from user_tab_columns where table_name = '{$tabchoice}'");
         $data = executePlainSQL("select * from " . $tabchoice);
         printResults($tabchoice, $cols, $data);
         // retrieve past delete/update selection from cookie for this load
         $updatesearchby = $_COOKIE['updatesearchby'];
         $deletesearchby = $_COOKIE['deletesearchby'];
         // delete them as only needed for one load
         setcookie("updatesearchby", "", time() - 3600);
         setcookie("deletesearchby", "", time() - 3600);
         // set the drop down lists according to the cookie (last delete/update selections)
         echo "<script>document.getElementById('tabchoice').value='{$tabchoice}'</script>";
         if (strcmp($_COOKIE['updatesearchby'], "") !== 0) {
             echo "<script>document.getElementById('updatesearchby').value='{$updatesearchby}'</script>";
         }
         if (strcmp($_COOKIE['deletesearchby'], "") !== 0) {
             echo "<script>document.getElementById('deletesearchby').value='{$deletesearchby}'</script>";
         }
Пример #8
0
        oci_close($db_conn);
    }
}
if (isset($_POST['BusinessLogin'])) {
    if (empty($_POST['businessName']) || empty($_POST['businessPwd'])) {
        $error = "Business Name or Password is invalid";
    } else {
        // connect to DB
        $db_conn = OCILogon("ora_" . $csid, "a" . $studentnum, "ug");
        // now connected
        if ($db_conn) {
            // grab the information needed for login
            $inputname = $_POST['businessName'];
            $inputpwd = $_POST['businessPwd'];
            // query for information obtained
            $s = executePlainSQL("select count (*)\n                           from Business \n                          where BusinessName = '{$inputname}' AND \n                          PasswordHash = '{$inputpwd}'");
            $result = oci_fetch_array($s);
            if ($result[0] == 1) {
                $_SESSION['login_business'] = $inputname;
                // Initializing Session
                header("location: business_profile.php");
                // Redirecting To Other Page
            } else {
                $error = "Business Name or Password is invalid";
            }
        } else {
            echo "cannot connect";
            $e = OCI_Error();
            // For OCILogon errors pass no handle
            echo htmlentities($e['message']);
        }
Пример #9
0
<?php

//THIS PHP FILE IS TO DELETE USER OR LOG OUT
require 'template.php';
ini_set('session.save_path', '/home/i/i5a8/');
session_start();
if (isset($_SESSION['username'])) {
    if (isset($_GET['logout'])) {
        session_destroy();
    } else {
        executePlainSQL("delete from party where partyid='{$_SESSION['username']}'");
        OCICommit($db_conn);
        OCILogoff($db_conn);
        session_destroy();
    }
}
header('Location: user.php');
Пример #10
0
    function printResult($result)
    {
        //prints results from a select statement
        echo "<br>Employee Info<br>";
        echo "<table class='table table-striped'>";
        echo "<tr><th>Username</th>" . " " . "<th>Wage</th>" . " " . "<th>Job Type</th>" . " " . "<th>Work Schedule</th></tr>";
        while ($row = OCI_Fetch_Array($result, OCI_BOTH)) {
            echo "<tr><td>" . $row["USERNAME"] . " </td><td>" . $row["WAGE"] . " </td><td>" . $row["JOBT"] . "</td><td>" . " " . $row["WORKS"] . "</td></tr>";
            //or just use "echo $row[0]"
        }
        echo "</table>";
    }
    // Connect Oracle...
    if ($db_conn) {
        $users = $_SESSION["username"];
        printResult(executePlainSQL("select * from employee where username = '******'"));
        OCICommit($db_conn);
    }
    ?>
        </font>
      </div>
    </div>
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="../js/bootstrap.min.js"></script>
  </body>
<?php 
} else {
    echo "ACCESS DENIED";
}
Пример #11
0
    }
    if (array_key_exists('Value', $_POST)) {
        $users = $_POST['username'];
        $amount = $_POST['amount'];
        $result = executePlainSQL("select username from customers where username = '******'");
        $numrows = oci_fetch_all($result, $res);
        if ($numrows == 0) {
            echo "<div class='alert alert-danger' role='alert'>";
            echo "<span class='glyphicon glyphicon-exclamation-sign' aria-hidden='true'></span>";
            echo "<span class='sr-only'>Error:</span>";
            echo "Invalid User";
            echo $amount = $_POST['amount'];
            echo "</div>";
        }
        if ($numrows == 1) {
            executePlainSQL("update customers set credit = {$amount} where username = '******'");
            header("location: index.php");
        }
    }
    OCICommit($db_conn);
    //Commit to save changes...
    OCILogoff($db_conn);
    // printResult($result);
    //Commit to save changes...
} else {
    $e = OCI_Error();
    // For OCILogon errors pass no handle
    echo "<div class='alert alert-danger' role='alert'>";
    echo "<span class='glyphicon glyphicon-exclamation-sign' aria-hidden='true'></span>";
    echo "<span class='sr-only'>Error:</span>";
    echo htmlentities($e['message']);
Пример #12
0
function minAvg()
{
    $min = executePlainSQL("SELECT min(avg(pp)) FROM moves GROUP BY type");
    echo "<div class='Pokeguide'>";
    echo "<table>";
    echo "<tr>";
    echo "<td>Lowest Average PP</td>";
    echo "<td>Type</td>";
    echo "</tr>";
    echo "<tr>";
    $row = OCI_Fetch_Array($min, OCI_BOTH);
    echo "<td>" . $row[0] . "</td><td>Dragon</td>";
    echo "</tr>";
    echo "</table>";
    echo "</div>";
}
Пример #13
0
Location: <input type="text" name="location">
<input type="submit" value="search">
</form> 

<br>

<?php 
//SEARCH
$location = strtolower($_GET["location"]);
if ($location != null) {
    //$pokemon = ucfirst($_POST["pokemon"]);
    $locations = array_map('ucfirst', explode(" ", $location));
    $location = implode(" ", $locations);
    $result = executePlainSQL("SELECT * FROM location WHERE lname = '" . $location . "' OR lname LIKE '%" . $location . "%'");
} else {
    $result = executePlainSQL("SELECT * FROM location");
}
printLocation($result);
//Print result
function printLocation($result)
{
    echo "<div class='Pokeguide'>";
    echo '<table>';
    echo '<tr><td>Location</td><td>Description</td></tr>';
    while ($row = OCI_Fetch_Array($result, OCI_BOTH)) {
        if (strpos($row[0], 'Evolve') === false and strpos($row[0], 'LName') === false) {
            echo '<tr>';
            echo '<td>' . $row[0] . '</td>';
            echo '<td>' . $row[1] . '</td>';
            echo '</tr>';
        }
Пример #14
0
<head>
	<title>RegSys</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link href="css/style.css" rel="stylesheet" type="css/css" media="all" />
	<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.6.0/pure-min.css">
	<link href='http://fonts.googleapis.com/css?family=Montserrat' rel='stylesheet' type='text/css'>
	<link href='http://fonts.googleapis.com/css?family=Exo+2:400,700,100' rel='stylesheet' type='text/css'>
</head>
<body>
<!--content-->
<h1>RegSys 1.0</h1>
<h2>Recreation Centre Registration System</h2>
<p><?php 
echo "Hello, ";
$getName = "SELECT name \n\t\t\t\tFROM employee\n\t\t\t\tWHERE employee.empID = '" . $_SESSION["empID"] . "' \n\t\t\t\tAND employee.password = '******'";
$result = executePlainSQL($getName);
$row = oci_fetch_array($result, OCI_BOTH);
if ($row["NAME"]) {
    echo $row["NAME"];
    $loginName = "Logout";
    $loginAction = "window.location.href='logout.php'";
} else {
    echo "Guest!";
    $loginName = "Login";
    $loginAction = "window.location.href='login.php'";
}
?>
</p>
<ul class="content">
      <li class="menu">
          <ul>
Пример #15
0
                    //the function takes a list of lists
                    // Update data...
                    //executePlainSQL("update tab1 set nid=10 where nid=2");
                    // Delete data...
                    //executePlainSQL("delete from tab1 where nid=1");
                    OCICommit($db_conn);
                }
            }
        }
    }
    if ($_POST && $success) {
        //POST-REDIRECT-GET -- See http://en.wikipedia.org/wiki/Post/Redirect/Get
        header("location: oracle-test.php");
    } else {
        // Select data...
        $result = executePlainSQL("select * from tab1");
        printResult($result);
    }
    //Commit to save changes...
    OCILogoff($db_conn);
} else {
    echo "cannot connect";
    $e = OCI_Error();
    // For OCILogon errors pass no handle
    echo htmlentities($e['message']);
}
/* OCILogon() allows you to log onto the Oracle database
   The three arguments are the username, password, and database
   You will need to replace "username" and "password" for this to
   to work. 
   all strings that start with "$" are variables; they are created
Пример #16
0
		<div id="main">
			<div class="container">
				<div class="row main-row">
					<div class="12u">

<?php 
if (isset($_SESSION["username"])) {
    echo "<h2 style='text-align:center;'>Welcome to your Pokemon Party<br> PokeMaster {$_SESSION["username"]}</h2>";
    $trainer_info = executePlainSQL("SELECT * FROM party WHERE partyid = '{$_SESSION["username"]}'");
    $row = OCI_Fetch_Array($trainer_info, OCI_BOTH);
    $party = explode(",", $row[1]);
    echo "<div class='Pokeguide'>";
    //================LIST OF POKEMON
    for ($i = 0; $i < count($party); $i++) {
        echo "<table>";
        $result = executePlainSQL("SELECT * FROM pokemon WHERE pid = '{$party[$i]}'");
        printPoke($result);
        echo "<td>";
        echo "<form action='deletePoke.php' method='get'>";
        echo "<button name='submit' value='{$party[$i]}'>Remove Pokemon</button></form>";
        echo "</td>";
        echo "</tr>";
        //========================================
    }
    echo "<tr>";
    echo "<td colspan='2'>";
    //DELETE USER BUTTON
    echo "<form action='deleteUser.php'>";
    echo "<button name='delete'>DELETE USER</button></form>";
    echo "</td>";
    echo "</tr>";
Пример #17
0
function executeClassQuery($attributes, $selectMode)
{
    switch ($selectMode) {
        case "className":
            echo "Search by Class Name<br>";
            $attr = "CU.name";
            break;
        case "repeatedOn":
            echo "Search by Repeat Day<br>";
            $attr = "CU.repeatedOn";
            break;
        case "instructor.name":
            echo "Search by Instructor Name<br>";
            $attr = "T.Name";
            break;
    }
    $tables = "class_uses CU, class_info CI, teaches T";
    $queryString = "SELECT " . $attributes[0] . " FROM " . $tables . " WHERE " . $attr . " LIKE '%" . $_GET["select"] . "%'" . " AND CU.name = CI.name \n\t\t  \tAND CU.activity_ID = T.activity_ID";
    // echo $queryString . "<br>";
    $result = executePlainSQL($queryString);
    printResultTable($result, "Classes", $attributes[1], $attributes[2]);
}
Пример #18
0
function getDetails($bigTuple, $numFlights)
{
    $fid1 = $bigTuple['FID1'];
    $departFlight = oci_fetch_assoc(executePlainSQL("select * from Flight where fid='{$fid1}'"));
    $departDate = parseDate($departFlight['DEPARTTIME'], 1);
    $departApCode = $departFlight['DEPARTAP'];
    $departAp = oci_fetch_assoc(executePlainSQL("select CITY, COUNTRY from Airport where code='{$departApCode}'"));
    $departCity = $departAp['CITY'];
    $departCountry = $departAp['COUNTRY'];
    if ($numFlights == 1) {
        $arrivalFlight = $departFlight;
    } else {
        if ($numFlights == 2) {
            $fid2 = $bigTuple['FID2'];
            $arrivalFlight = oci_fetch_assoc(executePlainSQL("select * from Flight where fid='{$fid2}'"));
        } else {
            $fid3 = $bigTuple['FID3'];
            $arrivalFlight = oci_fetch_assoc(executePlainSQL("select * from Flight where fid='{$fid3}'"));
        }
    }
    $arrivalApCode = $arrivalFlight['ARRIVALAP'];
    $arrivalAp = oci_fetch_assoc(executePlainSQL("select * from Airport where code='{$arrivalApCode}'"));
    $arrivalCity = $arrivalAp['CITY'];
    $arrivalCountry = $arrivalAp['COUNTRY'];
    $flightLoc = array("DEPARTDATE" => $departDate, "DEPARTCITY" => $departCity, "DEPARTCOUNTRY" => $departCountry, "ARRIVALCITY" => $arrivalCity, "ARRIVALCOUNTRY" => $arrivalCountry);
    return $flightLoc;
}
Пример #19
0
    echo "</table>";
}
function printActivityUseTable($result)
{
    echo "<table class=\"myTable\">";
    echo "<tr>\n\t\t\t\t<th>Activity ID</th>\n\t\t\t\t<th>Name</th>\n\t\t\t\t<th>Day</th><th></th><th></th>\n\t\t\t\t<th>Start Time</th><th></th><th></th>\n\t\t\t\t<th>End Time</th><th></th>\n\t\t\t\t<th>Room</th>\n\t\t\t</tr>";
    while ($row = OCI_Fetch_Array($result, OCI_BOTH)) {
        echo "<tr><td>" . $row["ACTIVITY_ID"] . "</td><td>" . $row["NAME"] . "</td><td>" . $row["DAY"] . "</td><td>" . "</td><td>" . "</td><td>" . $row["START_TIME"] . "</td><td>" . "</td><td>" . "</td><td>" . $row["END_TIME"] . "</td><td>" . "</td><td>" . $row["ROOMNUM"] . "</td></tr>";
    }
    echo "</table>";
}
if ($db_conn) {
    dropDownFromQuery($attr_name, $table, "activities.php");
    // Display Activity_Info and Activity_Uses entires
    $activityInfoCmd = "select * from Activity_Info";
    $activityUseCmd = "select * from Activity_uses";
    if ($_POST["activityName"] != "") {
        $activityInfoCmd = "select * from Activity_Info where name like '%" . $_POST["activityName"] . "%'";
        $activityUseCmd = "select * from Activity_uses where name like '%" . $_POST["activityName"] . "%'";
    }
    echo '<h2>Activity Info</h2>';
    $result1 = executePlainSQL($activityInfoCmd);
    printActivityInfoTable($result1);
    echo '<h2>Activity Uses</h2>';
    $result2 = executePlainSQL($activityUseCmd);
    printActivityUseTable($result2);
}
?>
<br><hr><form><input class="pure-button" type="button" value="Back to Main Menu" onclick="window.location.href='index.php'"><br>
</body>
</html>
Пример #20
0
<html>
<body>

<p>Enter the Name:</p> <input type="text" name="Nameone" />
<p>Enter the Barcode:</p> <input type="number" name="Barcodeone" />
<p>Enter the ESRB:</p> <input type="text" name="rateone" />
<p>Enter The Number Players:</p> <input type="number" name="playersone" />
<p>Enter the Price: </p> <input type = "number" name = "priceone" />
<p></p>
<input type="submit" value="AddGames" name = "submit">

<p>Select your order: <input type="text" name="productorder"> 
<input type="submit" value="purchase" name="purchasesubmit">

</body>
</html>

<?php 
$productorder = $_POST['productorder'];
if (!($productorder == 0)) {
    $queryten = executePlainSQL("SELECT Name \t\t\t\t\t\t\t\n\t\t\t\t\t\t\tFROM ProductBarcode p\t\t\t\t\t\t\n\t\t\t\t\t\t\tWHERE rownum = {$productorder}");
    $row = OCI_Fetch_Assoc($queryten);
    echo $row['Name'];
    echo $row["Name"];
    echo "you have purchased" . $row["Name"];
}
Пример #21
0
        }
        if (array_key_exists('numtickets', $_COOKIE)) {
            $numtickets = $_COOKIE['numtickets'];
            echo "<script>document.getElementById('numtickets').value='{$numtickets}'</script>";
        }
        if (array_key_exists('flightclass', $_COOKIE)) {
            $flightclass = $_COOKIE['flightclass'];
            echo "<script>document.getElementById('flightclass').value='{$flightclass}'</script>";
        }
        // The above set the drop down lists according to the cookies, will not work if we don't reload
        // the page as done by header("location:flights.php")
        // The below do the magical/legendary/highly-inefficient search query to Oracle for retrieving flight
        // data according to user's search criteria
        if (strcmp($depcity, "") !== 0 && strcmp($descity, "") !== 0) {
            $departap = oci_fetch_row(executePlainSQL("select code from Airport where city='{$depcity}' AND country='{$depcountry}'"));
            $arrivalap = oci_fetch_row(executePlainSQL("select code from Airport where city='{$descity}' AND country='{$descountry}'"));
            if (strcmp($_COOKIE['maxnumtrans'], "inf") == 0) {
                echo "<script>document.getElementById('maxnumtransinf').checked=true</script>";
                $flights = executePlainSQL("select * from allFlight \n\t\t\t\t\t\t\t\t\t\t\twhere firstid IN (select fid from Flight\n\t\t\t\t\t\t\t  \t\t\t   \t\t\t\t\t   where departap='{$departap['0']}')\n\t\t\t\t\t                        AND thirdid IN (select fid from Flight\n\t\t\t\t\t                        \t             where arrivalap='{$arrivalap['0']}')\n\t\t\t\t\t                        AND dt1>='{$flightdate}'\n\t\t\t\t\t                        ORDER BY totalprice");
            } else {
                $flights = executePlainSQL("select * from allFlight where ((firstid IN (select fid from Flight\n\t\t\t\t\t\t\t  \t\t\t   where departap='{$departap['0']}' AND arrivalap='{$arrivalap['0']}')\n\t\t\t\t\t\t\t\t\t\t    AND secondid IS NULL AND thirdid IS NULL) \n\t\t\t\t\t                        OR (firstid IN (select fid from Flight\n\t\t\t\t\t                        \t\t\t\twhere departap='{$departap['0']}')\n\t\t\t\t\t                        AND secondid IN (select fid from Flight\n\t\t\t\t\t                        \t             where arrivalap='{$arrivalap['0']}')\n\t\t\t\t\t                        AND thirdid IS NULL))\n\t\t\t\t\t\t\t\t\t\t\tAND dt1>='{$flightdate}'\n\t\t\t\t\t                        ORDER BY totalprice");
            }
            //print_r($flightdate);
            $locations = array($departap[0], $depcity, $depcountry, $arrivalap[0], $descity, $descountry);
            printFlights($flights, $locations);
        }
    }
}
?>
</div>
</body>
Пример #22
0
                printResult1($result);
            } elseif ($_POST["aggregate"] == "min") {
                $result = executePlainSQL("SELECT AVG, c.day as DAY\n\t\t\t\t\t\t\t\t\t\t\tFROM (SELECT AVG(NumOfSessions) as AVG, day\n\t\t\t\t\t\t\t\t\t\t\t      FROM class_uses \n\t\t\t\t\t\t\t\t\t\t\t\t  GROUP BY day) a, class_uses c\n\t\t\t\t\t\t\t\t\t\t    WHERE a.day = c.day AND AVG = (select MIN(AVG)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  from (select day, AVG(NumOfSessions) as AVG\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfrom class_uses GROUP BY day))\n\t\t\t\t\t\t\t\t\t\t   ");
                printResult1($result);
            }
        } elseif ($_POST["query"] == "classPrice") {
            if ($_POST["aggregate"] == "max") {
                $result = executePlainSQL("SELECT price as P, name as N\n\t\t\t\t\t\t\t\t\t  FROM class_info\n\t\t\t\t\t\t\t\t\t  WHERE price = (select MAX(price) \n\t\t\t\t\t\t\t\t\t\t\t\t\t FROM class_info)\n\t\t\t\t\t\t\t\t\t  ");
                printResult1($result);
            } elseif ($_POST["aggregate"] == "min") {
                $result = executePlainSQL("SELECT price as P, name as N\n\t\t\t\t\t\t\t\t\t  FROM class_info\n\t\t\t\t\t\t\t\t\t  WHERE price = (select MIN(price) \n\t\t\t\t\t\t\t\t\t\t\t\t\t FROM class_info)\n\t\t\t\t\t\t\t\t\t  ");
                printResult1($result);
            }
        } elseif ($_POST["query"] == "teachingClass") {
            if ($_POST["aggregate"] == "max") {
                $result = executePlainSQL(" Select COUNT, NAME \n\t\t\t\t\t\t\t\t\t\tfrom TeachesClass \n\t\t\t\t\t\t\t\t\t\tWHERE COUNT NOT IN \n\t\t\t\t\t\t\t\t\t\t(Select t1.COUNT \n\t\t\t\t\t\t\t\t\t\tfrom TeachesClass t1, TeachesClass t2 \n\t\t\t\t\t\t\t\t\t\twhere t1.COUNT < t2.COUNT)");
                printResult1($result);
            } elseif ($_POST["aggregate"] == "min") {
                $result = executePlainSQL(" Select COUNT, NAME \n\t\t\t\t\t\t\t\t\t\tfrom TeachesClass \n\t\t\t\t\t\t\t\t\t\tWHERE COUNT NOT IN \n\t\t\t\t\t\t\t\t\t\t(Select t1.COUNT \n\t\t\t\t\t\t\t\t\t\tfrom TeachesClass t1, TeachesClass t2 \n\t\t\t\t\t\t\t\t\t\twhere t1.COUNT > t2.COUNT)");
                printResult1($result);
            }
        }
        echo "<br><form><input class=\"pure-button\" type=\"button\" value=\"Back to Main Menu\" onclick=\"window.location.href='index.php'\"> </form> <br>";
    } else {
        echo "<div class=\"login\">\n\t\t\t\t\t<div class=\"loginbox\">\n\t\t\t\t\t<h1 class=\"logintitle\">Oops!</h1>\n\t\t\t\t\t<p>You must be logged in to see this page!</p>\n\t\t\t\t\t  <form action=\"employee.php\" method=\"post\">\n\t\t\t\t\t\t<input class=\"pure-button\" type=\"button\" value=\"Login\" onclick=\"window.location.href='login.php'\"> \n\t\t\t\t\t\t<input type=\"button\" class=\"pure-button\" value=\"Back to Main Menu\" onclick=\"window.location.href='index.php'\">\n\t\t\t\t\t  </form>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>";
    }
}
?>
</body>
</html>
Пример #23
0
{
    $out = "";
    switch ($code) {
        case 0:
            $out = "In transit";
            break;
        case 1:
            $out = "Lost";
            break;
        case 2:
            $out = "Picked up";
            break;
        case 3:
            $out = "Checked in";
            break;
    }
    return $out;
}
if ($db_conn) {
    $q = "select h.bid, h.status, h.weight_kg, h.last_update, l.code \n\t\t\t\tfrom has_B h, last_location l\n\t\t\t\t where cid = '" . $_COOKIE['cid'] . "' and h.bid = l.bid";
    $options = executePlainSQL($q);
    $bids = array();
    echo "<table class='pure-table pure-table-bordered'>\n\t\t\t<tr>\n\t\t\t\t<thead>\n\t\t\t\t<td>bid</td>\n\t\t\t\t<td>status</td>\n\t\t\t\t<td>weight_kg</td>\n\t\t\t\t<td>last_update</td>\n\t\t\t\t<td>last ap</td>\n\t\t\t\t</thead>\n\t\t\t</tr>";
    while ($row = oci_fetch_array($options, OCI_BOTH)) {
        echo "<tr>" . "<td>" . $row[0] . "</td>" . "<td>" . parseStatus($row[1]) . "</td>" . "<td>" . $row[2] . "</td>" . "<td>" . $row[3] . "</td>" . "<td>" . $row[4] . "</td>" . "</tr>";
    }
    echo "</table>";
}
?>
</div>
</body>
Пример #24
0
</form> 

<button onclick="location.href = 'login.php';">Login Here</button>

<?php 
global $db_conn;
if (isset($_POST['username']) and isset($_POST['password'])) {
    $username = $_POST['username'];
    $password = $_POST['password'];
    $results = executePlainSQL("select userid from users where userid= '{$username}'");
    $arrayResults = OCI_Fetch_Array($results, OCI_BOTH);
    if ($arrayResults[0] != null) {
        echo '<br>The username has already been taken, Try another username';
    } else {
        executePlainSQL("insert into party values ('{$username}','1')");
        executePlainSQL("insert into users values ('{$username}','{$password}','{$username}')");
        header("Location: login.php");
    }
    OCICommit($db_conn);
    OCILogoff($db_conn);
}
?>





				</div>
 

						</div>
Пример #25
0
<form name="input" action="login.php" method="post">
UserName: <br><input type="text" name="username"><br>
Password: <br><input type="password" name="password"><br>
<input type="submit" value="login">
</form> 	

<button onclick="location.href = 'register.php';">Register Here</button>
				
<?php 
global $db_conn;
//IF FORM IS SUBMITTED ALREADY
if (isset($_POST['username']) and isset($_POST['password'])) {
    $username = $_POST['username'];
    $password = $_POST['password'];
    //CHECK IF VALUES ARE IN THE DATABASE
    $results = executePlainSQL("select * from users where userid='{$username}' and password='******'");
    OCICommit($db_conn);
    $arrayResults = OCI_Fetch_Array($results, OCI_BOTH);
    OCILogoff($db_conn);
    if ($arrayResults[0] != null) {
        $_SESSION["username"] = $_POST["username"];
        $_SESSION["login"] = true;
        header("Location: user.php");
    } else {
        echo "<br>Wrong password or username<br>";
    }
}
?>
 
</div>
						</div>
Пример #26
0
    while ($row = OCI_Fetch_Array($result, OCI_BOTH)) {
        echo "<tr><td>" . " " . $row["USERNAME"] . " </td><td>" . " " . $row["ADDRESS"] . " </td><td>" . " " . $row["PASSWORD"] . "</td><td>" . " " . $row["PHONE"] . "</td></tr>";
        //or just use "echo $row[0]"
    }
    echo "</table>";
}
// Connect Oracle...
if ($db_conn) {
    if (!is_writable(session_save_path())) {
        echo 'Session path "' . session_save_path() . '" is not writable for PHP!';
    }
    if (array_key_exists('Login', $_POST)) {
        $users = $_POST['username'];
        $passw = $_POST['password'];
        //oci_execute(,OCI_DEFAULT);
        $result = executePlainSQL("select username from employee where username = '******' and password = '******'");
        $numrows = oci_fetch_all($result, $res);
        if ($numrows == 0) {
            echo "<div class='alert alert-danger' role='alert'>";
            echo "<span class='glyphicon glyphicon-exclamation-sign' aria-hidden='true'></span>";
            echo "<span class='sr-only'>Error:</span>";
            echo "Invalid User or Password.";
            echo "</div>";
        }
        if ($numrows == 1) {
            $_SESSION['username'] = $users;
            echo $_SESSION['username'];
            $_SESSION['permissions'] = "EMPLOYEE";
            echo $_SESSION['permissions'];
            header("location: index.php");
        }
Пример #27
0
</select>
<input type="submit" value="search">
</form> 
<br>


<?php 
if (isset($_POST['item'])) {
    $item = $_POST['options'];
    //              echo $item;
}
$item = ucfirst(strtolower($_POST["item"]));
if ($item !== null) {
    $result = executePlainSQL("SELECT * FROM item WHERE type = '" . $item . "' OR iid = '" . $item . "' OR Description LIKE '%" . $item . "%'");
} else {
    $result = executePlainSQL("SELECT * FROM item");
}
printItem($result);
function printItem($result)
{
    echo "<div class='Pokeguide'>";
    echo "<table>";
    echo "<tr><td>IID</td><td>Type</td><td>Description</td></tr>";
    while ($row = OCI_Fetch_Array($result, OCI_BOTH)) {
        echo "<tr><td>" . $row[0] . "</td><td>" . $row[1] . "</td><td>" . $row[2] . "</td></tr>";
    }
    echo "</table>";
    echo "</div>";
}
?>
       
Пример #28
0
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
 $counte = executePlainSQL("select count(*) from employee");
 $countv = executePlainSQL("select count(*) from vehicles");
 printEmployeeCount($counte);
 printVehicleCount($countv);
 $employees = executePlainSQL("select * from employee");
 $vehicles = executePlainSQL("select * from vehicles");
 $operatedby = executePlainSQL("select * from operatedby");
 printEmployees($employees);
 printVehicles($vehicles);
 printOperatedBy($operatedby);
 /*
 	if ($_POST && $success) {
 		//POST-REDIRECT-GET -- See http://en.wikipedia.org/wiki/Post/Redirect/Get
 		header("location: oracle-test.php");
 	} else {
 		// Select data...
 	//	$result = executePlainSQL("select * from tab1");
 		$employees = executePlainSQL("select * from employee");
 		$vehicles = executePlainSQL("select * from vehicles");
 		$operatedby = executePlainSQL("select * from operatedby");
 	//	printResult($result);
 		printEmployees($employees);
Пример #29
0
function leastPopularInterestTypeAtLocation($location)
{
    $result = executePlainSQL("WITH InterestCount AS(\n\t\t\tSELECT interest, COUNT(*) AS count\n\t\t\tFROM (\n\t\t\t\tSELECT interest FROM InterestedIn I\n\t\t\t\tINNER JOIN Users U On I.userId = U.userId\n\t\t\t\tWHERE U.location = '{$location}'\n\t\t\t\t) GROUP BY interest\n\t\t\t)\n\t\tSELECT interest FROM InterestCount\n\t\tWHERE count = (\n\t\t\tSELECT MIN(count)\n\t\t\tFROM InterestCount\n\t\t)");
    $interests = array();
    while (($row = oci_fetch_array($result, OCI_ASSOC + OCI_RETURN_NULLS)) != false) {
        array_push($interests, trim($row[INTEREST]));
    }
    return $interests;
}
Пример #30
0
        echo 'Session path "' . session_save_path() . '" is not writable for PHP!';
    }
    if (array_key_exists('Change', $_POST)) {
        echo $_POST['transitid'];
        $tid = $_POST['transitid'];
        $inter = $_POST['interval'];
        $ttime = $_POST['ttime'];
        $result = executePlainSQL("select * from schedule where transitID = '{$tid}'");
        $numrows = oci_fetch_all($result, $res);
        if ($numrows == 0) {
            echo "Invalid User";
            echo $amount = $_POST['amount'];
        }
        if ($numrows == 1) {
            executePlainSQL("update schedule set arrivals = (arrivals+interval'{$inter}' minute) where transitID = '{$tid}'");
            executePlainSQL("update schedule set departures = (departures+interval'{$inter}' minute) where transitID = '{$tid}'");
            header("location: schedule.php");
        }
    }
    OCICommit($db_conn);
    //Commit to save changes...
    OCILogoff($db_conn);
    // printResult($result);
    //Commit to save changes...
} else {
    $e = OCI_Error();
    // For OCILogon errors pass no handle
    echo "<div class='alert alert-danger' role='alert'>";
    echo "<span class='glyphicon glyphicon-exclamation-sign' aria-hidden='true'></span>";
    echo "<span class='sr-only'>Error:</span>";
    echo htmlentities($e['message']);