-
Notifications
You must be signed in to change notification settings - Fork 0
/
orange.php
94 lines (85 loc) · 2.5 KB
/
orange.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
//ini_set('session.save_path', '/nfs/stak/students/o/ohaverd/session');
session_start();
include('imp.php');
?>
<!DOCTYPE html>
<html>
<head>
<title>Gold Hills Soapery</title>
<link rel="stylesheet" type="text/css" href="style.css">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
// inventory validation
$(document).ready(function(){
$(("#value")).keyup(function() {
var numpicked = $('#value').val();
var sname = "orange";
if(numpicked == "") {
$("#display").html("");
}
else {
$.ajax({
type: "POST",
url: "validate3.php",
data: { value: numpicked,
name: sname
},
success: function(html){
$("#display").empty();
$("#display").append(html);
}
});
return false;
}
});
});
</script>
</head>
<body>
<div id="navbar">
<a href="index.php">Home</a> |
<a href="soaps.php">Soaps</a> |
<a href="cart.php">Cart</a> |
<a href="index.php?action=logout">Log Out</a>
<div id="displaybal">
<?php
if (isset($_SESSION['balance'])) {
echo '<b>Balance:</b> $' . $_SESSION['balance'];
} ?></div>
</div>
<center><h3>Orange Cream</h3></center>
<div id="left">
<img src="orange.jpg">
</div>
<div id="right">
<p>This soap looks almost good enough to eat, and smells fantastic thanks to the liberal inclusion of orange oil along with a lovely mix of olive and coconut oils. A bright and refreshing way to start your day.
<p><b>Price: $4.99</b>
<p><form action="cart.php?action=orange" method="POST">
Quantity: <input type="number" min="0" name="num" id="value"><div id="display"><input type="submit" value="Add to cart"></div>
</form>
</div>
<div id="commentdiv">
<center><h4>Comments</h4></center>
<?php
$where = 'orange';
displayComments($where);
?>
</div>
<!--form should only appear if the user is logged in - no anonymous comments allowed-->
<div id="commentform">
<?php
if (isset($_SESSION['username'])) {
echo '<p><i>We love feedback! Feel free to leave a comment:</i>
<form action="comment.php" method="POST">
<p>Name: ' . $_SESSION['name'];
echo '<p>Comment:
<br><textarea rows="8" cols="30" maxlength="255" name="comment" id="comment"></textarea>
<input type="hidden" name="wherefrom" id="wherefrom" value="orange">
<br><input type="submit" value="Submit">
</form>';
}
?>
</div>
</body>
</html>