form.php
<?php
?>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery( ".rcontact" ).click(function( event ) {
jQuery(this).find('input').prop('checked', true);
});
jQuery( ".contactform" ).submit(function( event ) {
url = "<?php echo admin_url( 'admin-ajax.php' ); ?>";
var data = jQuery( this ).serialize();
jQuery.post(url, data, function(response) {
if(response)
{
if(response == "success")
{
jQuery(".formMsg").html('mail sent');
setTimeout(function(){
// location.reload();
},3000);
}
}
});
return false;
});
});
</script>
<div id="top" class="referentie">
<div class="text-vertical-center">
<h1>Referentie</h1>
<h2> Help anderen ook bespare</h2></div></div>
<section>
<div class="container"><div class="col-lg-12 text-center referp">
<div class="row"><p>U Kunt hier de namen en e-mailadressen van uw vrienden,Kennissen en<br/>collegas invoeren,zodat ook zij automatisch kunnen gaan besparen.</p></div>
<div class="col-lg-12 text-center tbldiv">
<ul>
<form name="contactform" method="post" class="contactform" id="contactform" action="#">
<input type="hidden" name="action" value="wps_referentie_form" />
<li><div class="col-md-3 referli"><input type="text" name="Voornaam" placeholder="Voornaam"></div>
<div class="col-md-3 referli"><input type="text" name="Achternaam" placeholder="Achternaam"></div>
<div class="col-md-5 referli"><input type="text" name="maila['mail1']" placeholder="E-mail Adres"></div></li>
<li><div class="col-md-3 referli"><input type="text" name="Voornaam3" placeholder="First name"></div>
<div class="col-md-3 referli"><input type="text" name="Achternaam3" placeholder="Achternaam"></div>
<div class="col-md-5 referli"><input type="text" name="maila['mail2']" placeholder="E-mail Adres"></div></li>
<li><div class="col-md-3 referli"><input type="text" name="Voornaam3" placeholder="Voornaam"></div>
<div class="col-md-3 referli"><input type="text" name="Achternaam3" placeholder="Achternaam"></div>
<div class="col-md-5 referli"><input type="text" name="maila['mail3']" placeholder="E-mail Adres"></div></li>
<li><div class="col-md-3 referli"><input type="text" name="Voornaam4" placeholder="Voornaam"></div>
<div class="col-md-3 referli"><input type="text" name="Achternaam4" placeholder="Achternaam"></div>
<div class="col-md-5 referli"><input type="text" name="maila['mail4']" placeholder="E-mail Adres"></div></li>
<li><div class="col-md-3 referli"><input type="text" name="Voornaam5" placeholder="First name"></div>
<div class="col-md-3 referli"><input type="text" name="Achternaam5" placeholder="Achternaam"></div>
<div class="col-md-5 referli"><input type="text" name="maila['mail5']" placeholder="E-mail Adres"></div></li>
<p class="btnrow"> <input type="submit" name="submit" value="Submit" ></p>
<h1><div class="formMsg"></div> </h1>
</form>
</ul>
</div>
</div>
</div>
<section>
index.php
<?php
ob_start();
session_start();
/**
* Plugin Name: Wps Custom
* Plugin URI:
* Description: custom plugin for all functions
* Version: 1.0.1
* Author: Webplanetsoft
*/
function wps_query_form()
{
require_once('template/form.php');
}
function wps_query_contact()
{
ob_start();
require_once('template/contact.php');
return ob_get_clean();
}
function wps_query_referentie()
{
ob_start();
require_once('template/referentie.php');
return ob_get_clean();
}
function wps_query_checkout()
{
ob_start();
require_once('template/checkout.php');
return ob_get_clean();
}
function wps_query_mail2()
{
if(isset($_POST['submit'])) {
$ordernummer=$_REQUEST['ordernummer'];
$email=$_REQUEST['email'];
$kosten=$_REQUEST['kosten'];
$beste=$_REQUEST['beste'];
$ons=$_REQUEST['ons'];
$besparing=$_REQUEST['besparing'];
$baseurl = site_url()."/wp-content/plugins/wps_custom/image/";
$content = file_get_contents(plugins_url( 'wps_custom/email/mail2.html', dirname(__FILE__) ));
$body = wps_replace_string($content,array('[base_url]'=>$baseurl,
'[ordernummer]'=>$ordernummer,'[kosten]'=>$kosten,'[beste]'=>$beste,'[ons]'=>$ons,'[besparing]'=>$besparing,'[email]'=>$email));
add_filter( 'wp_mail_content_type', 'wps_set_html_content_type' );
$to = "$email";
$subject = 'Check Out Page';
wp_mail( $to, $subject, $body );
remove_filter( 'wp_mail_content_type', 'wps_set_html_content_type' );
echo "success";
$page_url = admin_url( 'admin.php?page=ba_users' );
header('location:'.$page_url);
exit();
}
if(isset($_POST['send'])) {
$email=$_REQUEST['email'];
$besparing=$_REQUEST['besparing'];
$baseurl = site_url()."/wp-content/plugins/wps_custom/image/";
$content = file_get_contents(plugins_url( 'wps_custom/email/mail3.html', dirname(__FILE__) ));
$body = wps_replace_string($content,array('[base_url]'=>$baseurl));
add_filter( 'wp_mail_content_type', 'wps_set_html_content_type' );
$to = "$email";
$subject = 'Check Out Page';
wp_mail( $to, $subject, $body );
remove_filter( 'wp_mail_content_type', 'wps_set_html_content_type' );
echo "success";
header('location:'.$page_url);
exit();
}
require_once('template/mail2.php');
}
function wps_contact_form_callback()
{ $req = $_REQUEST;
$message=$_POST['message'];
$ordernummer=$_POST['ordernummer'];
$achternaam1=$_POST['achternaam1'];
$vraag=$_POST['vraag'];
$rtest=$_POST['rtest'];
$achternaam2=$_POST['achternaam2'];
$email2=$_POST['email2'];
$aanhef=$_POST['aanhef'];
$telefoonnummer=$_POST['telefoonnummer'];
$aanhef=$_POST['aanhef'];
$baseurl = site_url()."/wp-content/plugins/wps_custom/image/";
$content = file_get_contents(plugins_url( 'wps_custom/email/mail4.html', dirname(__FILE__) ));
$body = wps_replace_string($content,array('[base_url]'=>$baseurl));
$content = file_get_contents(plugins_url( 'wps_custom/email/contact.html', dirname(__FILE__) ));
$body2 = wps_replace_string($content,array('[base_url]'=>$baseurl,'[message]'=>$message,'[ordernummer]'=>$ordernummer, '[achternaam1]'=>$achternaam1,'[email]'=>$email,'[rtest]'=>$rtest,'[vraag]'=>$vraag,'[voorletters]'=>$voorletters,'[achternaam2]'=>$achternaam2,'[aanhef]'=>$aanhef ,'[email2]'=>$email2,'[telefoonnummer]'=>$telefoonnummer,'[custmrqusn]'=>$custmrqusn));
$adminmail=get_option('admin_email');
add_filter( 'wp_mail_content_type', 'wps_set_html_content_type' );
$to= "$email";
$to2 = "$adminmail";
$subject = 'Uw aanmelding bij BespaarAutomatisch.nl';
wp_mail($to2,$subject, $body2);
wp_mail( $to, $subject, $body );
remove_filter( 'wp_mail_content_type', 'wps_set_html_content_type' );
echo "success";
exit();
}
function wps_referentie_form_callback()
{
$allmail_address = array();
/*
$remail=$_POST['remail'];
$rmail=$_POST['rmail'];
$rmail=$_POST['rmail3'];
$rmail=$_POST['rmail4'];
$rmail=$_POST['rmail5'];
*/
$allmail_address = $_POST['maila'];
foreach($allmail_address as $key=> $email_current)
{
$baseurl = site_url()."/wp-content/plugins/wps_custom/image/";
$content = file_get_contents(plugins_url( 'wps_custom/email/mail6.html', dirname(__FILE__) ));
$body = wps_replace_string($content,array('[base_url]'=>$baseurl));
add_filter( 'wp_mail_content_type', 'wps_set_html_content_type' );
$to = $email_current;
$subject = 'Uw aanmelding bij BespaarAutomatisch.nl';
wp_mail( $to, $subject, $body );
remove_filter( 'wp_mail_content_type', 'wps_set_html_content_type' );
echo "success";
}
}
function wps_home_form_callback()
{
$req = $_REQUEST;
$elektriciteit=$_POST['elektriciteit'];
$gasverbruik=$_POST['gasverbruik'];
$geen=$_POST['geen'];
$fgroup=$_POST['fgroup'];
$rtest=$_POST['rtest'];
$fselect=$_POST['fselect'];
$post_code2=$_POST['post_code2'];
$post_code1=$_POST['post_code'];
$huisnummer=$_POST['huisnummer'];
$email=$_POST['email'];
$groene=$_POST['groene'];
$post_code = "$post_code1:$post_code2";
$adminmail=get_option('admin_email');
global $wpdb;
$sql= "INSERT INTO wp_cform SET elektriciteit = '{$elektriciteit}',gasverbruik = '{$gasverbruik}',type_meter = '{$rtest}',leverancier = '{$fselect}',post_code = '{$post_code}',huisnummer = '{$huisnummer}',mail = '{$email}',groene_energie = '{$groene}'";
$wpdb->query($sql);
$lastid = $wpdb->insert_id;
$baseurl = site_url()."/wp-content/plugins/wps_custom/image/";
$content = file_get_contents(plugins_url( 'wps_custom/email/form.html', dirname(__FILE__) ));
$body = wps_replace_string($content,array('[base_url]'=>$baseurl,
'[elektriciteit]'=>$elektriciteit,'[gasverbruik]'=>$gasverbruik,'[geen]'=>$geen,'[fgroup]'=>$fgroup,'[rtest]'=>$rtest,'[fselect]'=>$fselect,'[post_code]'=>$post_code,'[huisnummer]'=>$huisnummer,'[email]'=>$email,'[groene]'=>$groene,'[order_id]'=>$lastid));
add_filter( 'wp_mail_content_type', 'wps_set_html_content_type' );
$to = "$adminmail,$email";
$subject = 'Uw aanmelding bij BespaarAutomatisch.nl';
wp_mail( $to, $subject, $body );
remove_filter( 'wp_mail_content_type', 'wps_set_html_content_type' );
echo "success";
exit();
}
function wps_set_html_content_type()
{
return 'text/html';
}
function wps_replace_string($content,$aStrings)
{
if($aStrings)
{
foreach($aStrings as $aKey => $aString)
{
$content = str_replace($aKey,$aString,$content);
}
}
return $content;
}
add_shortcode('wps_query_form','wps_query_form');
add_shortcode('wps_query_contact','wps_query_contact');
add_shortcode('wps_query_mail2','wps_query_mail2');
add_shortcode('wps_query_checkout','wps_query_checkout');
add_shortcode('wps_query_referentie','wps_query_referentie');
add_action( 'wp_ajax_wps_home_form', 'wps_home_form_callback');
add_action('wp_ajax_nopriv_wps_home_form', 'wps_home_form_callback');
add_action( 'wp_ajax_wps_contact_form', 'wps_contact_form_callback');
add_action('wp_ajax_nopriv_wps_contact_form', 'wps_contact_form_callback');
add_action( 'wp_ajax_wps_mail2_form', 'wps_contact_mail2_callback');
add_action('wp_ajax_nopriv_wps_mail2_form', 'wps_contact_mail2_callback');
add_action( 'wp_ajax_wps_referentie_form', 'wps_referentie_form_callback');
add_action('wp_ajax_nopriv_wps_referentie_form', 'wps_referentie_form_callback');
add_action('admin_menu', 'admin_menu_item'); // add a new menu item in admin panel
function admin_menu_item(){
add_menu_page('Ba-Users','Ba Users','administrator','ba_users','ba_users');
add_menu_page('Ba-payment','Ba Payment','administrator','ba_payment','ba_payment');
}
function ba_users(){
echo do_shortcode('[wps_query_mail2]');
}
function ba_payment(){
global $wpdb;
echo '<div class="wrap"><div id="icon-tools" class="icon32"></div>';
echo '<h2 style="text-align:center">Transaction Details </h2>';
echo '</div>';
$myrows = $wpdb->get_results( " select * from wp_payment" );
echo ' <table class="table" ><tr style="text-align:center"> <th>Sr No.</th> <th>Order Id</th> <th> Voorletters </th> <th> Achternaam </th> <th> Aanhef </th> <th> Dob </th> <th> Telefoon </th> <th> Postcode </th> <th> Straat </th><th> Woonplaats </th><th> Huisnummer </th><th>Iban </th><th> Naamr </th><th> Transaction Status </th> </tr> ';
$i=1;
foreach($myrows as $data)
{
echo '<tr>';
echo '<td> '.$i++.'</td>';
echo '<td>'.$data->order_id.'</td>';
echo '<td>'.$data->voorletters.'</td>';
echo '<td>'.$data->achternaam.'</td>';
echo '<td>'.$data->aanhef.'</td>';
echo '<td>'.$data->dob.'</td>';
echo '<td style="text-align:center">'.$data->telefoon.'</td>';
echo '<td>'.$data->postcode.'</td>';
echo '<td>'.$data->straat.'</td>';
echo '<td>'.$data->woonplaats.'</td>';
echo '<td>'.$data->huisnummer .'</td>';
echo '<td>'.$data->iban.'</td>';
echo '<td>'.$data->naamr.'</td>';
echo '<td style="text-align:center">'.$data->status.'</td>';
echo '</tr>'; ;
}
echo '</table>';
}
Comments
Post a Comment