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 and call 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<=20; $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->addGroupRule('firstbook','Please enter at least the first barcode and callnumber.','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 { ?>

Engineering borrowers only

(Renewals for East Asian Library, Firestone Library and Stokes Library are also available)

Please fill in all required fields, marked with an asterisk (*).

Renewals must conform to these conditions or they will not be processed:

  1. Only ENGINEERING LIBRARY books (with ST on their spines) can be renewed using this form.
  2. 4-HOUR RESERVE materials cannot be renewed using this form.
  3. Your renewal will not be processed if your fines reach or exceed $20.00.
  4. Every third renewal must take place at Engineering Circulation with the books in hand.

We will send e-mail confirmation of your renewal request after you complete and submit the form.

If you are not sent an e-mail confirmation in 2 working days after your submission, please contact an Engineering Library staff member or call (609) 258-3200.

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('strenew@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',"ST Renewal Web Form: ".$subject, $omsg, $headers); } fclose($fp); } } else { if ($values['email'] == "abarrera@princeton.edu") { mail('abarrera@princeton.edu',"ST Renewal Request: ".$subject, nl2br($omsg), $headers); } else { mail('strenew@princeton.edu',"ST Renewal Request: ".$subject, nl2br($omsg), $headers); } echo nl2br($omsg); } } ?>