D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
stickain
/
www
/
itosu-ryu.us
/
registration
/
wp-content
/
themes
/
twentythirteen
/
Filename :
notify.php
back
Copy
<?php /* Template Name: notify */ ?> <?php get_header();?> <div id="primary" class="content-area"> <div id="content" class="site-content" role="main"> <?php $payment_status=$_POST['payment_status']; ?> <?php if($payment_status == "Completed") { if(isset($_POST['item_number'])){ $sid = $_POST['item_number']; } $body = $payment_status." ".$sid; $current_temp =of_get_option('template_selection', '' ); if($current_temp == "tournament_one") { $paypal_acc = of_get_option('tor1_paypal_acc', '' ); $tourn_name = of_get_option('tor1_tournament_name', '' ); $techemails = of_get_option('tor1_email', '' ); } if($current_temp == "tournament_two") { $paypal_acc = of_get_option('tor2_paypal_acc', '' ); $tourn_name = of_get_option('tor2_tournament_name', '' ); $techemails = of_get_option('tor2_email', '' ); } if($current_temp == "tournament_three") { $paypal_acc = of_get_option('tor3_paypal_acc', '' ); $tourn_name = of_get_option('tor3_tournament_name', '' ); $techemails = of_get_option('tor3_email', '' ); } if($current_temp == "tournament_four") { $paypal_acc = of_get_option('tor4_paypal_acc', '' ); $tourn_name = of_get_option('tor4_tournament_name', '' ); $techemails = of_get_option('tor4_email', '' ); } if($current_temp == "tournament_five") { $paypal_acc = of_get_option('tor5_paypal_acc', '' ); $tourn_name = of_get_option('tor5_tournament_name', '' ); $techemails = of_get_option('tor5_email', '' ); } $TBLNAME = "mee_tournament_tbl"; $NEWTBL = "mee_ftournament_tbl"; $RESULT = $wpdb->get_results("SELECT * FROM $TBLNAME WHERE Sessid='$sid'",ARRAY_A); if(sizeof($RESULT)>0) { foreach($RESULT as $reskey) { $username = $reskey['Email']; $password = wp_generate_password(); $first_name = $reskey['Name']; $phone = $reskey['Phone']; $address = $reskey['Address']; $city = $reskey['City']; $state = $reskey['State']; $zip = $reskey['Zipcode']; $age = $reskey['Age']; $gender = $reskey['Gender']; $level = $reskey['Level']; $date = $reskey['Date']; $iname = $reskey['Iname']; $dname = $reskey['Dname']; $icity = $reskey['Icity']; $istate = $reskey['Istate']; $division = $reskey['Division']; $divnumber = $reskey['Divnumber']; $did = $reskey['DID']; $total = $reskey['Total']; $penalty = $reskey['Penalty']; $type = $reskey['Type']; $sess = $reskey['Sessid']; $reg_date = $reskey['Regdate']; $userdata = array( 'user_login' => $username, 'user_pass' => $password, 'first_name' => $first_name, 'last_name' => '', 'user_nicename' => $first_name, 'display_name' => $first_name, 'nickname' => $first_name, 'user_email' => $username, 'user_url' => '', 'role' => 'contributor' ); $user_id = wp_insert_user($userdata); wp_new_user_notification($user_id,$password); // Mail for Admin //$paypal_acc = of_get_option('tor5_paypal_acc', '' ); $to = $paypal_acc; //admin email $subject = "New Tournament Registration Received"; $message.="Hello, Sensei:<br/><br/>"; $message.="A new registration has been received for your upcoming tournament.<br/>"; $div_numbersarr = explode(";",$divnumber); $message.="The details are as follows:<br/><br/>"; $message.="Competitor’s Name : $first_name<br/>"; $message.="Registration Date : $reg_date<br/>"; for($k=0;$k<(sizeof($div_numbersarr)-1);$k++) { $message.="Division : $div_numbersarr[$k]<br/>"; } $message.="Amount paid : $".$total."<br/><br/>"; $message.="Please do not reply to this email as will will go nowhere.<br/><br/>"; $headers.='From: itosu-ryu.us<registrations@patma.us>' . "\r\n"; $headers.= 'MIME-Version: 1.0' . "\r\n"; $headers.= 'Content-type: text/html; charset=UTF-8' . "\r\n"; wp_mail( $to, $subject, $message, $headers); wp_mail( $techemails, $subject, $message, $headers); $message=""; $headers=""; // mail for competitor $to = $username; //competitor email $subject = "Your Tournament Registration Details"; $message.="Hello:<br/><br/>"; $message.="This is to confirm your registration for the $tour_name tournament. The details are as follows:<br/><br/>"; $div_numbersarr = explode(";",$divnumber); $message.="Competitor’s Name : $first_name<br/>"; $message.="Registration Date : $reg_date<br/>"; for($k=0;$k<(sizeof($div_numbersarr)-1);$k++) { $message.="Division : $div_numbersarr[$k]<br/>"; } $message.="Amount paid : $".$total."<br/><br/>"; $message.="Please do not reply to this email as will will go nowhere.<br/><br/>"; $headers.='From: itosu-ryu.us<registrations@patma.us>' . "\r\n"; $headers.= 'MIME-Version: 1.0' . "\r\n"; $headers.= 'Content-type: text/html; charset=UTF-8' . "\r\n"; wp_mail( $to, $subject, $message, $headers); $message=""; $headers=""; update_user_meta($user_id,'wpcf-name',$first_name); update_user_meta($user_id,'wpcf-phone',$phone); update_user_meta($user_id,'wpcf-address',$address); update_user_meta($user_id,'wpcf-city',$city); update_user_meta($user_id,'wpcf-state',$state); update_user_meta($user_id,'wpcf-zipcode',$zip); update_user_meta($user_id,'wpcf-date-of-birth',$date); $COPYSQL = $wpdb->query("INSERT into $NEWTBL(Name,Phone,Address,City,State,Zipcode,Email,Age,Gender,Level,Date,Iname, Dname,Icity,Istate,Division,Divnumber,DID,Total,Penalty,Type,Sessid,Regdate)values ('$first_name','$phone','$address','$city','$state','$zip','$username','$age','$gender','$level','$date','$iname', '$dname','$icity','$istate','$division','$divnumber','$did','$total','$penalty','$type','$sess','$reg_date')"); } if($COPYSQL){ $DELSQL = $wpdb->query("DELETE FROM $TBLNAME WHERE Sessid='$sid'"); } } else { echo "No Records to Save..."; } } ?> </div><!-- #content --> </div><!-- #primary --> <?php get_sidebar(); ?> <?php get_footer(); ?>