setConstants(array('recip' => 'abarrera@princeton.edu', 'sub_pre' => 'Renewal Request Form: ')); // Set defaults for the form elements $form->setDefaults(array('id' => '22101')); // Add some elements to the form $form->addElement('header', null, ''); $form->addElement('text', 'name', 'Your Name:', array('size' => 30, 'maxlength' => 60)); $form->addElement('text', 'pulid', 'Your ID Card Barcode:', array('size' => 16, 'maxlength' => 14)); $form->addElement('text', 'phone', 'Your Phone Number:', array('size' => 16, 'maxlength' => 14)); $form->addElement('text', 'email', 'Your Email:', array('size' => 30, 'maxlength' => 60)); $form->addElement('static','codemsg',null,"Please supply the barcode number for each book you'd like to renew."); $temp =& HTML_QuickForm::createElement('text','barcode','Book Barcode:','value=32101'); $ngroup[] = $temp; $temp =& HTML_QuickForm::createElement('text','callnumber','Call Number:'); $temp->setSize(40); $ngroup[] = $temp; $form->addGroup($ngroup, 'firstbook', '*Book Barcode:      ', '       Call Number:       '); for ($i=1; $i<=50; $i++) { $tm =& HTML_QuickForm::createElement('text', 'barcode'.$i,'Book Barcode:','value=32101'); $group[$i][] = $tm; $tm =& HTML_QuickForm::createElement('text', 'call'.$i, 'Call Number:'); $tm->setSize(40); $group[$i][] = $tm; $form->addGroup($group[$i], 'books', 'Book Barcode:      ', '       Call Number:       '); $form->setDefaults(array('books[barcode'.$i.']'=>"32101")); } $form->addElement('static','custmsg',null,'Please ensure that the information above is correct before submitting.'); $form->addGroup($ngrp, 'info', ' '); #Captcha if (ereg("128\.112\.[0-9]+\.[0-9]+",getip())||ereg("140\.180\.[0-9]+\.[0-9]+",getip())) { $nonpu = false; } else { $nonpu = true; $form->addElement('static','s1','',""); $form->addElement('text','phrase',"For security purposes, please enter the text from the image above."); } #End Captcha $tm =& HTML_QuickForm::createElement('submit',null,'Send'); $grp[] = $tm; $tm =& HTML_QuickForm::createElement('reset',null,'Reset'); $grp[] = $tm; $form->addGroup($grp, 'buttons', ' '); // Define filters and validation rules $form->applyFilter('name', 'trim'); $form->addRule('name', 'Please enter your name.', 'required', null, 'server'); $form->addRule('email', 'Please enter your complete valid email address.', 'required'); $form->addRule('email', 'Please enter your complete valid email address.', 'email'); $form->addRule('pulid', 'Please enter your barcode id.', 'required', null, 'server'); $form->addRule('firstbook[barcode]','Please enter at least the first barcode.','required'); #Captcha Rules if ($nonpu) { $form->addRule('phrase','Please enter the phrase from the image.','required'); } # End Captcha Rules // Try to validate a form if ($form->validate()) { $form->freeze(); $form->process('process_form', false); #mail('abarrera@princeton.edu','test','test'); echo "

Thank You, ".$form->exportValue('name')."

Your renewal request was submitted.

"; } else { ?>

Renew Library Books Online!

All borrowers may now renew items online directly through “Your Account” in the Main Catalog.  Log in using your last name and barcode number. You may contact the Circulation staff if you have questions about the renewal process.

As an alternative, you may reply to any library message to request a renewal or use the form below. Please fill in all required fields, marked with an asterisk (*).

All renewals, irrespective of how processed, must conform to these conditions:

  1. Reserve books cannot be renewed with these forms.
  2. In process, and recall books may not be renewed.
  3. Your renewal will not be processed if your fines reach or exceed $20.00.
  4. Fines are 25 cents per day for overdue books and $1.00 per day for recalled books.
