-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
47 lines (39 loc) · 1.43 KB
/
index.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
<?php
require_once(dirname(__FILE__).'/inc/init.php');
header('Content-Type: text/html; charset=utf-8');
?>
<html>
<head>
<title>Amazon Watch</title>
<link rel="stylesheet" type="text/css" href="inc/style.css" />
</head>
<body>
<form action="" method="post">
<fieldset>
<legend>Monitor Search Results</legend>
<label for="query">Search for</label>
<input type="text" name="query" id="query" />
<label for="region">at</label>
<select name="region" id="region">
<option value="com">Amazon.com</option>
<option value="de">Amazon.de</option>
<option value="co.uk">Amazon.co.uk</option>
<option value="fr">Amazon.fr</option>
<option value="jp">Amazon.jp</option>
</select>.<br />
<input type="submit" value="Create Monitor Feed" />
</fieldset>
</form>
<?php
if($_REQUEST['query']){
$ins = $PDO->prepare('INSERT INTO search (query,region) VALUES (?,?)');
$ins->execute(array($_REQUEST['query'],$_REQUEST['region']));
$sid = $PDO->lastInsertId();
echo '<p>Your search term will now be monitored for three months.
All found products will be added to the following RSS feed:</p>';
echo '<a href="searchrss.php?sid='.$sid.'" target="_blank">Amazon Watch Feed</a>';
echo '<p>Please subscribe to the feed to be informed when Amazon adds new
products matching your query.</p>';
}
?>
</body>