-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlibprofile.php
executable file
·279 lines (262 loc) · 11.5 KB
/
libprofile.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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script>
$(document).ready(function() {
$("#datepicker").datepicker();
});
</script>
<?php
require '/var/www/seal_script/seal_function.php';
//Get loc from user profile
$loc=$field_loc_location_code ;
// 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') {
$timestamp = date("Y-m-d H:i:s");
$libname=$_REQUEST["libname"];
$libemail=$_REQUEST["libemail"];
$phone=$_REQUEST["phone"];
$address1=$_REQUEST["address1"];
$address2=$_REQUEST["address2"];
$address3=$_REQUEST["address3"];
$oclc=$_REQUEST["oclc"];
$suspend=$_REQUEST["suspend"];
$book=$_REQUEST["book"];
$av=$_REQUEST["av"];
$journal=$_REQUEST["journal"];
$ebook=$_REQUEST["ebook"];
$ejournal=$_REQUEST["ejournal"];
$reference=$_REQUEST["reference"];
$enddated = $_REQUEST["enddate"];
$lbsyscourier = $_REQUEST["lbsyscourier"];
$lbUSPS = $_REQUEST["lbUSPS"];
$lbEmpire = $_REQUEST["lbEmpire"];
$lbCommCourier = $_REQUEST["lbCommCourier"];
$lastmodemail = $email;
$libname = mysqli_real_escape_string($db, $libname);
$libemail =mysqli_real_escape_string($db, $libemail);
$phone = mysqli_real_escape_string($db, $phone);
$address1 =mysqli_real_escape_string($db, $address1);
$address2 =mysqli_real_escape_string($db, $address2);
$address3 =mysqli_real_escape_string($db, $address3);
$oclc = mysqli_real_escape_string($db, $oclc);
$suspend = mysqli_real_escape_string($db, $suspend);
$book = mysqli_real_escape_string($db, $book);
$journal = mysqli_real_escape_string($db, $journal);
$av = mysqli_real_escape_string($db, $av);
$ebook = mysqli_real_escape_string($db, $ebook);
$ejournal = mysqli_real_escape_string($db, $ejournal);
$reference = mysqli_real_escape_string($db, $reference);
$oclc = trim($oclc);
$libemail=trim($libemail);
// If suspenson is set with no end date, a default one of 7 days is calulated
if (($suspend==1)&&(strlen($enddated)<2)) {
$enddated = strtotime("+7 day");
$enddated = date('Y-m-d', $enddated);
} else {
$enddated = date('Y-m-d', strtotime(str_replace('-', '/', $enddated)));
}
$sqlupdate = "UPDATE `$sealLIB` SET Name = '$libname', `ill_email` ='$libemail',suspend=$suspend,phone='$phone',address1='$address1',address2='$address2',address3='$address3',oclc='$oclc',book_loan='$book',periodical_loan='$journal',av_loan='$av',ebook_request='$ebook',ejournal_request='$ejournal',theses_loan='$reference',SuspendDateEnd='$enddated',ModifyDate='$timestamp', ModEmail='$lastmodemail', lbsyscourier='$lbsyscourier', lbUSPS='$lbUSPS', lbEmpire='$lbEmpire', lbCommCourier='$lbCommCourier' WHERE `loc` ='$loc'";
//for testing
// echo $sqlupdate;
$result = mysqli_query($db, $sqlupdate);
echo "Library Had Been Edited<br><br>";
echo "<a href='/user'>Return to My Account</a>";
} else {
$GETLISTSQL="SELECT * FROM `$sealLIB` WHERE `loc` ='$loc' limit 1 ";
$GETLIST = mysqli_query($db, $GETLISTSQL);
$GETLISTCOUNT = '1';
while ($row = mysqli_fetch_assoc($GETLIST)) {
$libname = $row["Name"];
$libalias = $row["alias"];
$libemail = $row["ill_email"];
$oclc = $row["oclc"];
$loc = $row["loc"];
$phone = $row["phone"];
$address1 = $row["address1"];
$address2 = $row["address2"];
$address3 = $row["address3"];
$libparticipant = $row["participant"];
$libsuspend = $row["suspend"];
$system = $row["system"];
$book = $row["book_loan"];
$reference = $row["theses_loan"];
$av = $row["av_loan"];
$ebook = $row["ebook_request"];
$ejournal = $row["ejournal_request"];
$journal = $row["periodical_loan"];
$enddate = $row["SuspendDateEnd"];
$timestamp = $row["ModifyDate"];
$lastmodemail = $row["ModEmail"];
$libilliad = $row["Illiad"];
$libilliaddate = $row["IlliadDATE"];
$libemailalert = $row["LibEmailAlert"];
$lbsyscourier = $row["lbsyscourier"];
$lbUSPS = $row["lbUSPS"];
$lbEmpire = $row["lbEmpire"];
$lbCommCourier = $row["lbCommCourier"];
}
if ($loc != 'null') {
?>
<form action="/libprofile?<?php echo $_SERVER['QUERY_STRING']; ?>" method="post">
<B>Library Name:</b> <input type="text" SIZE=60 MAXLENGTH=255 name="libname" value="<?php echo $libname?>"><br>
<B>Library Alias:</b> <?php echo $libalias?><br>
<B>Library ILL Email:</b> <input type="text" SIZE=60 MAXLENGTH=255 name="libemail" value="<?php echo $libemail?>"><br>
<B>Library Phone:</b> <input type="text" SIZE=60 MAXLENGTH=255 name="phone" value="<?php echo $phone?>"><br>
<B>Library Address Dept:</b> <input type="text" SIZE=60 MAXLENGTH=255 name="address1" value="<?php echo $address1?>"><br>
<B>Library Address Street:</b> <input type="text" SIZE=60 MAXLENGTH=255 name="address2" value="<?php echo $address2?>"><br>
<B>Library Address City, State and Zip:</b> <input type="text" SIZE=60 MAXLENGTH=255 name="address3" value="<?php echo $address3?>"><br>
<B>OCLC Symbol:</b> <input type="text" SIZE=60 MAXLENGTH=255 name="oclc" value="<?php echo $oclc?>"><br>
<B>LOC Location:</b> <?php echo $loc?><br>
<B>Lib Email Alert: </b> <?php if ($libemailalert=='1') {
echo "Yes";
} else {
echo "No";
} ?><br>
<B>Lib Illiad API: </b> <?php if ($libilliad=='1') {
echo "Yes";
} else {
echo "No";
} ?><br>
<b>ILLiad Due Date Days:</b> <?php echo $libilliaddate?><br>
<?php if($system=="DU") { $system="Dutchess BOCES";
}?>
<?php if($system=="MH") { $system="Mid-Hudson Library System";
}?>
<?php if($system=="OU") { $system="Orange Ulster BOCES";
}?>
<?php if($system=="RC") { $system="Ramapo Catskill Library System";
}?>
<?php if($system=="RB") { $system="Rockland BOCES";
}?>
<?php if($system=="SE") { $system="SENYLRC";
}?>
<?php if($system=="SB") { $system="Sullivan BOCES";
}?>
<B>Library System:</b> <?php echo $system?><br>
<br>
<B>Suspend Your Library's lending status? </b><select name="suspend"> <option value="0" <?php if ($libsuspend=="0") {
echo "selected=\"selected\"";
} ?>>No</option><option value="1" <?php if ($libsuspend=="1") {
echo "selected=\"selected\"";
} ?>>Yes</option></select><br>    Setting this to <strong>YES</strong> will <strong>prevent</strong> your library from getting ILL requests<br>    Setting this to <strong>NO</strong> will <strong>allow</strong> your library to receive ILL requests.<br>
Suspension End Date:
<input id="datepicker" name="enddate"/>
<strong><br><br>****If no date is picked, the system will default to seven (7) days****</strong>
<br><br>
<?php
if ($libsuspend=="1") {
echo "".$libname." <strong>will not receive</strong> requests until <strong>".$enddate."</strong><br>";
} else {
echo "".$libname." is <strong>currently receiving</strong> requests.<br>";
} ?>
<br><br>
<h6>Delivery Option:</h6>
<table>
<tr>
<td><b>Empire Delivery</b><td>
<input type="radio" name="lbEmpire" value="Yes" <?php if ($lbEmpire=="Yes") {
echo "checked";
} ?>> Yes
<input type="radio" name="lbEmpire" value="No" <?php if ($lbEmpire=="No") {
echo "checked";
} ?>> No <br>
</td></tr>
<tr>
<td><b>Public Library System Courier (MHLS or RCLS)</b><td>
<input type="radio" name="lbsyscourier" value="Yes" <?php if ($lbsyscourier=="Yes") {
echo "checked";
} ?>> Yes
<input type="radio" name="lbsyscourier" value="No" <?php if ($lbsyscourier=="No") {
echo "checked";
} ?>> No <br>
</td></tr>
<tr>
<td><b>US Mail</b><td>
<input type="radio" name="lbUSPS" value="Yes" <?php if ($lbUSPS=="Yes") {
echo "checked";
} ?>> Yes
<input type="radio" name="lbUSPS" value="No" <?php if ($lbUSPS=="No") {
echo "checked";
} ?>> No <br>
</td></tr>
<tr>
<td><b>Commercial Courier (UPS or FEDEX)</b><td>
<input type="radio" name="lbCommCourier" value="Yes" <?php if ($lbCommCourier=="Yes") {
echo "checked";
} ?>> Yes
<input type="radio" name="lbCommCourier" value="No" <?php if ($lbCommCourier=="No") {
echo "checked";
} ?>>No <br>
</td></tr>
</table>
<br><br>
<h6>Items willing to loan:</h6>
<table>
<tr>
<td><b>Print Book</b><td>
<input type="radio" name="book" value="Yes" <?php if ($book=="Yes") {
echo "checked";
} ?>> Yes
<input type="radio" name="book" value="No" <?php if ($book=="No") {
echo "checked";
} ?>> No <br>
</td></tr>
<tr>
<td><b>Print Journal or Article</b><td>
<input type="radio" name="journal" value="Yes" <?php if ($journal=="Yes") {
echo "checked";
} ?>> Yes
<input type="radio" name="journal" value="No" <?php if ($journal=="No") {
echo "checked";
} ?>> No <br>
</td></tr>
<tr>
<td><b>Audio Video Materials</b><td>
<input type="radio" name="av" value="Yes" <?php if ($av=="Yes") {
echo "checked";
} ?>> Yes
<input type="radio" name="av" value="No" <?php if ($av=="No") {
echo "checked";
} ?>> No <br>
</td></tr>
<tr>
<td><b>Reference/Microfilm</b><td>
<input type="radio" name="reference" value="Yes" <?php if ($reference=="Yes") {
echo "checked";
} ?>> Yes
<input type="radio" name="reference" value="No" <?php if ($reference=="No") {
echo "checked";
} ?>>No <br>
</td></tr>
<tr>
<td><b>Electronic Book</b><td>
<input type="radio" name="ebook" value="Yes" <?php if ($ebook=="Yes") {
echo "checked";
} ?>> Yes
<input type="radio" name="ebook" value="No" <?php if ($ebook=="No") {
echo "checked";
} ?>> No <br>
</td></tr>
<tr>
<td><b>Electronic Journal</b><td>
<input type="radio" name="ejournal" value="Yes" <?php if ($ejournal=="Yes") {
echo "checked";
} ?>> Yes
<input type="radio" name="ejournal" value="No" <?php if ($ejournal=="No") {
echo "checked";
} ?>> No <br>
</td></tr>
</table>
<?php echo "<input type='hidden' name='loc' value= ' ".$loc ." '>"; ?><br><br>
<strong>Please click on Submit to save your profile.<br></strong>
<input type="submit" value="Submit">
</form>
<Br><Br>
Last Modified: <?php echo "$timestamp;" ?> by <?php echo "$lastmodemail;" ?>
<?php
}
}