setElementTemplate("\n\t\n\t\t\n\t\t{element}\n\t", "custmsg"); $renderer->setElementTemplate("\n\t\n\t\t\n\t\t{element}\n\t", "codemsg"); $head_tpl = "\n\t\n\t\t{header}\n\t"; $form_tpl = "\n\n\n{content}\n
\n"; $renderer->setFormTemplate($form_tpl); $renderer->setHeaderTemplate($head_tpl); $form->accept($renderer); echo $renderer->toHtml(); #$form->display(); } function process_form ($values) { $headers = "Content-type: text/html; charset=iso-8859-1 \r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "X-Mailer: PHP\n"; $headers .= "X-Priority: 3\n"; $headers .= "From: ".htmlspecialchars($values['email'])."\n"; $headers .= "Reply-to: ".htmlspecialchars($values['email'])."\n"; $subject = "Place a Renewal"; $omsg = 'Name: ' . htmlspecialchars($values['name'])."\n"; $omsg .= "Requester's barcode: " . htmlspecialchars($values['pulid']) . "\n"; $omsg .= 'Email: '.htmlspecialchars($values['email']) ."\n"; $phone = htmlspecialchars($values["phone"]); if ($phone) { $omsg .= "Phone: $phone\n\n"; } // produce list of publications $omsg .= "----------\nItems to be renewed\n----------\n"; $firstbook = $values['firstbook']; $omsg .= "1) Barcode: ".$firstbook["barcode"]." | Call Number: ".$firstbook["callnumber"]."\n\n"; $books = $values['books']; $i=1; while ($i < sizeof($books)/2 ) { $info = "barcode".$i; $barcode = $books[$info]; $info = "call".$i; $call = $books[$info]; if (strlen($barcode) > 5 && strlen($barcode)<50) { $t = $i+1; $omsg .= "$t) Barcode: ".$barcode." | Call Number: ".$call."\n\n"; } $i++; } # Send Email if Captcha Successful if ($nonpu) { # Validate Captcha if (isset($_POST['phrase']) && isset($_SESSION['phrase']) && strlen($_POST['phrase']) > 0 && strlen($_SESSION['phrase']) > 0 && $_POST['phrase'] == $_SESSION['phrase']) { $msg = 'OK!'; $ok = true; unset($_SESSION['phrase']); } else { $msg = 'Please go back and try again!'; } #End Captcha Validate if($ok) { mail('fstcirc@princeton.edu',$subject, nl2br($omsg), $headers); unlink("../about/dynimages/".md5(session_id()) . '.png'); echo "

Thank You, $name

Your reqests have been successfully submitted. Thank you for contacting the Princeton University Library.

"; echo nl2br($omsg); } else { echo "

The phrase submitted was incorrect, please press back to try again.

"; spam_attempts('fstcirc@princeton.edu', $subject, $omsg, $email, $headers); $fp = fopen("logging/comments.log", "a"); fwrite($fp, "========\n"); fwrite($fp,date("m/d/Y H:m")."\n"); fwrite($fp,"$_SERVER[HTTP_REFERER]==$_SERVER[REQUEST_URI]\n"); fwrite($fp,"Subject: $subject\n"); fwrite($fp,"Message: $omsg\n"); fwrite($fp,"Headers: $headers\n"); fwrite($fp,"IP: ".$_SERVER["REMOTE_ADDR"]."\n"); $sql = "SELECT DISTINCT Count(`captured_spam`.`ip_address`) AS `countofattempts`, `captured_spam`.`ip_address` FROM `captured_spam` where ip_address='$_SERVER[REMOTE_ADDR]' GROUP BY `captured_spam`.`ip_address` order by `countofattempts` DESC"; $res = db_query($sql); $infoip = db_returnrow($res); if ($infoip[0] >= 20) { fwrite($fp,"BLOCKED\n"); } else { mail('abarrera@princeton.edu',"Renewal Web Form: ".$subject, $omsg, $headers); } fclose($fp); } } else { if ($values['email'] == "abarrera@princeton.edu") { mail('abarrera@princeton.edu',"Renewal Request: ".$subject, nl2br($omsg), $headers); } else { mail('fstcirc@princeton.edu',"Renewal Request: ".$subject, nl2br($omsg), $headers); } echo nl2br($omsg); } } ?>