Advertisement
Guest User

aramil

a guest
Sep 3rd, 2009
433
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 21.04 KB | None | 0 0
  1. <?php
  2.  
  3. // 20090826 --> FIX INLINE DISPLAY
  4. //Changed the script to appear higher up so as to make the ob_start->end get all of the output
  5.  
  6. function register_attendees($event_single_ID) {
  7.     global $wpdb, $lang,$lang_flag;
  8.    
  9.     $paypal_cur = get_option ( 'paypal_cur' );
  10.     if ($event_single_ID == ""){$event_id = $_REQUEST ['event_id'];}
  11.     if ($event_single_ID != ""){
  12.         extract( shortcode_atts( array('id' => '0'), $event_single_ID ) );
  13.         echo $event_single_ID['id'];
  14.         $event_id = $event_single_ID['id'];
  15.         }
  16.    
  17.     $events_listing_type = get_option ( 'events_listing_type' );
  18.     $events_attendee_tbl = get_option ( 'events_attendee_tbl' );
  19.     $events_detail_tbl = get_option ( 'events_detail_tbl' );
  20.     $events_organization_tbl = get_option ( 'events_organization_tbl' );
  21.     $events_listing_type = get_option ( 'events_listing_type' );
  22.    
  23.     $sql = "SELECT * FROM " . $events_organization_tbl . " WHERE id='1'";
  24.     $result = mysql_query ( $sql );
  25.     while ( $row = mysql_fetch_assoc ( $result ) ) {
  26.         $events_listing_type = $row ['events_listing_type'];
  27.     }
  28.    
  29.     //Query Database for Active event and get variable
  30.    
  31.  
  32.     if ($events_listing_type == 'single') {
  33.         $sql = "SELECT * FROM " . $events_detail_tbl . " WHERE is_active='yes'";
  34.     } else {
  35.         $sql = "SELECT * FROM " . $events_detail_tbl . " WHERE id = $event_id";
  36.     }
  37.     $result = mysql_query ( $sql );
  38.     while ( $row = mysql_fetch_assoc ( $result ) ) {
  39.         $event_id = $row ['id'];
  40.         $event_name = $row ['event_name'];
  41.         $event_desc = $row ['event_desc'];
  42.         $display_desc = $row ['display_desc'];
  43.         $image = $row ['image_link'];
  44.         $header = $row ['header_image'];
  45.         $multiple = $row ['multiple'];
  46.         $event_description = $row ['event_desc'];
  47.         $identifier = $row ['event_identifier'];
  48.         $event_cost = $row ['event_cost'];
  49.         $event_location = $row ['event_location'];
  50.         $more_info = $row ['more_info'];
  51.         $custom_cur = $row ['custom_cur'];
  52.         $checks = $row ['allow_checks'];
  53.         $active = $row ['is_active'];
  54.         $question1 = $row ['question1'];
  55.         $question2 = $row ['question2'];
  56.         $question3 = $row ['question3'];
  57.         $question4 = $row ['question4'];
  58.         $reg_limit = $row ['reg_limit'];
  59.     }
  60.    
  61.     update_option ( "current_event", $event_name );
  62.     //Query Database for Event Organization Info to email registrant BHC
  63.     //$sql  = "SELECT * FROM wp_events_organization WHERE id='1'";
  64.     $events_organization_tbl = get_option ( 'events_organization_tbl' );
  65.     $sql = "SELECT * FROM " . $events_organization_tbl . " WHERE id='1'";
  66.     $result = mysql_query ( $sql );
  67.    
  68.     while ( $row = mysql_fetch_assoc ( $result ) ) {
  69.         $org_id = $row ['id'];
  70.         $Organization = $row ['organization'];
  71.         $Organization_street1 = $row ['organization_street1'];
  72.         $Organization_street2 = $row ['organization_street2'];
  73.         $Organization_city = $row ['organization_city'];
  74.         $Organization_state = $row ['organization_state'];
  75.         $Organization_zip = $row ['organization_zip'];
  76.         $contact = $row ['contact_email'];
  77.         $registrar = $row ['contact_email'];
  78.         $paypal_id = $row ['paypal_id'];
  79.         $paypal_cur = $row ['currency_format'];
  80.         $events_listing_type = $row ['events_listing_type'];
  81.         $message = $row ['message'];
  82.     }
  83.    
  84.     //get attendee count   
  85.     $events_attendee_tbl = get_option ( 'events_attendee_tbl' );
  86.  
  87.     $sql= "SELECT SUM(num_people) FROM " . $events_attendee_tbl . " WHERE event_id='$event_id'";
  88.     $result = mysql_query($sql);
  89.     while($row = mysql_fetch_array($result)){
  90.         $num =  $row['SUM(num_people)'];
  91.         };
  92.    
  93.    
  94.        
  95.    
  96.         ?>
  97. <?php //JavaScript for Registration Form Validation
  98.  
  99.         ?>
  100. <SCRIPT>
  101.  
  102.  
  103.  
  104. function echeck(str) {
  105.         var at="@"
  106.         var dot="."
  107.         var em = ""
  108.         var lat=str.indexOf(at)
  109.         var lstr=str.length
  110.         var ldot=str.indexOf(dot)
  111.         if (str.indexOf(at)==-1){
  112.             return false;
  113.             }
  114.  
  115.         if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
  116.             return false;
  117.            
  118.         }
  119.  
  120.         if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
  121.              return false;
  122.         }
  123.  
  124.          if (str.indexOf(at,(lat+1))!=-1){
  125.               return false;
  126.          }
  127.  
  128.          if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
  129.              return false;
  130.          }
  131.  
  132.          if (str.indexOf(dot,(lat+2))==-1){
  133.             return false;
  134.          }
  135.        
  136.          if (str.indexOf(" ")!=-1){
  137.             return false;
  138.          }
  139.  
  140.          return true;                  
  141. }
  142.  
  143.  
  144. function validateForm(form) {
  145.    
  146. var msg = "";
  147.  
  148. if (form.fname.value == "") {  msg += "\n " +"Please enter your first name.";
  149.         form.fname.focus( );
  150.      }
  151. if (form.lname.value == "") {  msg += "\n " +"Please enter your last name.";
  152.         form.lname.focus( );
  153.         }
  154.    
  155. if (echeck(form.email.value)==false){
  156.         msg += "\n " + "Email format not correct!";
  157.         }
  158.        
  159. if (form.phone.value == "") {  msg += "\n " +"Please enter your phone number.";
  160.         form.phone.focus( );
  161.         }
  162. if (form.address.value == "") {  msg += "\n " +"Please enter your address.";
  163.         form.address.focus( );
  164.         }
  165. if (form.city.value == "") {  msg += "\n " +"Please enter your city.";
  166.         form.city.focus( );
  167.         }  
  168.  
  169. if (form.state.value == "") { msg += "\n " + "Please enter your state.";
  170.         form.state.focus( );
  171.      }
  172. if (form.zip.value == "") {  msg += "\n " +"Please enter your zip code.";
  173.         form.zip.focus( );
  174.          }
  175.    
  176. //Validate Extra Questions
  177. function trim(s) {if (s) {return s.replace(/^\s*|\s*$/g,"");} return null;}
  178.                
  179.     var inputs = form.getElementsByTagName("input");
  180.     var e;
  181.  
  182. //Start Extra Questions Check
  183.     for( var i = 0, e; e = inputs[i]; i++ )
  184.     {
  185.         var value = e.value ? trim(e.value) : null;
  186.    
  187.         if (e.type == "text" && e.title && !value && e.className == "r")
  188.         {msg += "\n " + e.title;}
  189.        
  190.    
  191.     if ((e.type == "radio" || e.type == "checkbox") && e.className == "r") {
  192.                 var rd =""
  193.                 var controls = form.elements;
  194.                 function getSelectedControl(group)
  195.                     {
  196.                     for (var i = 0, n = group.length; i < n; ++i)
  197.                         if (group[i].checked) return group[i];
  198.                         return null;
  199.                     }
  200.                 if (!getSelectedControl(controls[e.name]))
  201.                                 {msg += "\n " + e.title;}
  202.             }
  203.            
  204.  
  205.     }
  206.  
  207.     var inputs = form.getElementsByTagName("textarea");
  208.     var e;
  209.    
  210.     //Start Extra TextArea Questions Check
  211.     for( var i = 0, e; e = inputs[i]; i++ )
  212.     {
  213.         var value = e.value ? trim(e.value) : null;
  214.         if (!value && e.className == "r")
  215.         {msg += "\n " + e.title;}
  216.     }
  217.     var inputs = form.getElementsByTagName("select");
  218.     var e;
  219.    
  220.     //Start Extra TextArea Questions Check
  221.     for( var i = 0, e; e = inputs[i]; i++ )
  222.     {
  223.         var value = e.value ? trim(e.value) : null;
  224.         if ((!value || value =='') && e.className == "r")
  225.         {msg += "\n " + e.title;}
  226.     }
  227.  
  228. if (msg.length > 0) {
  229.             msg = "The following fields need to be completed before you can submit.\n\n" + msg;
  230.             alert(msg);
  231.             return false;
  232.         }
  233.    
  234.     return true;  
  235.  
  236. }
  237.  
  238.  
  239.  
  240. </SCRIPT>
  241. <?php
  242.     // 20090826 --> FIX INLINE DISPLAY
  243.     ob_start();
  244.  
  245. if ($header != ""){echo "<p align='center'><img src='".$header."'  width='450' align='center'></p>";}
  246.     if ( $reg_limit > "$num" || $reg_limit == "") {
  247.         echo "<p align='center'><b>".$lang['eventFormHeader'] . $event_name . "</b></p>";
  248.         echo "<table width='100%'><td>";
  249.         if ($display_desc == "Y") {
  250.             echo "<td span='2'>" . $event_desc . "</td>";
  251.         }
  252.         echo "</table>";
  253.         echo "<table width='500'><td>";
  254.         if ($custom_cur == ""){if ($paypal_cur == "USD" || $paypal_cur == "") {$paypal_cur = "$";}          }
  255.         if ($custom_cur != "" || $custom_cur != "USD"){$paypal_cur = $custom_cur;}
  256.         if ($custom_cur == "USD") {$paypal_cur = "$";}
  257.            
  258.            
  259.         if ($event_cost != "") {if ($lang_flag=='de')
  260.                 echo "<b>" . $event_name . " - Kosten " .$event_cost . " " .  $paypal_cur . "</b></p></p>";
  261.             else
  262.                 echo "<b>" . $event_name . " - Cost " . $paypal_cur . " " . $event_cost . "</b></p></p>";
  263.             }
  264. ?>
  265.  
  266. </td>
  267. <tr>
  268.     <td>
  269.     <form method="post"
  270.         action="<?php
  271.         echo $_SERVER ['REQUEST_URI'];
  272.         ?>"
  273.         onSubmit="return validateForm(this)">
  274.     <p align="left"><b><?php
  275.         echo $lang ['firstName'];
  276.         ?>: <br />
  277.     <input tabIndex="1" maxLength="40" size="47" name="fname"></b></p>
  278.     <p align="left"><b><?php
  279.         echo $lang ['lastName'];
  280.         ?>:<br />
  281.     <input tabIndex="2" maxLength="40" size="47" name="lname"></b></p>
  282.     <p align="left"><b><?php
  283.         echo $lang ['email'];
  284.         ?>:<br />
  285.     <input tabIndex="3" maxLength="40" size="47" name="email"></b></p>
  286.     <p align="left"><b><?php
  287.         echo $lang ['phone'];
  288.         ?>:<br />
  289.     <input tabIndex="4" maxLength="20" size="25" name="phone"></b></p>
  290.     <p align="left"><b><?php
  291.         echo $lang ['address'];
  292.         ?>:<br />
  293.     <input tabIndex="5" maxLength="35" size="49" name="address"></b></p>
  294.     <p align="left"><b><?php
  295.         echo $lang ['city'];
  296.         ?>:<br />
  297.     <input tabIndex="6" maxLength="25" size="35" name="city"> </b></p>
  298. <?php
  299.   //no state necessary in germany
  300.   if ($lang_flag!="de")
  301.   {
  302.   ?><p align="left"><b><?php
  303.  echo $lang ['state'];
  304.         ?>:<br />
  305.     <input tabIndex="7" maxLength="20" size="18" name="state"></b></p>
  306.  <?php } ?>
  307.    
  308.     <p align="left"><b><?php
  309.         echo $lang ['zip'];
  310.         ?>:<br />
  311.     <input tabIndex="8" maxLength="10" size="15" name="zip"></b></p>
  312. <?php
  313. if ($multiple == "Y"){?>           
  314.            
  315. <p align="left"><b> Additional attendees?
  316.       <select name="num_people" style="width:70px;margin-top:4px">
  317.         <option value="1" selected>None</option>
  318.         <option value="2">1</option>
  319.         <option value="3">2</option>
  320.         <option value="4">3</option>
  321.         <option value="5">4</option>
  322.         <option value="6">5</option>
  323.       </select>    
  324.       </b></p>
  325.      
  326.       <?php
  327.       }
  328. if ($multiple == "N"){?>
  329. <input type="hidden" name="num_people" value="1">
  330. <?php
  331. }
  332.         /*
  333.             <p align="left"><b>How did you hear about this event?</b><br /><select tabIndex="9" size="1" name="hear">
  334.             <option value="pick one" selected>pick one</option>
  335.             <option value="Website">Website</option>
  336.             <option value="A Friend">A Friend</option>
  337.             <option value="Brochure">A Brochure</option>
  338.             <option value="Announcment">An Announcment</option>
  339.             <option value="Other">Other</option>
  340.             </select></p>
  341.             */
  342.        
  343.             /* TODO IJ not for everyone nesseccary...
  344.             if ($event_cost != "") {
  345.             ?>
  346.             <p align="left">
  347.             <b><?php echo $lang['payingPlan'];?></b><br />
  348.         <select tabIndex="10" size="1" name="payment">
  349.           <option value="pickone" selected><?php echo $lang['pickone']; ?></option>
  350.             <?php
  351.             if ($paypal_id != "") {
  352.                 echo "<option value=\"Paypal\">$lang[paypal]</option>";
  353.             }
  354.            
  355.             echo "<option value=\"Cash\">$lang[cash]</option>";
  356.            
  357.             if ($checks == "yes" && $lang_flag!='de') {  //very unusual in germany
  358.         echo "<option value=\"Check\">$lang[check]</option>";
  359.             }
  360.             ?>
  361.             </select></font></p>
  362.             <?php
  363.         } else {
  364.             ?><input type="hidden" name="payment" value="free event"><?
  365.         }
  366. */
  367.         /*
  368.        
  369.             if ($question1 != ""){ ?>
  370.             <p align="left"><b><?php echo $question1; ?><input size="33" name="custom_1"> </b></p>
  371.             <?php } else { ?><input type="hidden" name="custom1" value=""><?}
  372.  
  373.             if ($question2 != ""){ ?>
  374.             <p align="left"><b><?php echo $question2; ?><input size="33" name="custom_2"> </b></p>
  375.             <?php } else { ?><input type="hidden" name="custom2" value=""><?}
  376.  
  377.             if ($question3 != ""){ ?>
  378.             <p align="left"><b><?php echo $question3; ?><input size="33" name="custom_3"> </b></p>
  379.             <?php } else { ?><input type="hidden" name="custom3" value=""><?}
  380.  
  381.             if ($question4 != ""){ ?>
  382.             <p align="left"><b><?php echo $question4; ?><input size="33" name="custom_4"> </b></p>
  383.             <?php }  else { ?><input type="hidden" name="custom1" value=""><?}
  384.             */
  385.         //This in the Form
  386.        
  387.  
  388.         $events_question_tbl = get_option ( 'events_question_tbl' );
  389.         $questions = $wpdb->get_results ( "SELECT * from `$events_question_tbl` where event_id = '$event_id' order by sequence" );
  390.         if ($questions) {
  391.             foreach ( $questions as $question ) {
  392.                
  393.                 echo "<p align='left'><b>" . $question->question . BR;
  394.                 event_form_build ( $question );
  395.                 echo "</b></p>";
  396.             }
  397.         }
  398.        
  399.         ?>
  400.  
  401.  
  402.         <input type="hidden" name="regevent_action" value="post_attendee"> <input
  403.         type="hidden" name="event_id" value="<?php
  404.         echo $event_id;
  405.         ?>">
  406.     <p align="center"><input type="submit" name="Submit" value="<?php echo $lang['submit']; ?>"> <font
  407.         color="#FF0000"><b><?php echo $lang['submitHint'];?></b></font>
  408.    
  409.     </form>
  410.     </td>
  411. </tr>
  412. </table>
  413. </body>
  414. <?php
  415.     } else {
  416.         echo $lang ['maxAttendeesInfo'];
  417.         echo "<p>Current Number of Attendees: " . $num . "</p>";
  418.     }
  419.  
  420.     // 20090826 --> FIX INLINE DISPLAY
  421.     $output = ob_get_contents();
  422.     ob_end_clean();
  423.  
  424.     return $output;
  425. }
  426.  
  427. function add_attendees_to_db() {
  428.     global $wpdb, $lang;
  429.     $current_event = get_option ( 'current_event' );
  430.     $registrar = get_option ( 'registrar' );
  431.     $events_attendee_tbl = get_option ( 'events_attendee_tbl' );
  432.    
  433.     $fname = $_POST ['fname'];
  434.     $lname = $_POST ['lname'];
  435.     $address = $_POST ['address'];
  436.     $city = $_POST ['city'];
  437.     $state = $_POST ['state'];
  438.     $zip = $_POST ['zip'];
  439.     $phone = $_POST ['phone'];
  440.     $email = $_POST ['email'];
  441.     $hear = $_POST ['hear'];
  442.     $num_people = $_POST ['num_people'];
  443.     $event_id = $_POST ['event_id'];
  444.     $payment = $_POST ['payment'];
  445.     $custom_1 = $_POST ['custom_1'];
  446.     $custom_2 = $_POST ['custom_2'];
  447.     $custom_3 = $_POST ['custom_3'];
  448.     $custom_4 = $_POST ['custom_4'];
  449.     update_option ( "attendee_first", $fname );
  450.     update_option ( "attendee_last", $lname );
  451.     update_option ( "attendee_name", $fname . " " . $lname );
  452.     update_option ( "attendee_email", $email );
  453.    
  454.     $sql = "INSERT INTO " . $events_attendee_tbl . " (lname ,fname ,address ,city ,state ,zip ,email ,phone ,hear ,num_people, payment, event_id, custom_1, custom_2, custom_3, custom_4 ) VALUES ('$lname', '$fname', '$address', '$city', '$state', '$zip', '$email', '$phone', '$hear', '$num_people', '$payment', '$event_id', '$custom_1', '$custom_2', '$custom_3', '$custom4')";
  455.    
  456.     $wpdb->query ( $sql );
  457.    
  458.  
  459.    
  460.     // Insert Extra From Post Here
  461.     $events_question_tbl = get_option ( 'events_question_tbl' );
  462.     $events_answer_tbl = get_option ( 'events_answer_tbl' );
  463.     $reg_id = $wpdb->get_var ( "SELECT LAST_INSERT_ID()" );
  464.    
  465.     $questions = $wpdb->get_results ( "SELECT * from `$events_question_tbl` where event_id = '$event_id'" );
  466.     if ($questions) {
  467.         foreach ( $questions as $question ) {
  468.             switch ($question->question_type) {
  469.                 case "TEXT" :
  470.                 case "TEXTAREA" :
  471.                 case "DROPDOWN" :
  472.                     $post_val = $_POST [$question->question_type . '_' . $question->id];
  473.                     $wpdb->query ( "INSERT into `$events_answer_tbl` (registration_id, question_id, answer)
  474.                     values ('$reg_id', '$question->id', '$post_val')" );
  475.                     break;
  476.                 case "SINGLE" :
  477.                     $post_val = $_POST [$question->question_type . '_' . $question->id];
  478.                     $wpdb->query ( "INSERT into `$events_answer_tbl` (registration_id, question_id, answer)
  479.                     values ('$reg_id', '$question->id', '$post_val')" );
  480.                     break;
  481.                 case "MULTIPLE" :
  482.                     $value_string = '';
  483.                     for ($i=0; $i<count($_POST[$question->question_type.'_'.$question->id]); $i++){
  484.                     //$value_string = $value_string +","+ ($_POST[$question->question_type.'_'.$question->id][$i]);
  485.                     $value_string .= $_POST[$question->question_type.'_'.$question->id][$i].",";
  486.                     }
  487.                     echo "Value String - ".$value_string;
  488.                     /*$values = explode ( ",", $question->response );
  489.                     $value_string = '';
  490.                     foreach ( $values as $key => $value ) {
  491.                         $post_val = $_POST [$question->question_type . '_' . $question->id . '_' . $key];
  492.                         if ($key > 0 && ! empty ( $post_val )) $value_string .= ',';
  493.                         $value_string .= $post_val;
  494.                     }*/
  495.                     $wpdb->query ( "INSERT into `$events_answer_tbl` (registration_id, question_id, answer)
  496.                     values ('$reg_id', '$question->id', '$value_string')" );
  497.                     break;
  498.             }
  499.         }
  500.     }
  501.    
  502.    
  503.     //Added by IJ: get the attendee-number and add to subject of email for having a unique attendee-number
  504.     $sql = "select max(id) as attnum from $events_attendee_tbl ";
  505.     $result = mysql_query ( $sql );
  506.     $row = mysql_fetch_array ( $result );
  507.     $attnum = $row ['attnum']; 
  508.    
  509.    
  510.     //Query Database for Event Organization Info to email registrant BHC
  511.     $events_organization_tbl = get_option ( 'events_organization_tbl' );
  512.     $sql = "SELECT * FROM " . $events_organization_tbl . " WHERE id='1'";
  513.     // $sql  = "SELECT * FROM wp_events_organization WHERE id='1'";
  514.    
  515.  
  516.     $result = mysql_query ( $sql );
  517.     while ( $row = mysql_fetch_assoc ( $result ) ) {
  518.         $org_id = $row ['id'];
  519.         $Organization = $row ['organization'];
  520.         $Organization_street1 = $row ['organization_street1'];
  521.         $Organization_street2 = $row ['organization_street2'];
  522.         $Organization_city = $row ['organization_city'];
  523.         $Organization_state = $row ['organization_state'];
  524.         $Organization_zip = $row ['organization_zip'];
  525.         $contact = $row ['contact_email'];
  526.         $registrar = $row ['contact_email'];
  527.         $paypal_id = $row ['paypal_id'];
  528.         $paypal_cur = $row ['currency_format'];
  529.         $return_url = $row ['return_url'];
  530.         $events_listing_type = $row ['events_listing_type'];
  531.         $default_mail = $row ['default_mail'];
  532.         $conf_message = $row ['message'];
  533.     }
  534.    
  535.     $events_detail_tbl = get_option ( 'events_detail_tbl' );
  536.    
  537.     $sql = "SELECT * FROM " . $events_detail_tbl . " WHERE id='" . $event_id . "'";
  538.     $result = mysql_query ( $sql );
  539.     while ( $row = mysql_fetch_assoc ( $result ) ) {
  540.         $event_name = $row ['event_name'];
  541.         $event_desc = $row ['event_desc']; // BHC
  542.         $display_desc = $row ['display_desc'];
  543.         $image = $row ['image_link'];
  544.         $identifier = $row ['event_identifier'];
  545.         $reg_limit = $row ['reg_limit'];
  546.         $cost = $row ['event_cost'];
  547.         $start_month = $row ['start_month'];
  548.         $start_day = $row ['start_day'];
  549.         $start_year = $row ['start_year'];
  550.         $multiple = $row ['multiple'];
  551.         $end_month = $row ['end_month'];
  552.         $end_day = $row ['end_day'];
  553.         $end_year = $row ['end_year'];
  554.         $start_time = $row ['start_time'];
  555.         $end_time = $row ['end_time'];
  556.         $checks = $row ['allow_checks'];
  557.         $active = $row ['is_active'];
  558.         $question1 = $row ['question1'];
  559.         $question2 = $row ['question2'];
  560.         $question3 = $row ['question3'];
  561.         $question4 = $row ['question4'];
  562.         $send_mail = $row ['send_mail'];
  563.         $conf_mail = $row ['conf_mail'];
  564.                 $event_location = $row ['event_location'];
  565.         $more_info = $row ['more_info'];
  566.         $custom_cur = $row ['custom_cur'];
  567.         $start_date = $start_month . " " . $start_day . ", " . $start_year;
  568.         $end_date = $end_month . " " . $end_day . ", " . $end_year;
  569.     }
  570.    
  571.     // Email Confirmation to Registrar
  572.    
  573.     $event_name = $current_event;
  574.    
  575.     $distro = $registrar;
  576.     $message = ("$fname $lname  has signed up on-line for $event_name.\n\nMy email address is  $email.");
  577.    
  578.     wp_mail ( $distro, $event_name . " Number: $attnum", $message );
  579.  
  580.    
  581.     //Email Confirmation to Attendee
  582.     $query = "SELECT * FROM $events_attendee_tbl WHERE fname='$fname' AND lname='$lname' AND email='$email'";
  583.     $result = mysql_query ( $query ) or die ( 'Error : ' . mysql_error () );
  584.     while ( $row = mysql_fetch_assoc ( $result ) ) {
  585.         $id = $row ['id'];
  586.     }
  587.    
  588.     $payment_link = $return_url . "?id=" . $id;
  589.    
  590.     //Email Confirmation to Attendee
  591.     $SearchValues = array ("[fname]", "[lname]", "[phone]", "[event]", "[description]", "[cost]", "[currency]", "[qst1]", "[qst2]", "[qst3]", "[qst4]", "[contact]", "[company]", "[co_add1]", "[co_add2]", "[co_city]", "[co_state]", "[co_zip]", "[payment_url]", "[start_date]", "[start_time]", "[end_date]", "[end_time]","[snum]", "[num_people]" );
  592.    
  593.     $ReplaceValues = array ($fname, $lname, $phone, $event_name, $event_desc, $cost, $custom_cur, $question1, $question2, $question3, $question4, $contact, $Organization, $Organization_street1, $Organization_street2, $Organization_city, $Organization_state, $Organization_zip, $payment_link, $start_date, $start_time, $end_date, $end_time, $attnum, $num_people);
  594.    
  595.     $custom = str_replace ( $SearchValues, $ReplaceValues, $conf_mail );
  596.     $default_replaced = str_replace ( $SearchValues, $ReplaceValues, $conf_message );
  597.    
  598.     $distro = $email;
  599.    
  600.     if ($default_mail == 'Y') {
  601.         if ($send_mail == 'Y') {
  602.             wp_mail ( $distro, $event_name, $custom );
  603.         }
  604.     }
  605.    
  606.     if ($default_mail == 'Y') {
  607.         if ($send_mail == 'N') {
  608.             wp_mail ( $distro, $event_name, $default_replaced );
  609.         }
  610.     }
  611.    
  612.     //Get registrars id from the data table and assign to a session variable for PayPal.
  613.    
  614.  
  615.     $query = "SELECT * FROM $events_attendee_tbl WHERE fname='$fname' AND lname='$lname' AND email='$email'";
  616.     $result = mysql_query ( $query ) or die ( 'Error : ' . mysql_error () );
  617.     while ( $row = mysql_fetch_assoc ( $result ) ) {
  618.         $id = $row ['id'];
  619.         $lname = $row ['lname'];
  620.         $fname = $row ['fname'];
  621.         $address = $row ['address'];
  622.         $city = $row ['city'];
  623.         $state = $row ['state'];
  624.         $zip = $row ['zip'];
  625.         $email = $row ['email'];
  626.         $num_people = $row ['num_people'];
  627.         $phone = $row ['phone'];
  628.         $date = $row ['date'];
  629.         $paystatus = $row ['paystatus'];
  630.         $txn_type = $row ['txn_type'];
  631.         $amt_pd = $row ['amount_pd'];
  632.         $date_pd = $row ['paydate'];
  633.         $event_id = $row ['event_id'];
  634.         $custom1 = $row ['custom_1'];
  635.         $custom2 = $row ['custom_2'];
  636.         $custom3 = $row ['custom_3'];
  637.         $custom4 = $row ['custom_4'];
  638.     }
  639.    
  640.     update_option ( "attendee_id", $id );
  641.    
  642.     //Send screen confirmation & forward to paypal if selected.
  643.    
  644.  
  645.     echo $lang ['registrationConfirm'];
  646.    
  647.     events_payment_page ( $event_id );
  648. }
  649.  
  650. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement