Skip to content

Commit

Permalink
more books, minor css updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jeninyg committed Dec 5, 2021
1 parent f8f75b0 commit 6ec6065
Show file tree
Hide file tree
Showing 14 changed files with 62 additions and 79 deletions.
12 changes: 6 additions & 6 deletions account/account.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@
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 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
17 changes: 10 additions & 7 deletions catalog/bookInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<body>
<?php include("../includes/header.inc.php"); ?>
<?php
include("../includes/dbconnect.php");
include("../includes/dbconnect.inc.php");

if($dbOK) {
$id = mysqli_real_escape_string($db, $_GET['id']);
Expand All @@ -32,6 +32,7 @@
$desc = $record['desc'];
$file = $record['imgID'];
$price = $record['price'];
$contact = $record['sellerEmail'];

echo "<div id='item'>";
echo "<img src='../resources/bookImg/$file'>";
Expand All @@ -41,17 +42,19 @@

echo '<h1>'.$title.'</h1>';
echo '<br>';
echo '<strong>Authors:</strong>'.$authors;
echo '<strong>Authors:</strong> '.$authors;
echo '<br>';
echo '<strong>ISBN:</strong>'.$isbn;
echo '<strong>ISBN:</strong> '.$isbn;
echo '<br>';
echo '<strong>Subject Code:</strong>'.$subj;
echo '<strong>Subject Code:</strong> '.strtoupper($subj);
echo '<br>';
echo '<strong>Condition:</strong>'.$condition;
echo '<strong>Condition:</strong> '.$condition;
echo '<br>';
echo '<strong>Description:</strong>'.$desc;
echo '<strong>Description:</strong> '.$desc;
echo '<br>';
echo '<strong>Subject Code:</strong>'.$price.'$';
echo '<strong>Price: </strong> '.'$'.$price;
echo '<br>';
echo '<strong>Contact: </strong> '. $contact;
echo '</div>';
echo "</div>";
}
Expand Down
15 changes: 7 additions & 8 deletions catalog/uploadBooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@

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

$userEmail= $_SESSION['userEmail'];

// if ($_SERVER["REQUEST_METHOD"] === 'POST')
if (isset($_POST['submit']))
{
$userEmail= mysqli_real_escape_string($db, $_SESSION['userEmail']);

$title = htmlspecialchars(trim($_POST['title']));
$authors = htmlspecialchars(trim($_POST['authors']));
Expand All @@ -37,14 +35,14 @@

$imgExt = array('jpeg', 'jpg', 'png');


if (!in_array($fileExt, $imgExt) or !$fileError === 0 or $filesize >= 10000000){
echo "Error with file, please upload a different file";
die();
echo "Error with file, please upload a different file. File must be of typpe jpep, jpg, or png. File size must be under 10MB. Your file size is ";
echo $filesize. ".";
}

$uploads_dir = "../resources/bookImg";
$imgIdentifier= $subj .'-'. rand(999999999, 9999999999).'.'.$fileExt;
echo $imgIdentifier;
move_uploaded_file($tmploc, $uploads_dir.'/'.$imgIdentifier);

$insQuery = "insert into books(imgID, title, authors, isbn, subjectCode, `condition`, `desc`, price, `sellerEmail`) values(?,?,?,?,?,?,?,?,?)";
Expand All @@ -54,9 +52,10 @@
$statement->close();

if ($success) {
echo "success";
echo "Your file was successfully uploaded";
} else {
echo "Error on server, please try again";
echo "Sorry " . $userEmail;
echo "There was an error on our server, please try again";
}
}

Expand Down
Binary file added resources/bookImg/astr-6038484371.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/bookImg/econ-1658630216.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/bookImg/math-2371036874.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
14 changes: 9 additions & 5 deletions resources/items.sql
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
delete from books;
delete from users;

insert into users values(1, "", "", "[email protected]", "admin");
insert into users values(1, "admin", "", "[email protected]", "admin");
insert into users values(2, "Jane", "Koy", "[email protected]", "firstUser1!");

