-
Notifications
You must be signed in to change notification settings - Fork 244
/
Copy pathsubmit.php
75 lines (59 loc) · 2.22 KB
/
submit.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
<!DOCTYPE html>
<html>
<head>
<title>Maya Online Books</title>
<link rel="apple-touch-icon" href="appicon.png" />
<link rel="apple-touch-startup-image" href="startup.png">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="viewport" content="width=device-width, user-scalable=no" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="banner"></div>
<?php
include("menu.php");
?>
<div class="orderarea">
<?php
include("config.php");
function sendmail($email, $name, $title)
{
$to = $email;
$subject = 'Maya Order Confirmation';
$message = 'Hello '.$name.',<br /><br />This email is to confirm your order for the following book from Maya:<br /><br /><strong>'.$title.'</strong><br /><br />Please wait for the next update email which will contain shipping information.';
$headers = 'From: Maya Book Service <[email protected]>' . "\r\n" .
'MIME-Version: 1.0' . "\r\n" .
'Content-type: text/html; charset=iso-8859-1' . "\r\n" .
'Reply-To: Maya Book Service <[email protected]>' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
}
// Take in parameters
$name = $_POST["name"];
$book = $_POST["book"];
$email = $_POST["email"];
$t = time();
// Insert into orders
// but oops query is not defined... yet
$query = "";
$result = mysql_query($query);
if ($result) {
// What do the following lines do? Answer -> #1
$query2 = "SELECT * from books where asin = '".$book."'";
$result2 = mysql_query($query2);
$row2 = mysql_fetch_assoc($result2);
sendmail($email, $name, $row2["title"]);
echo "<p>Thank you for ordering a book. Please check your email for further instructions.</p>";
}
?>
</div>
<script type="text/javascript">
$("a").click(function (event) {
event.preventDefault();
window.location = $(this).attr("href");
});
</script>
</body>
</html>