Skip to content

Instantly share code, notes, and snippets.

@the133448
Created August 23, 2016 02:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save the133448/632f0cca04a053449bd362510281aa7f to your computer and use it in GitHub Desktop.
Save the133448/632f0cca04a053449bd362510281aa7f to your computer and use it in GitHub Desktop.
<?php
if (isset($_GET["studentID"])) {
require("api/api.php");
$number = validate($_GET["studentID"]);
/*Grab Name*/
$sql = "SELECT `name`, `points` FROM Points WHERE `uid` = '" . $number . "'";
$result = sqlStatment($sql);
if (mysqli_num_rows($result) == 0){ ?>
</br>
<h1 class="slideanimauto"> Sorry, you have not yet bought from us!</h1>
</br>
</br>
<?php
exit;
}
$name = $points = "";
while ($row = mysqli_fetch_array($result)) {
$name= $row["name"];
$points = $row["points"];
}
/*so i dont have to update the datbase ervery time to test :)*/
// $points = $_GET["p"];
$npoints = 6-$points;
?>
<h1 class="slideanimauto">Hello, <?php echo $name?>.</h1>
<h4 class="slideanimauto"> You have <span class=important><?php echo $points?> points</span> collected.</h4>
<?php
if($npoints-1>0) {
?>
<p class="lead slideanimauto"> You get a free drink after you have bought,</p>
<p class="big slideanimauto"><?php echo $npoints ?></p>
<p class="lead slideanimauto">more drinks.</p>
<?php } else if ($npoints-1==0) { ?>
<p class="lead slideanimauto"> You get a free drink after you have bought,</p>
<p class="big slideanimauto"><?php echo $npoints ?></p>
<p class="lead slideanimauto">more drink.</p>
<?php } else { ?>
<p class="lead slideanimauto">Collect your</p>
<p class="big slideanimauto">Free drink!</p>
<?php } ?>
<p class="shadow slideanimauto"> Every 6th drink is free</p>
<?php
$number = validate($number);
$sql = "SELECT `MenuItemName`,`Price`,`datetime` FROM Orders WHERE `Student UID` = '" . $number . "' ORDER BY `Id` DESC LIMIT 0 , 5";
//echo $sql;
$result = sqlStatment($sql);
echo "</br>";
echo "<h1>Recent Transactions... </h1>";
echo "</br>";
echo "</br>";
while ($row = mysqli_fetch_array($result)) {
$date = date_create($row["datetime"]);
$date = date_format($date, "g:ia l jS F");
echo "<table>";
echo "<td>" . $date . "</td>";
echo "<td>" . $row['MenuItemName'] . "</td>";
echo "<td>" . "$" . $row['Price'] . "</td>";
echo "</table>";
echo "</br>";
}
echo "</br>";
echo "</br>";
} else {
echo "No results found";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment