Skip to content

Commit

Permalink
indentation + link
Browse files Browse the repository at this point in the history
  • Loading branch information
jeninyg committed Dec 5, 2021
1 parent 4466772 commit 6325df2
Show file tree
Hide file tree
Showing 12 changed files with 87 additions and 113 deletions.
64 changes: 32 additions & 32 deletions account/account.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
include("../includes/dbconnect.php");
include("../includes/dbconnect.inc.php");
// redirect to login page if not logged in
session_start();
if(!isset($_SESSION['userEmail'])){
Expand All @@ -17,39 +17,39 @@
<link rel="stylesheet" href="../styles/catalog.css">
<link rel="stylesheet" href="../styles/account.css">
</head>
<body>
<?php include("../includes/header2.inc.php"); ?>
<div class = "center-text ">
<h1> Account Information </h1>
</div>

<?php include("../includes/header2.php"); ?>
<div class = "center-text ">
<h1> Account Information </h1>
</div>
<?php
if($dbOK) {
$userEmail = $_SESSION['userEmail'];
$id = mysqli_real_escape_string($db, $id);
$result = $db->query($query);
$record = $result->fetch_assoc();

<?php
if($dbOK) {
$userEmail = $_SESSION['userEmail'];
// $id = mysqli_real_escape_string($db, $id);
$query = "SELECT * FROM users WHERE email = '$userEmail'";
$result = $db->query($query);
$record = $result->fetch_assoc();

$fname = $record['fname'];
$lname = $record['lname'];

echo '<div id = "outer">' ;
echo '<div id = "middle">';
echo '<strong>Name: </strong>'.$fname." ";
echo $lname;
echo '<br>';
echo '<strong>Email: </strong>'.$userEmail;
echo '</div>';
}
?>
<div id = "sellerlog">
<!-- show all books user sold -->
<a href="sellerCatalog.php"> My books </a> <br>
<!-- logout -->
<a href="logout.php">Logout</a>
</div>
</div>
$fname = $record['fname'];
$lname = $record['lname'];

echo '<div id = "outer">' ;
echo '<div id = "middle">';
echo '<strong>Name: </strong>'.$fname." ";
echo $lname;
echo '<br>';
echo '<strong>Email: </strong>'.$userEmail;
echo '</div>';
}
?>
<div id = "sellerlog">
<!-- show all books user sold -->
<a href="sellerCatalog.php"> My books </a> <br>
<!-- logout -->
<a href="logout.php">Logout</a>
</div>
</div>
</body>
</html>


Expand Down
7 changes: 2 additions & 5 deletions account/login.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
<?php
session_start();
include ('../includes/dbconnect.php');
include ('../includes/dbconnect.inc.php');
if ($dbOK) {
// if($_SERVER['REQUEST_METHOD'] == 'POST')
if (isset($_POST['submit']))
{
$email = $_POST['email'];
$password = $_POST['password'];

// error checking
$query = "select * from users where email = '$email'";
$result = $db->query($query);
$numRecords = $result->num_rows;

// echo mysqli_num_rows($result);
if($numRecords > 0)
{
$user_data = $result->fetch_assoc();
Expand Down Expand Up @@ -48,7 +45,7 @@

</head>
<body>
<?php include("../includes/header2.php"); ?>
<?php include("../includes/header2.inc.php"); ?>

<section class="center-items center-self body">
<h2 class="bold">Login</h2>
Expand Down
4 changes: 2 additions & 2 deletions account/sellerCatalog.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
</script>
</head>
<body>
<?php include("../includes/header2.php"); ?>
<?php include("../includes/header2.inc.php"); ?>

<!-- Show books-->
<div id="body">
<div id="books">
<h1 style="margin-left:20px;">Books</h1>
<div id="bookList">
<?php
include("../includes/dbconnect.php");
include("../includes/dbconnect.inc.php");
if ($dbOK){
$userEmail = $_SESSION['userEmail'];
// show all books sold by user
Expand Down
14 changes: 2 additions & 12 deletions account/signup.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
<?php
session_start();
include ('../includes/dbconnect.php');
include ('../includes/dbconnect.inc.php');

// if ($_SERVER['REQUEST_METHOD'] === 'POST')
if (isset($_POST['Submit']))
{
$fname = htmlspecialchars(trim($_POST['fname']));
$lname = htmlspecialchars(trim($_POST['lname']));
$email = htmlspecialchars(trim($_POST['email']));
// can you do this for a password?
$pass = htmlspecialchars($_POST['password']);


// $query = "insert into users(fname, lname, email, password) values('$fname', '$lname', '$email', '$pass')";
$insQuery = "insert into users(fname, lname, email, password) values(?,?,?,?)";
$statement = $db->prepare($insQuery);
$statement->bind_param("ssss", $fname, $lname, $email, $pass);
Expand All @@ -39,10 +35,7 @@
<script type="text/javascript" src="../scripts/form-validation.js"></script>
</head>
<body>
<?php include("../includes/header2.php"); ?>



<?php include("../includes/header2.inc.php"); ?>
<section class="center-items center-self body">
<h2 class="bold">Sign Up</h2>
<form name="signup" class="form" action="#" method="post"
Expand All @@ -51,13 +44,10 @@
<input type="text" id="lname" name="lname" placeholder="Last Name:" class="left"><br>
<input type="email" id="email" name="email" placeholder="RPI Email:" class="left"><br>
<input type="password" id="password" name="password" placeholder="Password:" class="left"><br>

<!-- can you make this button bigger? -->
<input type="submit" name="Submit" value="Submit">
</form>
<button type="button" onclick="window.location.href='login.php'" class="button">Back to Login</button>
</section>

<footer>
</footer>
</body>
Expand Down
103 changes: 45 additions & 58 deletions catalog/bookInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>TextbookBuddy</title>
<!-- <link rel="stylesheet" href="../styles/login.css"> -->
<link rel="stylesheet" href="../styles/general.css">
<link rel="stylesheet" href="../styles/bookinfo.css">

Expand All @@ -15,60 +14,48 @@
</script>
</head>
<body>
<header>
<a href="../"> <h1 class="logo left"> Textbook Buddy </h1> </a>
<ul class="hmenu right">
<a href="catalog.php"><li>Catalog</li></a>
<a href="uploadBooks.php"><li>Sell</li></a>
<a href="../account/account.php"><li>Account</li></a>
</ul>
</header>


<?php
include("../includes/dbconnect.php");

if($dbOK) {
$id = $_GET['id'];
// $id = mysqli_real_escape_string($db, $id);
$query = "SELECT * FROM books WHERE id = $id limit 1";
$result = $db->query($query);
$record = $result->fetch_assoc();

$title = $record['title'];
$authors = $record['authors'];
$isbn = $record['isbn'];
$subj = $record['subjectCode'];
$condition = $record['condition'];
$desc = $record['desc'];
$file = $record['imgID'];
$price = $record['price'];

echo "<div id='item'>";
echo "<img src='../resources/bookImg/$file'>";


echo "<div id='bookInfo'>";

echo '<h1>'.$title.'</h1>';
echo '<br>';
echo '<strong>Authors:</strong>'.$authors;
echo '<br>';
echo '<strong>ISBN:</strong>'.$isbn;
echo '<br>';
echo '<strong>Subject Code:</strong>'.$subj;
echo '<br>';
echo '<strong>Condition:</strong>'.$condition;
echo '<br>';
echo '<strong>Description:</strong>'.$desc;
echo '<br>';
echo '<strong>Subject Code:</strong>'.$price.'$';
echo '</div>';
echo "</div>";





}
?>
<?php include("../includes/header.inc.php"); ?>
<?php
include("../includes/dbconnect.php");

if($dbOK) {
$id = $_GET['id'];
// $id = mysqli_real_escape_string($db, $id);
$query = "SELECT * FROM books WHERE id = $id limit 1";
$result = $db->query($query);
$record = $result->fetch_assoc();

$title = $record['title'];
$authors = $record['authors'];
$isbn = $record['isbn'];
$subj = $record['subjectCode'];
$condition = $record['condition'];
$desc = $record['desc'];
$file = $record['imgID'];
$price = $record['price'];

echo "<div id='item'>";
echo "<img src='../resources/bookImg/$file'>";


echo "<div id='bookInfo'>";

echo '<h1>'.$title.'</h1>';
echo '<br>';
echo '<strong>Authors:</strong>'.$authors;
echo '<br>';
echo '<strong>ISBN:</strong>'.$isbn;
echo '<br>';
echo '<strong>Subject Code:</strong>'.$subj;
echo '<br>';
echo '<strong>Condition:</strong>'.$condition;
echo '<br>';
echo '<strong>Description:</strong>'.$desc;
echo '<br>';
echo '<strong>Subject Code:</strong>'.$price.'$';
echo '</div>';
echo "</div>";
}
?>
</body>
</html>
2 changes: 1 addition & 1 deletion catalog/catalog.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</script>
</head>
<body>
<?php include("../includes/header.php"); ?>
<?php include("../includes/header.inc.php"); ?>

<!-- Show books-->
<div id="body">
Expand Down
2 changes: 1 addition & 1 deletion catalog/filters.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
include ('../includes/dbconnect.php');
include ('../includes/dbconnect.inc.php');
$where = array();
?>

Expand Down
4 changes: 2 additions & 2 deletions catalog/uploadBooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
die();
}

include("../includes/dbconnect.php");
include("../includes/dbconnect.inc.php");

$userEmail= $_SESSION['userEmail'];

Expand Down Expand Up @@ -78,7 +78,7 @@
</script>
</head>
<body>
<?php include("../includes/header.php"); ?>
<?php include("../includes/header.inc.php"); ?>
<section class="">
<h2 class="bold"> Sell Book </h2>

Expand Down
File renamed without changes.
Empty file removed includes/functions.php
Empty file.
File renamed without changes.
File renamed without changes.

0 comments on commit 6325df2

Please sign in to comment.