-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
68 lines (65 loc) · 3.01 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(-1);
$loggedin = FALSE;
?>
<html>
<head>
<title> BulkBuy </title>
<link rel="stylesheet" type="text/css" href="main.css">
</head>
<?php
if(isset($_GET["successful"])) {
$loggedin = TRUE;
session_start();
}
?>
<body>
<div id = "header">
<img src = "logo.png" alt = "logo">
<?php if($loggedin) { ?>
<a href = "logout.php"> <img class = "button" src = "http://4.bp.blogspot.com/-V4UiHRvdqH4/UuuUKu2Dq4I/AAAAAAAAA4g/y7TJV0WQbgA/s1600/sitemgr_logout-button-blue-md.png" alt = "logout"> </a>
<?php } else { ?>
<a href = "dologin.php"> <img class = "button" src = "http://www.clker.com/cliparts/U/4/w/1/q/s/login-button-blue-hi.png" alt = "login"> </a>
<a href = "form.php"> <img class = "button" src = "http://www.clker.com/cliparts/j/Z/J/9/s/f/register-button-blue-hi.png" alt = "login"> </a>
<?php } ?>
</div>
<div class = "column" id = "columnleft">
<div class = "item">
<?php
if($loggedin) {
?>
<p> Welcome <?= $_SESSION["UserName"]; ?> </p>
<a href = "registercampaign.php"> <img id = "campaign" src = "campaign.png" alt = campaign /> </a>
<?php } else {
echo "Our product is a web interface that allows customers to buy products they want from a website called DealBreak. Customers are allowed to choose any of the products listed there. The price of a product is handled in the following way: as more customers buy that product, its price decreases.
The overall layout of the website consists of four web pages: the first one is used for registration, the second for login, the third for containing the actual products listed, and the final one for containing a list of list of the transactions made and the receipt. The registration process consists of providing the individual's name, username, password, email.
Php and html - css are the main languages used to develop the user interface for the website. A database created in SQL is used to store information such as the usernames/passwords entered. This way, no duplicate accounts can be created, and when signing in, the password is correctly matched up with the username.";
}
?>
</div>
</div>
<div class = "column" id = "columnright">
<div class = "item">
<?php if(!$loggedin) { ?>
Please sign in or register using the links above to get started.
<?php } else { ?>
<p> Soon Ending Campaigns </p>
<?php
$db = new PDO("mysql:dbname=emp;host=localhost;charset=utf8", "root", "root");
$rows = $db -> query("SELECT PRODUCT, PRICE, AMOUNT_TO_SELL, CURRENT_SALES, DESCRIPTION, ID, MAX_DISCOUNT_RATE, CURRENT_DISCOUNT, START_DATE, END_DATE
from campaigns
ORDER BY END_DATE ASC");
if($rows->rowCount > 0) {
foreach($rows as $row) {
$Price = $row["PRICE"]*(1-$row["CURRENT_DISCOUNT"]);
echo "Product: ".$row["PRODUCT"]. " Price: ".$Price. " End Date: ".$row["END_DATE"];
echo "<br>";
}
}
} ?>
</div>
</div>
</body>
</html>