[llvm-commits] CVS: llvm-www/devmtg/index.php register.php students.php talk.php
Tanya Lattner
tonic at nondot.org
Thu May 22 09:46:24 PDT 2008
Changes in directory llvm-www/devmtg:
index.php added (r1.1)
register.php added (r1.1)
students.php added (r1.1)
talk.php added (r1.1)
---
Log message:
New developer meeting main page and various forms.
---
Diffs of the changes: (+828 -0)
index.php | 142 ++++++++++++++++++++++++++++++++
register.php | 210 ++++++++++++++++++++++++++++++++++++++++++++++++
students.php | 257 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
talk.php | 219 ++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 828 insertions(+)
Index: llvm-www/devmtg/index.php
diff -c /dev/null llvm-www/devmtg/index.php:1.1
*** /dev/null Thu May 22 11:45:59 2008
--- llvm-www/devmtg/index.php Thu May 22 11:45:49 2008
***************
*** 0 ****
--- 1,142 ----
+ <?
+ virtual("../header.incl");
+
+ include("connectDB.php");
+
+ mysql_connect("127.0.0.1", $user, $password) or die(mysql_error());
+ mysql_select_db($database);
+
+
+ ?>
+ <div class="www_sectiontitle">LLVM Developers' Meeting</div>
+ <table>
+ <tr><td valign="top">
+ <ol>
+ <li><a href="#register">Registration</a></li>
+ <li><a href="#attendees">Attendees</a></li>
+ <li><a href="#agenda">Agenda</a></li>
+ <li><a href="#getting">Getting There</a></li>
+ <li><a href="#students">Student Funding</a></li>
+ </ol>
+ </td><td>
+ <ul>
+ <li><b>What</b>: The second general meeting of LLVM Developers and Users.
+ </li>
+ <li><b>Why</b>: To get acquainted, learn how LLVM is used, and exchange
+ ideas.</li>
+ <li><b>When</b>: August 1, 2008</li>
+ <li><b>Where</b>: Apple Campus (<a href="http://maps.google.com/maps?f=q&hl=en&geocode=&q=4+Infinite+Loop,+Cupertino,+CA+95014&sll=37.333228,-122.028923&sspn=0.010561,0.020964&ie=UTF8&ll=37.333228,-122.028923&spn=0.010561,0.020964&z=16&iwloc=addr">4 Infinite Loop, Cupertino, CA</a>)</li>
+ </ul>
+ </td></tr></table>
+
+ <p align="center"><b>SPONSORED BY: Apple, Google, Adobe, UIUC</b></p>
+
+ <p>The meeting serves as a forum for both <a href="http://llvm.org">LLVM</a>
+ developers and users to get acquainted, to learn how LLVM is used, and to
+ exchange ideas about LLVM and its (potential) applications. More broadly, we
+ believe the event will be of particular interest to the following people:</p>
+
+ <ul>
+ <li>Active LLVM developers and users.</li>
+ <li>Anyone interested in using LLVM.</li>
+ <li>Compiler, programming language, and runtime enthusiasts.</li>
+ <li>Those interested in using compiler technology in novel and interesting ways.</li>
+ </ul>
+
+ <p>Beyond discussing the core LLVM compiler infrastructure, this year's meeting
+ will also dedicate a significant amount of attention to <a
+ href="http://clang.llvm.org"><strong>clang</strong></a>, LLVM's new frontend for
+ C-based languages (see information on the meeting's <a href="#agenda">agenda</a>
+ for more information).</p>
+
+ <div class="www_sectiontitle" id="register">Registration</div>
+
+ <p><a href="register.php">Register NOW!</a></p>
+
+ <p>Attendance is free and open to everyone, but we ask that everyone planning on
+ attending to <a href="register.php">register</a> so that we get a rough
+ estimate of attendance.</p>
+
+ <p>We also ask that <b>everyone</b> planning on attending register (including
+ speakers). This gives us an accurate tally of how many people will be there.</p>
+
+ <p><b>Important</b>: If you previously emailed the meeting organizers an email
+ indicating your interest in coming, we politely ask you that you also register
+ through the registration form.</p>
+
+ <div class="www_sectiontitle"><a name="attendees">Attendees</a></div>
+ <div class="www_text">
+ <p>This table lists all attendees that have expressed interest in attending this year's conference.</p>
+ <table class="www">
+ <tr><th>Name</th><th>Organization</th></tr>
+ <?
+ $sql = "SELECT lastName, firstName, organization from attendees ORDER BY lastName And firstName";
+ $results = mysql_query($sql);
+ $count = 0;
+ while($row = mysql_fetch_array($results)) {
+ print '<tr><td>';
+ print $row['firstName'];
+ print ' ';
+ print $row['lastName'];
+ print '</td><td>';
+ print $row['organization'];
+ print '</td></tr>';
+ $count++;
+ }
+ ?>
+ </table>
+ <p><b>Total Confirmed: <?php print $count; ?></b></p>
+ <p>If your name is misspelled, or organization affiliation isn't correct, please <a href="mailto:llvm-devmtg08-admin at nondot.org">email us</a>, and we'll correct it.
+ </div>
+
+ <div class="www_sectiontitle" id="agenda">Agenda</div>
+
+ <p><a href="talk.php">Volunteer to give a talk!</a></p>
+
+ <p>The meeting is tentatively scheduled between 8:00 AM and 5:00 PM Pacific Time.</p>
+
+ <p>The schedule of talks has not yet been decided. If you are interested in
+ speaking, please <a
+ href="talk.php">let
+ us know</a> what topic you'd like to present.</p>
+
+ <div class="www_sectiontitle" id="getting">Getting There</div>
+
+ <p>The meeting will be held in building <a
+ href="http://maps.google.com/maps?f=q&hl=en&geocode=&q=4+Infinite+Loop,+Cupertino,+CA+95014&sll=37.333228,-122.028923&sspn=0.010561,0.020964&ie=UTF8&ll=37.333228,-122.028923&spn=0.010561,0.020964&z=16&iwloc=addr">Infinite
+ Loop 4</a> at Apple Inc.'s campus. The conference center is publicly accessible
+ to non-Apple employees, and can be reached by taking the stairs up one floor
+ from the foyer on the ground level.
+
+ <div class="www_subsection">Parking</div>
+
+ <p>All outside parking on the Infinite Loop is accessible to all visitors. You
+ do not need a special parking permit.</p>
+
+ <div class="www_subsection" id="travel">Travel</div>
+
+ <p>Cupertino is located in Silicon Valley, about 45 minutes south by car from
+ San Francisco.</p>
+
+ <p>Three major airports service the San Francisco Bay Area:</p>
+
+ <ul>
+ <li><a href="http://www.sjc.org">San Jose International Airport</a> (20 minute drive to Apple)</li>
+ <li><a href="http://www.flysfo.com">San Francisco International Airport</a> (45 minute drive to Apple)</li>
+ <li><a href="http://www.flyoakland.com/">Oakland International Airport</a> (1 hour+ drive to Apple, depending on traffic)</li>
+ </ul>
+
+ <div class="www_subsection" id="lodging">Lodging</div>
+
+ <p>We have blocked a discounted rate at the XXX and XXX. Please reserve your
+ room early, as the special rate is no long available for reservations made after
+ XXX.</p>
+
+ <div class="www_sectiontitle" id="students">Student Funding</div>
+ <p>We have a small amount of funding available to students who need assitance attending the LLVM Developers' meeting. A student may recieve partial or full funding if they agree to give a short talk and write up a blog entry of their experience. Preference is given to students who are active contributers to LLVM or clang. </p>
+
+ <p>If you require financial assistance and are enrolled as a student at the time of the meeting, please submit a <a href="students.php">funding request</a>.</p>
+
+ <?
+ virtual("../footer.incl");
+ ?>
Index: llvm-www/devmtg/register.php
diff -c /dev/null llvm-www/devmtg/register.php:1.1
*** /dev/null Thu May 22 11:46:24 2008
--- llvm-www/devmtg/register.php Thu May 22 11:45:49 2008
***************
*** 0 ****
--- 1,210 ----
+ <?
+
+ // Database details.
+ include("connectDB.php");
+
+ mysql_connect("127.0.0.1", $user, $password) or die(mysql_error());
+ mysql_select_db($database);
+
+ virtual("../header.incl");
+
+ function notify() {
+
+ $to = "llvm-devmtg08-admin at nondot.org";
+ $subject = "LLVM Dev Meeting Registration";
+
+ $body = '<html><body>';
+
+ $body .= '<p>Name: ' . $_POST['first'] . ' ' . $_POST['last'] . '</p>';
+ $body .= '<p>Organization: ' . $_POST['org'] . '</p>';
+ $body .= '<p>Email: ' . $_POST['email'] . '</p>';
+
+ if($_POST['attendBefore'] == 0)
+ $attendBefore = 'No';
+ else
+ $attendBefore = 'Yes';
+
+ $body .= '<p>Attended Before: ' . $attendBefore . '</p>';
+
+ if($_POST['friday'] == 0)
+ $friday = 'No';
+ else
+ $friday = 'Yes';
+
+ $body .= '<p>Attend dinner?: ' . $friday . '</p>';
+
+
+ if($_POST['meal'] == 0)
+ $meal = 'No';
+ else
+ $meal = 'Yes';
+
+ $body .= '<p>Vegetarian Meal: ' . $meal . '</p>';
+
+
+ $body .= "<p>Interests: " . $_POST['comments'] . '</p>';
+ $body .= '</body></html>';
+
+ $headers = 'From: tonic at nondot.org' . "\r\n";
+ $headers .= 'Content-Type: text/html; charset="iso-8859-1"'."\n";
+ mail($to, $subject, $body, $headers);
+
+ }
+
+
+ function processForm() {
+ if($_POST['attendBefore'] == 0)
+ $attend = 2;
+ else
+ $attend = 1;
+
+ if ($_POST['friday'] == 0)
+ $friday = 2;
+ else
+ $friday = 1;
+
+ if ($_POST['meal'] == 0)
+ $meal = 2;
+ else
+ $meal = 1;
+
+ $sql = "INSERT into attendees (lastName, firstName, organization, email, location, attendBefore, fridayDinner, mealVeg, comments) VALUES('$_POST[last]', '$_POST[first]', '$_POST[org]', '$_POST[email]', '$_POST[location]','$attend', '$friday', '$meal', '$_POST[comments]')";
+ mysql_query($sql) or die(mysql_error());
+ print 'Congratulations! You are now registered for the 2008 LLVM Developers\' Meeting.<p>Please sign up for the <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-devmeeting">LLVM Developers\' Meeting mailing list</a> to receive announcements about the event.</p>';
+ notify();
+ }
+
+ function validateForm() {
+ $errors = array();
+
+ // First name must be set.
+ if ($_POST['first'] == "")
+ array_push($errors, "First name must be provided");
+
+ if ($_POST['last'] == "") {
+ array_push($errors, "Last name must be provided");
+ }
+ if ($_POST['email'] == "")
+ array_push($errors, "Email must be provided");
+
+ if ($_POST['org'] == "")
+ array_push($errors, "Organization must be provided");
+
+ if ($_POST['location']=="")
+ array_push($errors, "Location name must be provided");
+
+ if ($_POST['comments'] == "")
+ array_push($errors, "Please specify interests.");
+
+ return $errors;
+ }
+
+ // Print single line text box.
+ function inputText($element_name, $size, $maxLength, $values) {
+ print '<input type="text" size=' . $size . '" maxlength="' . $maxlength . '" name="' . $element_name .'" value="';
+ print htmlentities($values[$element_name]) . '">';
+ }
+
+ // Print text area.
+ function inputTextarea($element_name, $row, $column, $values) {
+ print '<textarea name="' . $element_name . '" rows="' . $row . '" cols="' . $column . '">';
+ print htmlentities($values[$element_name]) . '</textarea>';
+ }
+
+ // Print radio box.
+ function inputRadiocheck($element_name,
+ $values, $element_value) {
+ print '<input type="radio" name="' .
+ $element_name .'" value="' . $element_value . '" ';
+ if ($element_value == $values[$element_name]) {
+ print ' checked="checked"';
+ }
+ print '/>';
+ }
+
+ function showForm($errors) {
+
+ if($errors) {
+ print '<font color=red>';
+ print '<p>Errors: </p>';
+ print'</font><ul>';
+ foreach ($errors as $i) {
+ print '<li>';
+ print $i;
+ print '</li>';
+ }
+ print '</ul>';
+ }
+
+ print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">';
+ print '<table border=0>';
+ print '<tr>';
+ print '<td><b>First Name:</b> </td> <td>';
+ inputText("first", 50, 50, $_POST);
+ print '</td>';
+ print '</tr>';
+ print '<tr>';
+ print '<td><b>Last Name:</b> </td> <td>';
+ inputText("last", 50, 50, $_POST);
+ print'</td>';
+ print '</tr><tr>';
+ print '<td><b>Email:</b> </td><td>';
+ inputText("email", 50, 75, $_POST);
+ print '</td>';
+ print '</tr><tr>';
+ print '<td><b>Organization:</b> </td><td>';
+ inputText("org", 50, 100, $_POST);
+ print '</td>';
+ print '</tr><tr>';
+ print '<td><b>Location:</b> </td><td>';
+ inputText("location", 50, 100, $_POST);
+ print '</td>';
+ print '</tr>';
+ print '</table>';
+ print '<p>Require vegetarian meals: ';
+ inputRadioCheck("meal", $_POST, 0);
+ print ' No ';
+ inputRadioCheck("meal", $_POST, 1);
+ print ' Yes</p>';
+ print '<p>Would you attend a group dinner afterwards?';
+ inputRadioCheck("friday", $_POST, 0);
+ print ' No ';
+ inputRadioCheck("friday", $_POST, 1);
+ print ' Yes</p>';
+ print '<p>Have you attended a LLVM developers\' meeting before?';
+ inputRadioCheck("attendBefore", $_POST, 0);
+ print ' No ';
+ inputRadioCheck("attendBefore", $_POST, 1);
+ print ' Yes</p>';
+ print '<p>What are you most interested in learning at the LLVM developers\' meeting? ';
+ print '(i.e. general optimizations, llvm internals, clang, backend, not sure, etc)</p>';
+ print '<p>';
+ inputTextArea("comments", 5, 60, $_POST);
+ print '</p>';
+ print '<p><input type="submit" name="Register"></p>';
+ print '<input type="hidden" name="verify" value="1"/>';
+ print '</form>';
+ }
+ ?>
+
+ <div class="www_sectiontitle">LLVM Developers' Meeting - Registration</div>
+
+ <?
+
+ if (array_key_exists('verify', $_POST)) {
+ $formErrors = validateForm($_POST);
+ if(!empty($formErrors)) {
+ showForm($formErrors);
+ }
+ else {
+ processForm();
+ }
+
+ }
+ else {
+ showForm();
+ }
+ ?>
+
+ <?virtual("../footer.incl")
+ ?>
Index: llvm-www/devmtg/students.php
diff -c /dev/null llvm-www/devmtg/students.php:1.1
*** /dev/null Thu May 22 11:46:24 2008
--- llvm-www/devmtg/students.php Thu May 22 11:45:49 2008
***************
*** 0 ****
--- 1,257 ----
+ <?
+
+ // Database details.
+ include("connectDB.php");
+
+ mysql_connect("127.0.0.1", $user, $password) or die(mysql_error());
+ mysql_select_db($database);
+
+ virtual("../header.incl");
+
+ function notify() {
+
+ $to = "llvm-devmtg08-admin at nondot.org";
+ //$to = "tonic at nondot.org";
+ $subject = "LLVM Dev Meeting Student Funding Request";
+
+ $body = '<html><body>';
+
+ $body .= '<p>Name: ' . $_POST['first'] . ' ' . $_POST['last'] . '</p>';
+ $body .= '<p>School: ' . $_POST['school'] . '</p>';
+ $body .= '<p>Email: ' . $_POST['email'] . '</p>';
+ $body .= '<p>Location: ' . $_POST['location'] . '</p>';
+
+ if($_POST['level'] == 1)
+ $level = "Undergraduate";
+ else
+ $level = "Graduate";
+
+ $body .= '<p>Level: ' . $level . '</p>';
+
+ if($_POST['type'] == 1)
+ $type = "Partial";
+ else
+ $type = "Full";
+
+
+ $body .= "<p>Funding Level: " . $type . '</p>';
+
+ $body .= '<p>Estimated airfare cost: ' . $_POST['airfare'] . '</p>';
+ $body .= '<p>Estimated loding cost: ' . $_POST['lodging'] . '</p>';
+ $body .= '<p>Estimated other costs: ' . $_POST['other'] . '</p>';
+ $body .= '<p>Reasons for needing funding: ' . $_POST['comments'] . '</p>';
+
+ $body .= '</body></html>';
+
+ $headers = 'From: tonic at nondot.org' . "\r\n";
+ $headers .= 'Content-Type: text/html; charset="iso-8859-1"'."\n";
+ mail($to, $subject, $body, $headers);
+
+ }
+
+
+ function processForm() {
+ $sql = "INSERT into students (lastName, firstName, school, email, level, location, airfare, lodging, other, type, comments) VALUES('$_POST[last]', '$_POST[first]', '$_POST[school]', '$_POST[email]', '$_POST[level]', '$_POST[location]','$_POST[airfare]', '$_POST[lodging]', '$_POST[other]', '$_POST[type]', '$_POST[comments]')";
+ mysql_query($sql) or die(mysql_error());
+ print 'Your request for funding to attend the LLVM Developers\' Meeting has been submitted. We will contact you once funds have been allocated. <p>Please sign up for the <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-devmeeting">LLVM Developers\' Meeting mailing list</a> to receive announcements about the event.</p>';
+ notify();
+ }
+
+ function validateForm() {
+ $errors = array();
+
+ // First name must be set.
+ if ($_POST['first'] == "")
+ array_push($errors, "First name must be provided");
+
+ if ($_POST['last'] == "") {
+ array_push($errors, "Last name must be provided");
+ }
+ if ($_POST['email'] == "")
+ array_push($errors, "Email must be provided");
+
+ if ($_POST['school'] == "")
+ array_push($errors, "School must be provided");
+
+ if ($_POST['location']=="")
+ array_push($errors, "Location must be provided");
+
+ if ($_POST['airfare'] == "")
+ array_push($errors, "Estimate airfare expense must be provided");
+ else {
+ if ($_POST['airfare'] != strval(intval($_POST['airfare']))) {
+ array_push($errors, "Estimate airfare expense must be an integer");
+ }
+ }
+
+
+ if ($_POST['lodging'] == "")
+ array_push($errors, "Estimate lodging expense must be provided");
+ else {
+ if ($_POST['lodging'] != strval(intval($_POST['lodging']))) {
+ array_push($errors, "Estimate lodging expense must be an integer");
+ }
+ }
+
+ if ($_POST['other'] == "")
+ array_push($errors, "Estimate other expense must be provided");
+ else {
+ if ($_POST['other'] != strval(intval($_POST['other']))) {
+ array_push($errors, "Estimate other expense must be an integer");
+ }
+ }
+
+ if ($_POST['comments'] == "")
+ array_push($errors, "Please provide reasons for needing funding");
+
+ if ($_POST['level'] == "")
+ array_push($errors, "Please select type of student");
+
+ if ($_POST['type'] == "")
+ array_push($errors, "Please select type of support");
+
+ return $errors;
+ }
+
+ // Print single line text box.
+ function inputText($element_name, $size, $maxLength, $values) {
+ print '<input type="text" size=' . $size . '" maxlength="' . $maxlength . '" name="' . $element_name .'" value="';
+ print htmlentities($values[$element_name]) . '">';
+ }
+
+ // Print text area.
+ function inputTextarea($element_name, $row, $column, $values) {
+ print '<textarea name="' . $element_name . '" rows="' . $row . '" cols="' . $column . '">';
+ print htmlentities($values[$element_name]) . '</textarea>';
+ }
+
+ // Print radio box.
+ function inputRadiocheck($element_name,
+ $values, $element_value) {
+ print '<input type="radio" name="' .
+ $element_name .'" value="' . $element_value . '" ';
+ if ($element_value == $values[$element_name]) {
+ print ' checked="checked"';
+ }
+ print '/>';
+ }
+
+ // Specific to our length drop down list.
+ function inputList($name, $values) {
+ print '<select name="' . $name . '" >';
+
+ if($values[$name] == 1)
+ print '<option value="1" selected>20</option>';
+ else {
+ print '<option value="1">20</option>';
+ }
+ if($values[$name] == 2)
+ print '<option value="2" selected>30</option>';
+ else
+ print '<option value="2">30</option>';
+
+ if($values[$name] == 3)
+ print '<option value="3" selected>40</option>';
+ else
+ print '<option value="3">40</option>';
+
+ if($values[$name] == 4)
+ print '<option value="4" selected>60</option>';
+ else
+ print '<option value="4">60</option>';
+ print '</select>';
+ }
+
+ function showForm($errors) {
+
+ if($errors) {
+ print '<font color=red>';
+ print '<p>Errors: </p>';
+ print'</font><ul>';
+ foreach ($errors as $i) {
+ print '<li>';
+ print $i;
+ print '</li>';
+ }
+ print '</ul>';
+ }
+
+ print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">';
+ print '<table border=0>';
+ print '<tr>';
+ print '<td><b>First Name:</b> </td> <td>';
+ inputText("first", 50, 50, $_POST);
+ print '</td>';
+ print '</tr>';
+ print '<tr>';
+ print '<td><b>Last Name:</b> </td> <td>';
+ inputText("last", 50, 50, $_POST);
+ print'</td>';
+ print '</tr><tr>';
+ print '<td><b>Email:</b> </td><td>';
+ inputText("email", 50, 75, $_POST);
+ print '</td>';
+ print '</tr><tr>';
+ print '<td><b>School:</b> </td><td>';
+ inputText("school", 50, 100, $_POST);
+ print '</td>';
+ print '</tr><tr>';
+ print '<td><b>Location:</b> </td><td>';
+ inputText("location", 50, 100, $_POST);
+ print '</td>';
+ print '</tr><tr>';
+ print '<td><b>Estimated airfare:</b> </td><td>';
+ inputText("airfare", 50, 100, $_POST);
+ print '</td>';
+ print '</tr><tr>';
+ print '<td><b>Estimated lodging:</b> </td><td>';
+ inputText("lodging", 50, 100, $_POST);
+ print '</td>';
+ print '</tr><tr>';
+ print '<td><b>Estimated other expenses:</b> </td><td>';
+ inputText("other", 50, 100, $_POST);
+ print '</td>';
+ print '</tr>';
+ print '</table>';
+ print '<p>Type of student: ';
+ inputRadioCheck("level", $_POST, 1);
+ print ' Undergraduate ';
+ inputRadioCheck("level", $_POST, 2);
+ print ' Graduate</p>';
+ print '<p>Amount of funding : ';
+ inputRadioCheck("type", $_POST, 1);
+ print ' Partial ';
+ inputRadioCheck("type", $_POST, 2);
+ print ' Full</p>';
+
+ print '<p>Reasons for needing funding: </p>';
+ print '<p>';
+ inputTextArea("comments", 10, 60, $_POST);
+ print '</p>';
+ print '<p><input type="submit" name="Submit"></p>';
+ print '<input type="hidden" name="verify" value="1"/>';
+ print '</form>';
+ }
+ ?>
+
+ <div class="www_sectiontitle">LLVM Developers' Meeting - Student Funding Request</div>
+
+ <?
+
+ if (array_key_exists('verify', $_POST)) {
+ $formErrors = validateForm($_POST);
+ if(!empty($formErrors)) {
+ showForm($formErrors);
+ }
+ else {
+ processForm();
+ }
+
+ }
+ else {
+ showForm();
+ }
+ ?>
+
+ <?virtual("../footer.incl")
+ ?>
Index: llvm-www/devmtg/talk.php
diff -c /dev/null llvm-www/devmtg/talk.php:1.1
*** /dev/null Thu May 22 11:46:24 2008
--- llvm-www/devmtg/talk.php Thu May 22 11:45:49 2008
***************
*** 0 ****
--- 1,219 ----
+ <?
+
+ // Database details.
+ include("connectDB.php");
+
+ mysql_connect("127.0.0.1", $user, $password) or die(mysql_error());
+ mysql_select_db($database);
+
+ virtual("../header.incl");
+
+ function notify() {
+
+ $to = "llvm-devmtg08-admin at nondot.org";
+ //$to = "tonic at nondot.org";
+ $subject = "LLVM Dev Meeting Talk Proposal";
+
+ $body = '<html><body>';
+
+ $body .= '<p>Name: ' . $_POST['first'] . ' ' . $_POST['last'] . '</p>';
+ $body .= '<p>Organization: ' . $_POST['org'] . '</p>';
+ $body .= '<p>Email: ' . $_POST['email'] . '</p>';
+ $body .= '<p>Phone: ' . $_POST['phone'] . '</p>';
+ $body .= '<p>Title: ' . $_POST['title'] . '</p>';
+ $body .= "<p>Summary: " . $_POST['summary'] . '</p>';
+
+ if($_POST['min'] == 1)
+ $min =20;
+ else if ($_POST['min'] == 2)
+ $min = 30;
+ else if($_POST['min'] == 3)
+ $min = 45;
+ else if($_POST['min'] == 4)
+ $min = 60;
+
+ $body .= '<p>Min Length: ' . $min . ' minutes</p>';
+
+ if($_POST['max'] == 1)
+ $max =20;
+ else if ($_POST['max'] == 2)
+ $max = 30;
+ else if($_POST['max'] == 3)
+ $max = 45;
+ else if($_POST['max'] == 4)
+ $max = 60;
+
+ $body .= '<p>Max Length: ' . $max . ' minutes</p>';
+
+ $body .= '</body></html>';
+
+ $headers = 'From: tonic at nondot.org' . "\r\n";
+ $headers .= 'Content-Type: text/html; charset="iso-8859-1"'."\n";
+ mail($to, $subject, $body, $headers);
+
+ }
+
+
+ function processForm() {
+ $sql = "INSERT into presenters (lastName, firstName, organization, email, phone, title, summary, minLength, maxLength) VALUES('$_POST[last]', '$_POST[first]', '$_POST[org]', '$_POST[email]', '$_POST[phone]', '$_POST[title]', '$_POST[summary]','$_POST[min]', '$_POST[max]')";
+ mysql_query($sql) or die(mysql_error());
+ print 'Congratulations! Your talk proposal for the LLVM Developers\' Meeting has been submitted. We will contact you once the agenda has been finalized. <p>Please sign up for the <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-devmeeting">LLVM Developers\' Meeting mailing list</a> to receive announcements about the event.</p>';
+ notify();
+ }
+
+ function validateForm() {
+ $errors = array();
+
+ // First name must be set.
+ if ($_POST['first'] == "")
+ array_push($errors, "First name must be provided");
+
+ if ($_POST['last'] == "") {
+ array_push($errors, "Last name must be provided");
+ }
+ if ($_POST['email'] == "")
+ array_push($errors, "Email must be provided");
+
+ if ($_POST['org'] == "")
+ array_push($errors, "Organization must be provided");
+
+ if ($_POST['phone']=="")
+ array_push($errors, "Phone number must be provided");
+
+ if ($_POST['title'] == "")
+ array_push($errors, "Please provide talk title");
+
+ if ($_POST['summary'] == "")
+ array_push($errors, "Please provide talk summary");
+
+
+ return $errors;
+ }
+
+ // Print single line text box.
+ function inputText($element_name, $size, $maxLength, $values) {
+ print '<input type="text" size=' . $size . '" maxlength="' . $maxlength . '" name="' . $element_name .'" value="';
+ print htmlentities($values[$element_name]) . '">';
+ }
+
+ // Print text area.
+ function inputTextarea($element_name, $row, $column, $values) {
+ print '<textarea name="' . $element_name . '" rows="' . $row . '" cols="' . $column . '">';
+ print htmlentities($values[$element_name]) . '</textarea>';
+ }
+
+ // Print radio box.
+ function inputRadiocheck($element_name,
+ $values, $element_value) {
+ print '<input type="radio" name="' .
+ $element_name .'" value="' . $element_value . '" ';
+ if ($element_value == $values[$element_name]) {
+ print ' checked="checked"';
+ }
+ print '/>';
+ }
+
+ // Specific to our length drop down list.
+ function inputList($name, $values) {
+ print '<select name="' . $name . '" >';
+
+ if($values[$name] == 1)
+ print '<option value="1" selected>20</option>';
+ else {
+ print '<option value="1">20</option>';
+ }
+ if($values[$name] == 2)
+ print '<option value="2" selected>30</option>';
+ else
+ print '<option value="2">30</option>';
+
+ if($values[$name] == 3)
+ print '<option value="3" selected>40</option>';
+ else
+ print '<option value="3">40</option>';
+
+ if($values[$name] == 4)
+ print '<option value="4" selected>60</option>';
+ else
+ print '<option value="4">60</option>';
+ print '</select>';
+ }
+
+ function showForm($errors) {
+
+ if($errors) {
+ print '<font color=red>';
+ print '<p>Errors: </p>';
+ print'</font><ul>';
+ foreach ($errors as $i) {
+ print '<li>';
+ print $i;
+ print '</li>';
+ }
+ print '</ul>';
+ }
+
+ print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">';
+ print '<table border=0>';
+ print '<tr>';
+ print '<td><b>First Name:</b> </td> <td>';
+ inputText("first", 50, 50, $_POST);
+ print '</td>';
+ print '</tr>';
+ print '<tr>';
+ print '<td><b>Last Name:</b> </td> <td>';
+ inputText("last", 50, 50, $_POST);
+ print'</td>';
+ print '</tr><tr>';
+ print '<td><b>Email:</b> </td><td>';
+ inputText("email", 50, 75, $_POST);
+ print '</td>';
+ print '</tr><tr>';
+ print '<td><b>Organization:</b> </td><td>';
+ inputText("org", 50, 100, $_POST);
+ print '</td>';
+ print '</tr><tr>';
+ print '<td><b>Phone:</b> </td><td>';
+ inputText("phone", 50, 100, $_POST);
+ print '</td>';
+ print '</tr>';
+ print '</table>';
+ print '<p>Mininum talk length: ';
+ inputList('min', $_POST);
+ print '</p><p>Maximum talk length: ';
+ inputList('max', $_POST);
+ print '<p>Talk Title: </p>';
+ print '<p>';
+ inputTextArea("title", 5, 60, $_POST);
+ print '</p>';
+ print '<p>Talk Summary: </p>';
+ print '<p>';
+ inputTextArea("summary", 10, 60, $_POST);
+ print '</p>';
+ print '<p><input type="submit" name="Submit"></p>';
+ print '<input type="hidden" name="verify" value="1"/>';
+ print '</form>';
+ }
+ ?>
+
+ <div class="www_sectiontitle">LLVM Developers' Meeting - Talk Proposal</div>
+
+ <?
+
+ if (array_key_exists('verify', $_POST)) {
+ $formErrors = validateForm($_POST);
+ if(!empty($formErrors)) {
+ showForm($formErrors);
+ }
+ else {
+ processForm();
+ }
+
+ }
+ else {
+ showForm();
+ }
+ ?>
+
+ <?virtual("../footer.incl")
+ ?>
More information about the llvm-commits
mailing list