Sh3ll
OdayForums


Server : LiteSpeed
System : Linux premium84.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
User : claqxcrl ( 523)
PHP Version : 8.1.32
Disable Function : NONE
Directory :  /home/claqxcrl/confenda.com/wp-content/themes/beevent/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/claqxcrl/confenda.com/wp-content/themes/beevent/payment-success.php
<?php 
/**

 * Template name: Payment Success

 *

 * Learn more: http://codex.wordpress.org/Template_Hierarchy

 *

 * @package WordPress

 */
get_header(); 

$payfast_data = get_transient( 'payfast_data' );
$iname        = '';
$Quantity     = '';

if ( !empty( $payfast_data ) ) {

    $TotalPrice  = $payfast_data["amount_gross"];
    $ActualPrice = $payfast_data["custom_str3"];
    $Quantity    = $payfast_data["custom_str2"];
    $iname       = $payfast_data["item_name"];
    $fname       = $payfast_data["name_first"];
    $lname       = $payfast_data["name_last"];
    $phone       = $payfast_data["custom_str4"];
    $uemail      = $payfast_data['email_address'];
    $address     = $payfast_data["custom_str5"];
    $Token       = $payfast_data["signature"];
    $itemno      = '';
    $method      = 'Payfast';
    $Shipping    = $TotalPrice - $ActualPrice;
    $singleTicketPrice = $ActualPrice/$Quantity;

    if ( is_user_logged_in() ) {
        $user_ID = get_current_user_id();
        $user    = get_userdata( $user_ID );
        $user_email = ! empty ( $user->user_email ) ? $user->user_email : '';

        if ( empty ( $fname  ) ) {
            $fname = ! empty ( $user->first_name ) ? $user->first_name : '';
        }
        if ( empty ( $lname  ) ) {
            $lname = ! empty ( $user->last_name ) ? $user->last_name : '';
        }
    }

    $wpsc_order = array(
        'post_title'   => 'WPSC Cart Order for '.$iname,
        'post_type'    => 'wpsc_cart_orders',
        'post_content' => '',
        'post_status'  => 'publish',
    );
    $post_id = wp_insert_post( $wpsc_order );

    $currency_symbol  = get_option( 'cart_currency_symbol' );
    $item_total       = $singleTicketPrice * $Quantity;
    $product_details .= " Item name :- " . $iname . "\n";
    $product_details .= " Payment Method :- " . $method . "\n";
    $product_details .= $singleTicketPrice . " x " . $Quantity . " = " . $currency_symbol . wpspsc_number_format_price( $item_total ) . "\n";

    update_post_meta( $post_id, 'wpspsc_items_ordered', $product_details );
    update_post_meta( $post_id, 'wpsc_email_address', $uemail );
    update_post_meta( $post_id, 'wpsc_shipping_amount', $Shipping );
    update_post_meta( $post_id, 'wpsc_total_amount', $TotalPrice );
    update_post_meta( $post_id, 'wpsc_ipaddress', $_SERVER['REMOTE_ADDR'] );
    update_post_meta( $post_id, 'wpsc_address', $address );
    update_post_meta( $post_id, 'wpspsc_phone', $phone );
    update_post_meta( $post_id, 'wpsc_order_status', 'Paid' );
    update_post_meta( $post_id, 'wpsc_txn_id', $Token );
    update_post_meta( $post_id, 'wpsc_first_name', $fname );
    update_post_meta( $post_id, 'wpsc_last_name', $lname );
    // update_post_meta( $post_id, 'wpsc_event_name', $ename );

    if ( isset($_SESSION['simpleCart']) && !empty($_SESSION['simpleCart'] ) ) {
        update_post_meta( $post_id, 'wpsc_cart_items', $_SESSION['simpleCart']);
    }

    if ( ! empty ( $post_id ) ) {

        $args                      = array();
        $args[ 'product_details' ] = $product_details;
        $args[ 'order_id' ]        = $post_id;
        $args[ 'coupon_code' ]     = '';
        $args[ 'address' ]         = $address;
        $args[ 'payer_email' ]     = $uemail;

        $ipn_data                  = array();
        $ipn_data['first_name']    = $fname;
        $ipn_data['last_name']     = $lname;
        $ipn_data['txn_id']        = $Token;
        $ipn_data['contact_phone'] = $phone;

        $cart_items   = array();
        $current_item = array(
            'item_number'  => $itemno,
            'item_name'    => $iname,
            'quantity'     => $Quantity,
            'mc_gross'     => $TotalPrice,
            'mc_currency'  => $currency_symbol,
        );
        array_push( $cart_items, $current_item );

        $from_email           = get_option( 'wpspc_buyer_from_email' );
        $subject              = get_option( 'wpspc_buyer_email_subj' );
        $subject              = wpspc_apply_dynamic_tags_on_email( $subject, $ipn_data, $args );
        $body                 = get_option( 'wpspc_buyer_email_body' );
        $args[ 'email_body' ] = $body;
        $body                 = wpspc_apply_dynamic_tags_on_email( $body, $ipn_data, $args );
        $body                 = apply_filters( 'wspsc_buyer_notification_email_body', $body, $ipn_data, $cart_items );

        $headers = 'From: ' . $from_email . "\r\n";
        if ( ! empty( $uemail ) ) {
            if ( get_option( 'wpspc_send_buyer_email' ) ) {
                if(in_array('beevent-post-type/beevent-post-type.php', apply_filters('active_plugins', get_option('active_plugins')))){
                    olomo_olomo_wp_mail( $uemail, $subject, $body, $headers );
                    update_post_meta( $post_id, 'wpsc_buyer_email_sent', 'Email sent to: ' . $uemail );
                }
            }
        }
        $notify_email         = get_option( 'wpspc_notify_email_address' );
        $seller_email_subject = get_option( 'wpspc_seller_email_subj' );
        $seller_email_subject = wpspc_apply_dynamic_tags_on_email( $seller_email_subject, $ipn_data, $args );

        $seller_email_body    = get_option( 'wpspc_seller_email_body' );
        $args[ 'email_body' ] = $seller_email_body;
        $seller_email_body    = wpspc_apply_dynamic_tags_on_email( $seller_email_body, $$ipn_data, $args );
        $seller_email_body    = apply_filters( 'wspsc_seller_notification_email_body', $seller_email_body, $ipn_data, $cart_items );

        if ( ! empty( $notify_email ) ) {
            if ( get_option( 'wpspc_send_seller_email' ) ) {
                if(in_array('beevent-post-type/beevent-post-type.php', apply_filters('active_plugins', get_option('active_plugins')))){
                    olomo_olomo_wp_mail( $notify_email, $seller_email_subject, $seller_email_body, $headers );
                }
            }
        }
    }
}

