-
Notifications
You must be signed in to change notification settings - Fork 0
/
shopping.php
1 lines (1 loc) · 4.93 KB
/
shopping.php
1
<?php session_start(); if(!isset($_SESSION['logged']) || !$_SESSION['logged']){ header("Location: ./index.php"); } /* -- SQL Config -- */ $servername = "localhost"; $username = "root"; $password = "root123"; $dbname = "cs634dmadmin"; $item_array = array(); $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { echo "<hr/><br/>500 - Internal Server Error. <br/> Cannot connect to MySQL. Please do proper setup of XAAMP again.<br/><hr/>"; die("Connection failed: " . $conn->connect_error); }else{ $user= $_SESSION["username"]; $title="CS634 - Midterm Project | Shopping page"; $sql = "SELECT label FROM shopping_list"; $result = $conn->query($sql); if ($result->num_rows > 0) { while($row=$result->fetch_array(MYSQLI_ASSOC)){ array_push($item_array, $row['label']); } } else { echo "<hr/><br/>500 - Internal Server Error. <br/> Cannot connect to MySQL. Please do proper setup of XAAMP again.<br/><hr/>"; }?><!DOCTYPE html><html lang="en"><head> <!-- Metadata --> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content="CS634 Midterm Project on Frequent Item set generation. This project highlight the use of Brute-force algorithm for frequent itemset generation and improvizes the frequent itemset generation by the use of Apriori frequent itemset generation algorithm. This also showcases the time taken by both versions, where in both algorithm generates same set of association mining rules after the frequent-itemlist generation."> <meta name="keywords" content="cs634, 634, data mining, jason wang, midterm project, apriori algorithm, frequent itemset, Brute-force frequent itemset"> <meta name="author" content="Rahul Gautham Putcha"> <title><?php echo $title;?></title> <!-- Styles: External (opensource) --> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous"> <link rel="preconnect" href="https://fonts.gstatic.com"> <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300&display=swap" rel="stylesheet"> <!-- Styles: Rahul Gautham Putcha --> <link href="./res/styles/style.css" rel="stylesheet" type="text/css"></head><body><!-- Sign-in / Signup page --> <header class="fixed-top"> <div class="d-flex flex-column flex-md-row align-items-center p-3 px-md-4 mb-3 navbar-dark bg-dark border-bottom box-shadow"> <h1 class="my-0 mr-md-auto font-weight-normal">NJIT MART</h1> <nav class="my-2 my-md-0 mr-md-3" > <a class="active p-1 text-light" href="./shopping.php">Shop Item</a> <a class="p-1 text-light" href="./itemset.php?itemset_method=bruteforce">Bruteforce</a> <a class="p-1 text-light" href="./itemset.php?itemset_method=apriori">Apriori</a> </nav> <a class="btn btn-outline-primary" href="./logout.php">Logout</a> </div> </header> <main class="p-3 container" style="margin-top: 125px;"> <div class="text-center h3"> Hello <?php echo $user; ?>, </div> <div class="header-text"> <h2>Shopping Items</h2> </div><br/><br/><br/> <div class="m-2 m-md-0"> <ul class="item-list row text-center"> <?php $item_count = count($item_array); for($i=0;$i<$item_count;$i++){ echo "<li class='item col-12 col-md-5 col-lg-3 m-1'><div></div><div class='p-3'><span class='label'>".$item_array[$i]."</span><button class='add'>Add</button></div></li>"; } ?> </ul> </div> <br/><br/><br/><br/><br/><br/><br/><br/><br/> </main> <footer class='text-center fixed-bottom bg-dark pb-2'> <div id="transaction-details" class="container-fluid px-md-5 py-md-2"> <div class="row"> <div class="col-12 col-md-4"> <strong style="font-size: 20px;">Total Items: <span id="total-items"></span></strong> </div> <div class="col-12 col-md-4"><button class="clear-cart"><u>Clear</u></button></div> <div class="col-12 col-md-4"> <button id="make-transaction">Make a Transaction</button> <form method="post" action="./add_transaction.php" style="position:absolute; z-index:-9999;visibility: hidden;"> <div id="cart-details"></div> <div><input type="submit" id="add_transaction" value="Send"></div> </form> </div> </div> </div> <div id="copyright" class="pt-2"><h6>© Copyright 2021-2022 | By Rahul Gautham Putcha<h6></div> </footer> <!-- Scripts: External (opensource) --> <script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.min.js" integrity="sha384-Atwg2Pkwv9vp0ygtn1JAojH0nYbwNJLPhwyoVbhoPwBhjQPR5VtM2+xf0Uwh9KtT" crossorigin="anonymous"></script> <!-- Styles: Rahul Gautham Putcha --> <script src="./res/script/script1.js"></script></body></html><?php }?>