-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathilldir.php
executable file
·228 lines (218 loc) · 8.09 KB
/
illdir.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
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<?php
// illdir_search.php####
require '/var/www/seal_script/seal_function.php';
// check if an action has been requested
if (isset($_REQUEST['action'])) {
// set the pageaction to what has been requested
$pageaction = $_REQUEST['action'];
} else {
$pageaction = '0';
}
if (isset($_REQUEST['libname'])) {
$libname = $_REQUEST['libname'];
}else{
$libname='';
}
if (isset($_REQUEST['system'])) {
$system = $_REQUEST['system'];
}else{
$system='';
}
// Connect to database
require '/var/www/seal_script/seal_db.inc';
$db = mysqli_connect($dbhost, $dbuser, $dbpass);
mysqli_select_db($db, $dbname);
if (($_SERVER['REQUEST_METHOD'] == 'POST') || (isset($_GET{'page'}))) {
// Display the searched results
$libname = mysqli_real_escape_string($db, $libname);
//don't think i need this line 9/16/2022
//$libemail = mysqli_real_escape_string($db, $libemail);
$GETLISTSQL="SELECT * FROM `$sealLIB` WHERE `Name` LIKE '%$libname%' and `system` LIKE '%$system%' and participant = '1' ORDER BY Name Asc";
//echo $GETLISTSQL;
$retval = mysqli_query($db, $GETLISTSQL);
$GETLISTCOUNTwhole = mysqli_num_rows($retval);
$rec_limit = 50;
$rowpage = mysqli_fetch_array($retval, MYSQLI_NUM);
$rec_count = $rowpage[0];
//I don't think I need these two lines 9/16/2022
//$GETLIST = mysqli_query($db, $GETLISTSQL1);
//$GETLISTCOUNT = mysqli_num_rows($GETLIST);
// echo " $GETLISTCOUNTwhole results";
if (isset($_GET{'page'})) {
$page = $_GET['page'] + 1;
$offset = $rec_limit * $page ;
} else {
$page = 0;
$offset = 0;
}
$left_rec = $rec_count - ($page * $rec_limit);
$GETLISTSQL="$GETLISTSQL LIMIT $offset, $rec_limit";
// echo $GETLISTSQL;
$GETLIST = mysqli_query($db, $GETLISTSQL);
$GETLISTCOUNT = mysqli_num_rows($GETLIST);
} else {
$GETLISTSQL="SELECT * FROM `$sealLIB` where participant = '1' ORDER BY Name Asc";
$retval = mysqli_query($db, $GETLISTSQL);
$GETLISTCOUNTwhole = mysqli_num_rows($retval);
$rec_limit = 50;
$rowpage = mysqli_fetch_array($retval, MYSQLI_NUM);
$rec_count = $rowpage[0];
if (isset($_GET{'page'})) {
$page = $_GET['page'] + 1;
$offset = $rec_limit * $page ;
} else {
$page = 0;
$offset = 0;
}
$left_rec = $rec_count - ($page * $rec_limit);
$GETLISTSQL="$GETLISTSQL LIMIT $offset, $rec_limit";
// echo $GETLISTSQL;
$GETLIST = mysqli_query($db, $GETLISTSQL);
$GETLISTCOUNT = mysqli_num_rows($GETLIST);
}
?>
<h3>Search the directory</h3>
<form action="<?php echo "".$_SERVER['REDIRECT_URL']."?". $_SERVER['QUERY_STRING']."";?>" method="post">
<b>Library Name:</b> <input type="text" SIZE=60 MAXLENGTH=255 name="libname"><br>
<b>Library System:</b> <select name="system">
<option value=""></option>
<option value="DU">Dutchess BOCES</option>
<option value="MH">Mid-Hudson Library System</option>
<option value="OU">Orange Ulster BOCES</option>
<option value="RC">Ramapo Catskill Library System</option>
<option value="RB">Rockland BOCES</option>
<option value="SE">SENYLRC</option>
<option value="SB">Sullivan BOCES</option>
<option value="UB">Ulster BOCES</option>
</select>
<br>
<input type="submit" value="Submit">
</form>
<?php
// List All Libraries
echo "$GETLISTCOUNTwhole results<bR>";
echo "<div class='illDirTable'>";
echo "<div class='illDirTableRow'>";
$count = 1;
$rowcount =1;
while ($row = mysqli_fetch_assoc($GETLIST)) {
$libaddress2 = $row["address2"];
$libaddress3 = $row["address3"];
$libname = $row["Name"];
$libphone = $row["phone"];
$illemail = $row["ill_email"];
$libparticipant = $row["participant"];
$oclc = $row["oclc"];
$loc = $row["loc"];
$libsuspend = $row["suspend"];
$system = $row["system"];
if ($system =="MH") {
$system ="Mid-Hudson Library System";
} elseif ($system=="RC") {
$system ="Ramapo Catskill Library System";
} elseif ($system=="SE") {
$system ="Southeastern";
} elseif ($system=="OU") {
$system ="Orange Ulster BOCES";
} elseif ($system=="SB") {
$system="Sullivan BOCES";
} elseif ($system=="UB") {
$system="Ulster BOCES";
} elseif ($system=="RB") {
$system="Rockland BOCES";
} elseif ($system=="DU") {
$system="Dutchess BOCES";
} else {
$system="Unknow";
}
$book = $row["book_loan"];
$journal = $row["periodical_loan"];
$av = $row["av_loan"];
$reference = $row["theses_loan"];
$ebook = $row["ebook_request"];
$ejrnl = $row["ejournal_request"];
if ($libsuspend=="0") {
$libsuspend="Yes";
} else {
$libsuspend="No";
}
if ($libparticipant =="1") {
$libparticipant ="Yes";
} else {
$libparticipant ="No";
}
if ($book =="Yes") {
$book ="Yes";
} else {
$book ="No";
}
if ($journal =="Yes") {
$journal ="Yes";
} else {
$journal ="No";
}
if ($av =="Yes") {
$av ="Yes";
} else {
$av ="No";
}
if ($reference =="Yes") {
$reference ="Yes";
} else {
$reference ="No";
}
if ($ebook =="Yes") {
$ebook ="Yes";
} else {
$ebook ="No";
}
if ($ejrnl =="Yes") {
$ejrnl ="Yes";
} else {
$ejrnl ="No";
}
echo "<div class='illDirTableCell'>";
echo "Name: <strong> $libname</strong><br>";
echo "Address: <strong> $libaddress2 </strong><br>";
echo " <strong> $libaddress3 </strong><br>";
echo "Phone: <strong> $libphone</strong><br>";
echo "Library System:<strong> $system</strong><br>";
if ($user_id>0) {
echo "ILL Email(s): <a href='mailto:$illemail' target='_blank'>$illemail</a><br>";
}
echo "OCLC Symbol: <strong> $oclc</strong><br>";
echo "LOC Code: <strong> $loc</strong><br>";
echo "Accepting Requests: <strong> $libsuspend </strong>";
echo "<br><br>";
echo "<button onclick='showHide($count)'>Show loaning options</button><br><br>";
echo "<span class='loadoptions' id='showhide-$count' style='display: none'>";
echo "Loaning Print Book: <strong>$book</strong><br>";
echo "Loaning Print Journal or Article: <strong>$journal</strong><br>";
echo "Loaning Audio Video Materials: <strong>$av</strong><br>";
echo "Loaning Reference/Microfilm: <strong>$reference</strong><br>";
echo "Loaning Electronic Book: <strong>$ebook</strong><br>";
echo "Loaning Electronic Journal: <strong>$ejrnl</strong><br><br>";
echo "</div>"; // end the illDirTableCell
if ($count++ % 2 == 0) {
echo "</div>"; // end the illDirTableRow
if ($rowcount++ % 2 == 0) {
echo "<div class='illDirTableRow'>"; // Start the next illDirTableRow
} else {
echo "<div class='illDirTableRowGrey'>"; // Start the next illDirTableRow
}
//not sure why this is there 9/16/2022
//$no++;
}
}
echo "</div>"; // end the illDirTable
if (($page > 0) && (($offset + $rec_limit)<$GETLISTCOUNTwhole)) {
$last = $page - 2;
echo "<a href='".$_SERVER['REDIRECT_URL']."?page=$last\'>Last 50 Records</a> |";
echo "<a href='".$_SERVER['REDIRECT_URL']."?page=$page\'>Next 50 Records</a>";
} elseif (($page == 0) && ($GETLISTCOUNTwhole > $rec_limit)) {
echo "<a href='".$_SERVER['REDIRECT_URL']."?page=$page\'>Next 50 Records</a>";
} elseif (($left_rec < $rec_limit) && ($GETLISTCOUNTwhole > $rec_limit)) {
$last = $page - 2;
echo "<a href='".$_SERVER['REDIRECT_URL']."?page=$last\'>Last 50 Records</a>";
}
?>