if ( isset( $_GET['eid'] ) ) {
    $eid  = $_GET['eid'];
    $name = get_post_meta( $eid, 'wpsc_total_amount' );
}
?>
<!-- Banners -->
<?php if(has_post_thumbnail()){ ?>

<section class="inner-pages text-center" style="background:url(<?php echo the_post_thumbnail_url( 'full' ); ?>)">

<?php } else { ?>
<section class="inner-pages text-center" style="background:url(<?php beevent_InnerHeader(); ?>)"> 
<?php } ?> 
   <div class="container">
       <div class="white_text div_zindex">
                
      <h1 class="page_title"><?php echo esc_html(the_title()); ?></h1>
        
       </div>
    </div>   
  <div class="dark-overlay"></div>
</section>
<!-- /Banners --> 
<!-- Our Articles -->
<section class="our_articles single_article">
<div class="container">
<div class="row">
<div class="alert alert-success payment-success">
  <strong><i class="fa fa-check"></i><?php echo esc_html_e('Success!','beevent'); ?></strong> <?php echo esc_html_e('Your Ticket Booking is confirmed, Below are the details of your Booking:','beevent'); ?>
</div>  
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.5.3/jspdf.debug.js" integrity="sha384-NaWTHo/8YCBYJ59830LTz/P4aQZK1sS0SneOgAvhsIl3zBu8r9RevNg5lHCHAuQ/" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.4/jspdf.min.js"></script>
<script src="https://html2canvas.hertzen.com/dist/html2canvas.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.9.1/html2pdf.js"></script> 
<script>
function doit(){
if (!window.print){
alert("You need NS4.x to use this print button!")
return
}
window.print()
}
</script>
<script>
    jQuery(document).ready(function() {
        jQuery('#cmd').click(function () {
            var element = document.getElementById('printablediv');
            html2pdf(element, {
                margin: 0,
                filename: 'payment-success.pdf',
                image: { type: 'jpeg', quality: 1 },
                html2canvas: { scale: 2, logging: true },
                jsPDF: { unit: 'in', format: 'a4' }
            });
        });
    });
