Пример #1
0
*																		  * 
* Unless required by applicable law or agreed to in writing, software     * 
* distributed under the License is distributed on an "AS IS" BASIS,       * 
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* 
* See the License for the specific language governing permissions and     * 
* limitations under the License. 									  	  * 
**************************************************************************/
$page_title = '';
$idNumber = '';
require "config.php";
require "functions.php";
$mysqli = iwu_startMysql();
if ($_COOKIE["user"] != "") {
    $idNumber = $_COOKIE["user"];
    $sql = "SELECT firstName, lastName\n\t\t\tFROM Student_Account\n\t\t\tWHERE studentID = " . mysql_real_escape_string($idNumber);
    $row = iwu_getRow($sql, $mysqli);
    $userID = $row['firstName'] . ' ' . $row['lastName'];
} else {
    header('Location: /');
    exit;
}
if ($_GET["type"] == "mealSwipes") {
    //display history for mealswipes
    $page_type = "Meal Swipes";
    $page_title = 'Meal Swipe History';
    $sql = "SELECT lastUsed, totalMealswipes, location\n\t\t\t\tFROM Student_Account, Mealswipe_History, Locations\n\t\t\t\tWHERE Student_Account.StudentID = " . mysql_real_escape_string($idNumber) . " AND\n\t\t\t\t    Student_Account.id = Mealswipe_History.Student_Account_id AND\n\t\t\t\t    Mealswipe_History.Locations_id = Locations.id \n\t\t\t\tORDER BY lastUsed DESC";
    $Full_list = iwu_getResults($sql, $mysqli);
    $loop_total = 'totalMealswipes';
    $loop_cost = 'location';
} else {
    if ($_GET["type"] == "points") {
Пример #2
0
<?php

require "config.php";
// get SQL Database login credentials
require "functions.php";
$mysqli = iwu_startMysql();
$sql = 'SELECT MIN(totalMealswipes) as total FROM Mealswipe_History WHERE Student_Account_id = 1';
$total_meals = iwu_getRow($sql, $mysqli);
$sql = 'INSERT INTO Mealswipe_History
		(lastUsed, Locations_id, Student_Account_id, totalMealswipes)
		VALUES (NOW(), 1, 1, ' . ($total_meals['total'] - 1) . ')';
$mysqli->query($sql);
$sql = 'SELECT MIN(totalPoints) as total FROM Point_History WHERE Student_Account_id = 1';
$total_points = iwu_getRow($sql, $mysqli);
$sql = 'INSERT INTO Point_History
			(lastUsed, Locations_id, Student_Account_id, totalPoints, pointsSpent)
			VALUES (NOW(), 1, 1, ' . ($total_points['total'] - 2.5) . ', 2.50)';
$mysqli->query($sql);
iwu_stopMysql($mysqli);
Пример #3
0
    }
    if ($send_error == '') {
        //get Amount of Mealswipes
        $sql = "SELECT lastUsed, totalMealswipes, location\n\t\t\t\tFROM Student_Account, Mealswipe_History, Locations\n\t\t\t\tWHERE Student_Account.StudentID = " . mysql_real_escape_string($idNumber) . " AND\n\t\t\t\t    Student_Account.id = Mealswipe_History.Student_Account_id AND\n\t\t\t\t    Mealswipe_History.Locations_id = Locations.id \n\t\t\t\tORDER BY lastUsed DESC LIMIT 1";
        $allMeals = iwu_getRow($sql, $mysqli);
        $mealSwipes = $allMeals['totalMealswipes'];
        $mealLocation = $allMeals['location'];
        $mealTime = $allMeals['lastUsed'];
        //get Amount of Points
        $sql = "SELECT lastUsed, pointsSpent, totalPoints, location\n\t\t\t\tFROM Student_Account, Point_History, Locations\n\t\t\t\tWHERE Student_Account.StudentID = " . mysql_real_escape_string($idNumber) . " AND\n\t\t\t\t    Student_Account.id = Point_History.Student_Account_id AND\n\t\t\t\t    Point_History.Locations_id = Locations.id \n\t\t\t\tORDER BY lastUsed DESC LIMIT 1";
        $allPoints = iwu_getRow($sql, $mysqli);
        $points = $allPoints['totalPoints'];
        $pointsLocation = $allPoints['location'];
        $pointsTime = $allPoints['lastUsed'];
        $sql = "SELECT Last_Day FROM End_Of_Semester";
        $datetime2 = iwu_getRow($sql, $mysqli);
        $datetime2 = $datetime2['Last_Day'];
        // implementation of US4:7,8
        $page_title = 'Account Information';
        require "header.php";
        // US2:1,2,3 Implemented a fully working system. Displays account information to the user
        ?>
		
		<div class="row">
			<div class="large-5 columns large-centered text-center medium-6 medium-centered last">
				<h2>Account Information</h2><hr>
				<h3><?php 
        echo $userID;
        ?>
</h3>
				<ul class="pricing-table meals">