225 |
225 |
226 |
226 |
227 // Construct search information message |
227 // Construct search information message |
228 if ($view_mode == "public") |
228 if ($view_mode == "public") |
229 { |
229 { |
230 $search_info = "There are " . mysql_num_rows($query) . " saved public searches."; |
230 $search_info = "There are " . mysql_num_rows($query) . " saved public URL fetches."; |
231 } else if ($view_mode == "private") { |
231 } else if ($view_mode == "private") { |
232 $search_info = "You have " . mysql_num_rows($query) . " saved private searches."; |
232 $search_info = "You have " . mysql_num_rows($query) . " saved private URL fetches."; |
233 } else { |
233 } else { |
234 $search_info = "There are " . mysql_num_rows($query) . " saved searches."; |
234 $search_info = "There are " . mysql_num_rows($query) . " saved URL fetches."; |
235 } |
235 } |
236 ?> |
236 ?> |
237 |
237 |
238 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
238 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
239 <html xmlns="http://www.w3.org/1999/xhtml"> |
239 <html xmlns="http://www.w3.org/1999/xhtml"> |
251 </div> |
251 </div> |
252 <?php |
252 <?php |
253 // show status messages based on user interaction |
253 // show status messages based on user interaction |
254 if ($status == "del") |
254 if ($status == "del") |
255 { |
255 { |
256 print "<div id='delete_alert'><span>You have successfully deleted the selected search.</span><a href='details.php'><img class='img_right' src='images/x.gif' width='14' height='20' /></a><div class='clear'></div></div>"; |
256 print "<div id='delete_alert'><span>You have successfully deleted the selected URL fetch.</span><a href='details.php'><img class='img_right' src='images/x.gif' width='14' height='20' /></a><div class='clear'></div></div>"; |
257 } else if ($status == "add") |
257 } else if ($status == "add") |
258 { |
258 { |
259 print "<div id='add_alert'><span>You have successfully added a new search.</span><a href='details.php'><img class='img_right' src='images/x.gif' width='14' height='20' /></a><div class='clear'></div></div>"; |
259 print "<div id='add_alert'><span>You have successfully added a new URL fetch.</span><a href='details.php'><img class='img_right' src='images/x.gif' width='14' height='20' /></a><div class='clear'></div></div>"; |
260 } else if ($status == "urlerror") |
260 } else if ($status == "urlerror") |
261 { |
261 { |
262 print "<div id='delete_alert'><span>You have entered an malformed url. Please use this format: <em><strong>http://www.yourwebsite.com</strong></em></span><a href='details.php'><img class='img_right' src='images/x.gif' width='14' height='20' /></a><div class='clear'></div></div>"; |
262 print "<div id='delete_alert'><span>You have entered an malformed url. Please use this format: <em><strong>http://www.yourwebsite.com</strong></em></span><a href='details.php'><img class='img_right' src='images/x.gif' width='14' height='20' /></a><div class='clear'></div></div>"; |
263 } |
263 } |
264 ?> |
264 ?> |
265 <div id="search"> |
265 <div id="search"> |
266 <h2>Open a new search:</h2> |
266 <h2>Fetch a new URL:</h2> |
267 <form action="add_search.php" method="get" enctype="multipart/form-data" name="search" target="_parent"> |
267 <form action="/portal/add_search.php" method="get" enctype="multipart/form-data" name="search" target="_parent"> |
268 <input name="search_term" type="text" value="http://www.yourwebsite.com" size="21" /> |
268 <input name="search_term" type="text" value="http://www.yourwebsite.com" size="21" /> |
269 <?php |
269 <?php |
270 // |
270 // |
271 if ($currID != 1) |
271 if ($currID != 1) |
272 { |
272 { |
273 print "<select name='search_type' size='1'>"; |
273 print "<select name='search_type' size='1'>"; |
274 print "<option value='public' selected>Public</option>"; |
274 print "<option value='public' selected>Public</option>"; |
275 print "<option value='private'>Private</option></select>"; |
275 print "<option value='private'>Private</option></select>"; |
276 } |
276 } |
277 ?> |
277 ?> |
278 <input id="search_button" name="submit" type="submit" value="Search" /> |
278 <input id="search_button" name="submit" type="submit" value="Fetch" /> |
279 </form> |
279 </form> |
280 </div> |
280 </div> |
281 <div id="results"> |
281 <div id="results"> |
282 <h2><?php print $search_info; ?></h2> |
282 <h2><?php print $search_info; ?></h2> |
283 <?php |
283 <?php |
286 print "<div id='view_options'><form action='details.php' method='get' enctype='multipart/form-data' name='search' target='_parent'>"; |
286 print "<div id='view_options'><form action='details.php' method='get' enctype='multipart/form-data' name='search' target='_parent'>"; |
287 |
287 |
288 if ($currID != 1) |
288 if ($currID != 1) |
289 { |
289 { |
290 print "<select name='view_mode' size='1'>"; |
290 print "<select name='view_mode' size='1'>"; |
291 print "<option value='private' selected>Private searches</option>"; |
291 print "<option value='all' selected>All URLs</option>"; |
292 print "<option value='public'>Public searches</option>"; |
292 print "<option value='private'>Private URLs</option>"; |
293 print "<option value='all'>All searches</option></select> "; |
293 print "<option value='public'>Public URLs</option></select>"; |
294 } |
294 } |
295 |
295 |
296 print "<select name='view_order' size='1'>"; |
296 print "<select name='view_order' size='1'>"; |
297 print "<option value='date_desc' selected>Newest > Oldest</option>"; |
297 print "<option value='date_desc' selected>Newest > Oldest</option>"; |
298 print "<option value='date_asc'>Oldest > Newest</option>"; |
298 |
299 print "<option value='avail'>Available > Pending</option> "; |
299 print "<option value='avail'>Available > Pending</option> "; |
300 print "<option value='pend'>Pending > Available</option></select> "; |
300 print "<option value='pend'>Pending > Available</option></select> "; |
301 print "<input name='submit' type='submit' value='Update view' /></form></div>"; |
301 print "<input name='submit' type='submit' value='Update view' /></form></div>"; |
302 ?> |
302 ?> |
303 <?php |
303 <?php |
310 { |
310 { |
311 print "<div class='search_result_private'><span class='result_no'>" . $search_count . "</span> "; |
311 print "<div class='search_result_private'><span class='result_no'>" . $search_count . "</span> "; |
312 print "<span class='search_txt'>Search:</span><span class='search_input'><em>" . $db_field['req_val'] . "</em></span> "; |
312 print "<span class='search_txt'>Search:</span><span class='search_input'><em>" . $db_field['req_val'] . "</em></span> "; |
313 } else { |
313 } else { |
314 print "<div class='search_result'><span class='result_no'>" . $search_count . "</span> "; |
314 print "<div class='search_result'><span class='result_no'>" . $search_count . "</span> "; |
315 print "<span class='search_txt'>Search:</span><span class='search_input'><em>" . $db_field['req_val'] . "</em></span> "; |
315 print "<span class='search_txt'>URL:</span><span class='search_input'><em>" . $db_field['req_val'] . "</em></span> "; |
316 } |
316 } |
317 |
317 |
318 print "<span class='results_txt'>Status:</span>"; |
318 print "<span class='results_txt'>Status:</span>"; |
319 |
319 |
320 if ($db_field['req_response'] == 0) |
320 if ($db_field['req_response'] == 0) |
363 } |
363 } |
364 |
364 |
365 // if no requests, display message |
365 // if no requests, display message |
366 if (mysql_num_rows($query) < 1) |
366 if (mysql_num_rows($query) < 1) |
367 { |
367 { |
368 print '<p>You have no previous searches please use the search form to create a new search.</p>'; |
368 print '<p>You have no previous URL fetches please use the form to create a new URL fetch.</p>'; |
369 } |
369 } |
370 |
370 |
371 mysql_close(); |
371 mysql_close(); |
372 /* To submit a form using POST method through PHP, just add the data to be posted as header. This essentially saves one extra html page sent to the browser when user has to be redirected. |
372 /* To submit a form using POST method through PHP, just add the data to be posted as header. This essentially saves one extra html page sent to the browser when user has to be redirected. |
373 <?php |
373 <?php |