-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmyitems.php
More file actions
110 lines (84 loc) · 2.53 KB
/
myitems.php
File metadata and controls
110 lines (84 loc) · 2.53 KB
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php
//NOTDONE
//
// GiftWeb: PHP/PostgreSQL online Gift Registry System
// Matthew T. Jachimstal
// Copyright (C) 2000-2008 Matthew T. Jachimstal
//
// email: matthew@jachimstal.com
//
// Snail mail: Matthew Jachimstal
// 1106 Canterbury Ct, Unit D
// Elgin, IL 60120
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
//
require "./main.inc";
require "./util.php";
$s = $_COOKIE["GiftWeb_Session"];
$uid = validatesession($s);
$conn = ADONewConnection($dbtype);
$conn->PConnect($dbhost, $dbuser, $dbpass, $dbname);
startpage("myPurchases", "My Purchased items");
// doesn't need to be a function call, but we might want to do something
// further on this page in the future, and this makes expansion easier.
show_purchased_items();
function show_purchased_items()
{
global $conn;
global $uid;
$sql = "SELECT DISTINCT uid FROM items WHERE purchased='$uid'";
$result = $conn->Execute($sql);
echo "<div id=\"mainContent\">\n";
//echo "<div class=\"contentHead\">";
echo "<h1>";
echo "My Purchased Items";
echo "</h1>";
//echo "</div>\n";
if ($result->RecordCount() == 0)
{
echo "You have not purchased any items yet.";
echo "</div>";
endpage(1);
exit(0);
}
echo "<ul class=\"people\">\n";
while (!$result->EOF)
{
$user = $result->fields["uid"];
$sql = "SELECT * FROM users WHERE uid='$user'";
$result2 = $conn->Execute($sql);
$name = chop($result2->fields["last_name"]);
$name .= ", " . chop($result2->fields["first_name"]);
echo "<li>$name\n";
$sql = "SELECT * FROM items WHERE uid='$user' and purchased='$uid'";
$result3 = $conn->Execute($sql);
echo "<ul class=\"purchases\">\n";
while (!$result3->EOF)
{
$item = $result3->fields["description"];
echo "<li>$item</li>\n";
$result3->MoveNext();
}
echo "</ul>\n";
echo "</li>\n";
$result->MoveNext();
}
echo "</ul>\n";
echo "</div>\n";
}
endpage(1);
?>