</script>   
<div class="col-md-12 table-head">
<h3><?php echo esc_html_e('Receipt Details','beevent'); ?></h3>
<div class="success-button">
<button type="button" id="cmd" class="btn"><i class="fa fa-file-pdf-o"></i><?php echo esc_html_e('Save AS PDF','beevent'); ?></button>
<a href="javascript:doit()" class="btn"><i class="fa fa-print"></i><?php echo esc_html_e('PRINT','beevent'); ?></a>
</div>
</div>
<?php
$order = new WP_Query(array('post_type' => 'wpsc_cart_orders', 'post_status' => 'publish', 'order' => 'DESC','posts_per_page'=>1)); 
while ( $order->have_posts() ) : $order->the_post();
    $orderss = get_post_meta( get_the_ID(), 'wpsc_cart_items' , true );
    foreach( $orderss as $orders ) {
        $plan_name  = $orders['name'];
        $url        = $orders['cartLink'];
        $event_id   = url_to_postid( $url );
        $event_name = get_the_title( $event_id );
        $ticket     = $orders['quantity'];
        $price      = get_post_meta( get_the_ID(), 'wpsc_total_amount', true );
    }
    $date   = get_the_date();
    $time   = get_the_time( '', get_the_ID() );
    $email  = get_post_meta( get_the_ID(), 'wpsc_email_address' , true );
    $ename  = get_post_meta( get_the_ID(), 'wpsc_event_name' , true );
    $txn_id = get_post_meta( get_the_ID(), 'wpsc_txn_id' , true );
    $ip     = get_post_meta( get_the_ID(), 'wpsc_ipaddress' , true );
endwhile; wp_reset_postdata(); 
?>

<table class="table" id='printablediv'>
<thead>
<tr>
<th colspan="2" class="text-center"><?php echo esc_html_e('Receipt for payment of ticket booking. This reciept is generated from BeEvent.','beevent'); ?></th>
</tr>
</thead>
<tbody>
<tr>
<td><?php echo esc_html_e('Event Name:','beevent'); ?></td>
<td><a href="<?php echo esc_url( $url ); ?>"><?php if ( ! empty ( $event_name ) ) { echo esc_html( $event_name ); } else { echo esc_html( $ename ); } ?></a></td>
</tr>
<tr>
<td><?php echo esc_html_e('Plan:','beevent'); ?></td>
<td><?php if ( ! empty ( $plan_name ) ) { echo esc_html( $plan_name ); } else { echo esc_html( $iname ); } ?></td>
</tr>
<tr>
<td><?php echo esc_html_e('No. of tickets:','beevent'); ?></td>
<td><?php if ( ! empty ( $ticket ) ) { echo esc_html( $ticket ); } else { echo esc_html( $Quantity ); } ?></td>
</tr>
<tr>
<td><?php echo esc_html_e('Amount:','beevent'); ?></td>
<td><?php echo esc_html( $price ).$currency_symbol; ?></td>
</tr>
<tr>
<td><?php echo esc_html_e('Transaction ID:','beevent'); ?></td>
<td><?php echo esc_html( $txn_id ); ?></td>
</tr>
<tr>
<td><?php echo esc_html_e('Transaction Date & Time:','beevent'); ?></td>
<td><?php echo esc_html( $date )." & ".esc_html( $time ); ?></td>
</tr>
<tr>
<td><?php echo esc_html_e('Email:','beevent'); ?></td>
<td><?php echo esc_html( $email ); ?></td>
</tr>
<tr>
<td><?php echo esc_html_e('IP Address.:','beevent'); ?></td>
<td><?php echo esc_html( $ip ); ?></td>
</tr>
</tbody>
</table>
<div id="editor"></div>
<div class="success-button text-center">
<a href="<?php echo esc_url( home_url('/event') ); ?>" class="btn text-center"><?php esc_html_e('Continue','beevent'); ?></a>
</div>
</div>
</div>  
</section>
<!-- /Our Articles -->  

<?php get_footer();

ZeroDay Forums Mini