PATH:
home
/
lab2454c
/
invest.equitablebarter.com
/
wp-content
/
plugins
/
investments
<?php /* Plugin Name: Investments Description: Investments info Version: 1.00 Author: 3gmediasolution Domain Path: /lang/ */ /* Copyright 2021 */ add_action('admin_menu', 'investments_info_pages'); add_action('admin_menu', 'investments_info_pages'); function investments_info_pages(){ add_menu_page('Investments', 'Investments', 'manage_options', 'investments_info', 'investments_info','',4 ); add_submenu_page('investments_info', 'Investors Info', 'Investors Info', 'manage_options', 'view_investors_Info', 'view_investors_Info'); } function investments_info(){ global $post; global $wpdb; ?> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script> <script type="text/javascript" src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script> <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.15/css/jquery.dataTables.min.css"> <div class="container"> <h2>Investments</h2> <table class="table" id="example1"> <thead> <th>Portfolio name</th> <th>Total Investment</th> <th>No of Investors</th> <th>Maximum Investment</th> <th>Minimum Investment</th> <th>Average Investment</th> <th>Details</th> </tr> </thead> <tbody> <?php $actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; $posturl = site_url()."/wp-admin/admin.php?page=view_investors_Info"; $args = array( 'post_type' => 'investments', 'order' => 'DESC' ); $query = new WP_Query( $args ); if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); $pid = get_the_ID(); $investors_data = $wpdb->get_row("SELECT COUNT(DISTINCT `cust_id`) AS investors from transaction WHERE `item_number` = '".$pid."'"); $investors_count = $investors_data->investors; $investmentdata = $wpdb->get_row("SELECT SUM(`paid_amount`) AS total_investment FROM transaction WHERE `item_number` = '".$pid."'"); $totalinvestment = $investmentdata->total_investment/100; $totalinvestment_round = round($totalinvestment); $totalinvestment_amount = number_format($totalinvestment_round,2,".",","); $investment_data = $wpdb->get_row("SELECT `paid_amount` FROM `transaction` WHERE `item_number`= '".$pid."' ORDER BY `paid_amount` DESC LIMIT 1"); $largestinvestment = $investment_data->paid_amount/100; $largest_investment_round = round($largestinvestment); $largest_investment = number_format($largest_investment_round,2,".",","); $investment_avg_data = $wpdb->get_row("SELECT AVG(`paid_amount`) AS avg_investment FROM transaction WHERE `item_number` = '".$pid."'"); $avginvestment = $investment_avg_data->avg_investment/100; $avg_investment_round = round($avginvestment); $avg_investment = number_format($avg_investment_round,2,".",","); ?> <tr> <td><?php echo get_field('title',$post->ID); ?></td> <td><?php echo $totalinvestment_amount; ?></td> <td><?php echo $investors_count; ?></td> <td><?php echo $largest_investment; ?></td> <td><?php echo get_field('min_investment',$post->ID); ?></td> <td><?php echo $avg_investment; ?></td> <td> <form action="<?php echo $posturl; ?>" method="post"> <input type="hidden" class="form-control" name="pid" value="<?php echo $pid; ?>"> <button type="submit" name="show" value="show" class="btn btn-info">Show</button> </form> </td> </tr> <?php endwhile; endif; wp_reset_postdata(); ?> </tbody> </table> </div> <script type="text/javascript"> jQuery(document).ready(function($) { $('#example1').dataTable( { }); } ); </script> <?php } function view_investors_Info(){ global $wpdb; if(isset($_POST['show'])) { $pid = $_POST['pid']; $cust_ids = $wpdb->get_results("SELECT * from transaction WHERE `item_number` = '".$pid."' ORDER BY `id` DESC "); }else{ $cust_ids = $wpdb->get_results("SELECT * from transaction ORDER BY `id` DESC "); } ?> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script> <script type="text/javascript" src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script> <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.15/css/jquery.dataTables.min.css"> <div class="container"> <h2>Investors</h2> <table class="table" id="example1"> <thead> <th>No</th> <th>Investor Name</th> <th>Portfolio name</th> <th>Date of Investment</th> <th>Amount Invested</th> <th>Email Address</th> <th>Phone Number</th> </tr> </thead> <tbody> <?php $i=1; foreach ($cust_ids as $item) { $current_user_id = $item->cust_id; $id = $item->id; $user_meta = get_userdata($current_user_id); $first_name = $user_meta->first_name; $last_name = $user_meta->last_name; $cell_phone_number = $user_meta->cell_phone_number; $createddate = $wpdb->get_row("SELECT DATE(`created_date`) AS dateget FROM transaction WHERE `cust_id` = '".$current_user_id."' AND `id` = '".$id."'"); $created_date = $createddate->dateget; // $date_inv = date('Y-m-d', strtotime($created_date)); $custemail = $wpdb->get_row("SELECT cust_email FROM transaction WHERE `cust_id` = '".$current_user_id."' AND `id` = '".$id."'"); $emailAddress = $custemail->cust_email; $paid_amount = $wpdb->get_row("SELECT paid_amount FROM transaction WHERE `cust_id` = '".$current_user_id."' AND `id` = '".$id."'"); $investmentamount = $paid_amount->paid_amount/100; $usr_investment_round = round($investmentamount); $usr_investmentround = number_format($usr_investment_round,2,".",","); $itemname = $wpdb->get_row("SELECT item_name FROM transaction WHERE `cust_id` = '".$current_user_id."' AND `id` = '".$id."'"); $item_name = $itemname->item_name; // $customerCity = $user_meta->customerCity; // $customerAddress = $user_meta->customerAddress; // $annual_income = $user_meta->annual_income; // $net_worth = $user_meta->net_worth; // $country_of_residence = $user_meta->country_of_residence; // $check_on_wiretransfer = $user_meta->check_on_wiretransfer; // $optradio = $user_meta->optradio; // $customerAddressTwo = $user_meta->customerAddressTwo; // $customerAddress = $user_meta->customerAddress; // $customerState = $user_meta->customerState; // $customerCountry = $user_meta->customerCountry; // $customerZipcode = $user_meta->customerZipcode; // $customerCity = $user_meta->customerCity; // $dob = $user_meta->dob; // $giin = $user_meta->giin; // $file_one = $user_meta->file_one; // $file_two = $user_meta->file_two; // $review_username = $user_meta->review_username; ?> <tr> <td><?php echo $i; ?></td> <td><?php echo $first_name." ".$last_name; ?></td> <td><?php echo $item_name; ?></td> <td><?php echo $created_date; ?></td> <td><?php echo $usr_investmentround; ?></td> <td><?php echo $emailAddress; ?></td> <td><?php echo $cell_phone_number; ?></td> </tr> <?php $i++; } ?> </tbody> </table> </div> <script type="text/javascript"> jQuery(document).ready(function($) { $('#example1').dataTable( { order: [[ 1, "desc" ]], }); } ); </script> <?php }
[+]
..
[-] .htaccess
[edit]
[-] investments.php
[edit]