INSERT INTO `books` (`id`, `imgID`, `title`, `authors`, `isbn`, `subjectCode`, `condition`, `desc`, `price`, `sellerEmail`) VALUES
(1, 'csci-2844507230.jpg', 'Algorithms', 'Sanjoy Dasgupta, Christos Papadimitriou, Umesh Vazirani', '978-0073523408', 'csci', 'good', 'includes handwritings+highlightings', '15.00', '[email protected]'),
(2, 'biol-8129677909.jpg', 'Essential Cell Biology', 'Bruce Alberts, Karen Hopkin, Alexander Johnson, David Morgan, Martin Raff, Keith Roberts, Peter Walter', '978-0393680379', 'biol', 'fair', 'includes handwritings+highlightings', '20.00', '[email protected]'),
(3, 'csci-5109354294.jpg', 'Practical Programming', 'Paul Gries, Jennifer Campbell, Jason Montojo', '9781680502688', 'csci', 'new', 'csci1100, lightly used', '30.00', '[email protected]');
(4, 'mgmt-5123364294.jpg', 'Principiles of Management', 'David S Bright, Anastasia H Cortes, Eva Hartmann', '9384781502789', 'mgmt1100', 'new', 'lightly used', '30.00', '[email protected]'),
(5, 'econ-5345574294.jpg', 'Principles of Microeconomics', 'N. Gregory Mankiw', '9384781502789', '9384781502789', 'econ', 'fair', 'used', '30.00', '[email protected]'),
(6, 'calc-5234973584.jpg', 'Calculus Third Edition', 'William L Briggs, William Briggs, Lyle Cochran, Bernard Gillett, Eric L Schulz, Eric Schulz', '9234690702489', 'math', 'fair', 'used', '30.00', '[email protected]');
(3, 'csci-5109354294.jpg', 'Practical Programming', 'Paul Gries, Jennifer Campbell, Jason Montojo', '9781680502688', 'csci', 'new', 'csci1100, lightly used', '30.00', '[email protected]'),
(4, 'mgmt-5123364294.jpg', 'Principiles of Management', 'David S Bright, Anastasia H Cortes, Eva Hartmann', '9384781502789', 'mgmt1100', 'new', 'shrink wrap included', '45.00', '[email protected]'),
(5, 'econ-5345574294.jpg', 'Principles of Microeconomics', 'N. Gregory Mankiw', '9384781502789', 'econ', 'fair', 'some water damage but all pages inact', '30.00', '[email protected]'),
(6, 'math-5234973584.jpg', 'Calculus Third Edition', 'William L Briggs, William Briggs, Lyle Cochran, Bernard Gillett, Eric L Schulz, Eric Schulz', '9234690702489', 'math', 'fair', 'used', '55.99', '[email protected]'),
(7, 'astr-6038484371.jpg', 'Foundations of Astrophysics', 'Barbara S. Ryden, Bradley M. Peterson', '978-0321595584', 'astr', 'poor', '&quot;Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit i', '15.75', '[email protected]'),
(8, 'econ-1658630216.jpg', 'Intermediate Microeconomics: A Modern Approach', 'Hal R. Varian', '978-0393934243', 'econ', 'poor', '&quot;Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit i', '21.00', '[email protected]'),
(9, 'math-2371036874.jpg', 'Introduction to Linear Algebra', 'Gilbert Strang', '978-1733146654', 'math', 'very good', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis', '87.34', '[email protected]');
21 changes: 2 additions & 19 deletions resources/textbookBuddy.sql
Original file line number Diff line number Diff line change
Expand Up @@ -48,28 +48,11 @@ CREATE TABLE books(
, authors VARCHAR(1000)
, isbn VARCHAR(20)
, subjectCode CHAR(4)
, `condition` CHAR(4)
, `condition` CHAR(9)
, `desc` text
, price numeric(5, 2)
, sellerEmail VARCHAR(20) not null
, FOREIGN KEY (`condition`) references `conditions`(`condition`) on delete set null
, FOREIGN KEY (subjectCode) references subjects(subjectCode) on delete set null
, FOREIGN KEY (sellerEmail) references users(email) on delete cascade
);

-- user reserve books
-- functionality not yet created
CREATE TABLE reservebooks(
buyerEmail VARCHAR(20) not null
, bookID INT not null
, FOREIGN KEY (buyerEmail) references users(email) on delete cascade
, FOREIGN KEY (bookID) references books(id) on delete cascade

)

-- will need this if we want to allow multiple images
-- CREATE TABLE BookIMG (
-- bookID INT
-- , ImgNo INT primary key NOT NULL
-- , FOREIGN KEY (bookID) references books(bookID) on delete cascade
-- )
);
15 changes: 6 additions & 9 deletions styles/account.css
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
#outer {
margin: auto;
margin-top: 20px;
width: 50%;
padding: 10px;
background-color: whitesmoke;
border: 10px solid blueviolet;
background-color: #f4f7f8;
border: 10px solid #a8d5f8;
padding: 20px;
height: 100px;

}

#middle{
font-size: 2em;
font-variant: small-caps;
font-weight: bold;
bottom: 200px;
left: 650px;
float: left;
margin-right: 250px;
}

#sellerlog{
font-size: 2em;
margin-left: 600px;
margin-top: -75px;
}
}
27 changes: 10 additions & 17 deletions styles/bookinfo.css
Original file line number Diff line number Diff line change
@@ -1,27 +1,20 @@
#item{
position:relative;




position:relative;
width: 80%;
margin: auto;
}

img {
width:250px;
width:350px;
position:absolute;
top:10px;
left:10px;


top:10px;
left:10px;
}

#bookInfo{
position:absolute;
background-color: green;
top:10px;
left:310px;




background-color: #a8d5f8;
top:50px;
left:400px;
padding: 10px;
}
17 changes: 10 additions & 7 deletions styles/general.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
/*
COLOR PALETTE -- CSS HEX
--aqua-haze: #f4f7f8;
--geyser: #cedcdd;
--picton-blue: #449fee;
--sail: #a8d5f8;
--jordy-blue: #8cccf4;
--link-water: #cee6f3;
--geyser: #dce4e6;
--aqua-haze: #f4f7f8;
--geyser: #cedcdd;
--picton-blue: #449fee;
--sail: #a8d5f8;
--jordy-blue: #8cccf4;
--link-water: #cee6f3;
--geyser: #dce4e6;
*/

*{
Expand Down Expand Up @@ -74,6 +76,7 @@ header a {
.logo {
float:left;
padding: 25px 0 5px 20px;
color: #449fee;
}

.hmenu {
Expand Down
2 changes: 1 addition & 1 deletion styles/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ img{

#welcomeDesc {
margin-left: 52%;
}
}
1 change: 1 addition & 0 deletions styles/login.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ h2 {
padding-bottom: 1vw;
font-variant: small-caps;
font-size: 3.5vw;
color: #449fee;
}

.body {
Expand Down

0 comments on commit 6ec6065

Please sign in to comment.