-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathviewusers.php
More file actions
175 lines (148 loc) · 4.35 KB
/
viewusers.php
File metadata and controls
175 lines (148 loc) · 4.35 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<?php
// 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";
$conn = ADONewConnection($dbtype);
$conn->PConnect($dbhost, $dbuser, $dbpass, $dbname);
$s = $_COOKIE["GiftWeb_Session"];
$uid = validatesession($s);
$sql = "SELECT write_only FROM users where uid='$uid'";
$wo_result = $conn->Execute($sql);
$wo_result->MoveFirst();
if($wo_result->fields["write_only"] == "t")
{
redir("./main.php", "the main GiftWeb page", 3);
exit();
}
$sql = "SELECT distinct gid FROM members AS m, users AS u ";
$sql .= "WHERE m.uid=u.uid AND m.request='f' AND u.uid='$uid'";
$result1 = $conn->Execute($sql);
if ($result1->RecordCount() < 1)
{
startpage_old("Not a member of any group", 0);
?>
<h3>You are not a member of any groups.</h3>
<?php
redir("./main.php", "the main GiftWeb page", 3);
endpage_old(0);
exit();
}
startpage_old("View other users' lists", 3);
?>
<form method="post" action="printlist.php">
<?php
$result1->MoveFirst();
while (!$result1->EOF)
{
$gid = $result1->fields["gid"];
$sql = "SELECT * FROM groups WHERE gid='$gid'";
$result = $conn->Execute($sql);
$g_desc = $result->fields["description"];
?>
<h2>Group: <?php echo $g_desc?></h2>
<table>
<tr>
<th></th> <?php //Spacer for shifting users to the right?>
<th></th>
<th></th>
<th width=3%></th>
<th>Items</th>
<th width=3%></th>
<th>Last Updated</th>
</tr>
<?php
$sql = "SELECT distinct u.uid AS uid, u.last_name AS last_name,";
$sql .= "u.first_name AS first_name ";
$sql .= " FROM users AS u, members AS m";
$sql .= " WHERE m.gid='$gid' AND m.uid=u.uid";
$sql .= " AND m.prim='t' AND m.request='f' AND u.uid != '$uid'";
$sql .= " ORDER BY last_name, first_name";
$result2 = $conn->Execute($sql);
if (!$result2)
{
print $conn->ErrorMsg();
}
if ($result1->RecordCount() == 0)
{
echo "<td></td>\n";
}
$result2->MoveFirst();
while (!$result2->EOF)
{
$userid = $result2->fields["uid"];
$sql3 = "SELECT * FROM users ";
$sql3 .= "WHERE uid='$userid'";
$result3 = $conn->Execute($sql3 );
$name = chop($result3->fields["last_name"]);
$name .= ", " . chop($result3->fields["first_name"]);
$date = chop($result3->fields["updated"]);
if ($date == "2001-01-01")
{
$date = "";
}
$sql = "SELECT count(*) AS count FROM items where uid='$userid' ";
$sql .= "and added='f'";
$result4 = $conn->Execute($sql);
$it_cnt = $result4->fields["count"];
?>
<tr><td width=10%></td>
<td><input type=checkbox name="userlist[]"
value="<?php echo $userid?>"></td>
<td><a href="./viewlist.php?u=<?php echo $userid?>">
<?php echo $name?></td>
<td></td>
<td align=center><?php echo $it_cnt?></td>
<td></td>
<td align=center><?php echo $date?></td>
</tr>
<?php
$result2->MoveNext();
}
echo "</table><hr width=50%>\n";
$result1->MoveNext();
}
?>
<input type="checkbox" name="stores" CHECKED>Include stores/URLs on list.
<br>
<input type="submit" name="submit" value="View Lists of Selected People">
<input type="reset" value="Clear Selection">
</form>
<p>
<table>
<tr><td width=50%>
This option will produce a combined list of all selected users, showing
only the items on their lists that have not been purchased yet.
You will not be able to mark an item as
purchased. This is intended to produce a list in a format that will
look better when printed.</td>
<td width=50%> </td></tr>
</table>
<?php
echo "<h2> </h2>";
endpage_old(2);
?>