File Manager Script
X

Create New Item

File Folder

X

Search Results

File "shares.php"

Full path: /home/quiczmwg/lightspringdigitals.com/../../quiczmwg/wealthspringinc.org/shares.php
File size: 17.06 KiB (17467 bytes)
MIME-type: text/x-php; charset=us-ascii
Charset: utf-8

Download   Open   Edit   Advanced Edit   Back

<?php
// Include necessary files and start the session
include 'include/head.php';
// include 'include/db_connection.php';

session_start();

if (!isset($_SESSION['userid'])) {
    header("Location: ./login.php");
    exit();
}

$userid = $_SESSION['userid'];

// Query to get the shares from the database
$sql = "SELECT id, plan_title FROM shares";
$result = $conn->query($sql);
?>
<style>
    /* Prevent background change on focus/typing */
    .form-control, 
    .form-select {
        background-color: transparent !important;
        color: white; /* Set text color to white */
    }

    /* Optional: Prevent the browser's autofill from changing the background color */
    input:-webkit-autofill {
        -webkit-box-shadow: 0 0 0 1000px transparent inset !important;
        color: white;
    }

    /* Ensure the dropdowns also maintain the transparent background */
    .form-select option {
        background-color: black; /* Adjust the background color of options if necessary */
        color: white; /* Set text color for options */
    }
    @media (max-width: 768px) {
        .foot {
            height: 490px;
        }
    }
</style>
<body>
<div class="main-connt">
        <!-- Sidebar -->
        <?php include 'include/index_header.php'; ?>

        <div class="conten" id="content">
            <!-- </?php include 'include/header.php'; ?> -->

            <div class="page-content">
                <div class="container-fluid">
                    <div style="height: 120px;"></div>
                    <!-- Start page title -->
                    <div class="row">
                        <div class="col-12">
                            <div class="page-title-box d-sm-flex align-items-center justify-content-between">
                                <h5 class="mb-sm-0">Shares</h5>
                                <div class="page-title-right">
                                    <ol class="breadcrumb m-0">
                                        <li class="breadcrumb-item"><a href="javascript: void(0);">Dashboards</a></li>
                                        <li class="breadcrumb-item active">Shares</li>
                                    </ol>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- End page title -->

                    <div class="row">
                        <div class="col-md-12">
                            <div class="card">
                                <div class="card-header align-items-center d-flex">
                                    <h5 class="card-title mb-0 flex-grow-1">Shares</h5>
                                </div>

                                <div class="card-body">
                                    <?php
                                    // Check if the status parameter is present in the URL
                                    if (isset($_GET['status'])) {
                                        // Check the value of the status parameter
                                        $status = $_GET['status'];
                                        if ($status === "success") {
                                            // Display success message with green background
                                            echo '<div class="alert alert-success" role="alert" style="background-color: #d4edda; border-color: #c3e6cb; color: #155724;">';
                                            echo 'Success! Your Share deposit has been sent and will be confirmed.';
                                            echo '</div>';
                                        } elseif ($status === "error") {
                                            // Display error message
                                            echo '<div class="alert alert-danger" role="alert">';
                                            echo 'Oops! Something went wrong. Please try again later.';
                                            echo '</div>';
                                        }
                                    }
                                    ?>
                                    <p class="text-muted">Fill the form to start your deposit process.</p>
                                    <div class="live-preview">
                                        <form method="post" action="shares_confirmation.php" enctype="multipart/form-data">
                                        
                                            <!-- Add this hidden input inside your form tag -->
                                            <input type="hidden" id="crypto_amount" name="crypto_amount" value="">

                                            <input type="hidden" name="_token" value="Qi57qtSqAA3cMcr44bNnAouLGjuLPjxZk5XwLBbe">
                                            <div class="row">
                                                <div class="col-md-6">
                                                    <div class="mb-3">
                                                        <label for="share" class="form-label">Share</label>
                                                        <select id="share" name="share" onchange="getShareDetails()" class="form-select form-control" data-choices data-choices-sorting="true">
                                                            <option value="">Choose share...</option>
                                                            <?php
                                                            if ($result->num_rows > 0) {
                                                                while ($row = $result->fetch_assoc()) {
                                                                    echo '<option value="' . $row["id"] . '">' . $row["plan_title"] . '</option>';
                                                                }
                                                            } else {
                                                                echo '<option value="">No shares available</option>';
                                                            }
                                                            ?>
                                                        </select>
                                                    </div>
                                                </div>
                                                <!-- End col -->
                                                <div class="col-md-6">
                                                    <div class="mb-3">
                                                        <label for="roi" class="form-label">Percent interest</label>
                                                        <input type="text" class="form-control" id="roi" readonly>
                                                    </div>
                                                </div>
                                                <!-- End col -->
                                                <div class="col-md-6">
                                                    <div class="mb-3">
                                                        <label for="minimum" class="form-label">Minimum amount</label>
                                                        <input type="text" class="form-control" id="minimum" readonly>
                                                    </div>
                                                </div>
                                                <!-- End col -->
                                                <div class="col-md-6">
                                                    <div class="mb-3">
                                                        <label for="maximum" class="form-label">Maximum amount</label>
                                                        <input type="text" class="form-control" id="maximum" readonly>
                                                    </div>
                                                </div>
                                                <!-- End col -->
                                                <div class="col-md-6">
                                                    <div class="mb-3">
                                                        <label for="duration" class="form-label">Duration</label>
                                                        <input type="text" class="form-control" id="duration" readonly>
                                                    </div>
                                                </div>
                                                <!-- End col -->
                                                <div class="col-md-6">
                                                    <div class="mb-3">
                                                        <label for="amount" class="form-label">Amount</label>
                                                        <input type="text" name="amount" class="form-control" id="amount" onkeyup="calculate()" oninput="this.value = this.value.replace(/[^0-9,.]/g, '').replace(/(\..*)\./g, '$1')" required>
                                                        <small id="amount-error" style="color: red; display: none;">Please enter an amount within the allowed range.</small>
                                                    </div>
                                                </div>
                                                <!-- End col -->
                                                <div class="col-md-6">
                                                    <div class="mb-3">
                                                        <label for="profit" class="form-label">Profit</label>
                                                        <input type="text" class="form-control" id="profit" readonly>
                                                    </div>
                                                </div>
                                                <!-- End col -->
                                                <div class="col-md-6">
                                                    <div class="mb-3">
                                                        <label for="total" class="form-label">Total</label>
                                                        <input type="text" class="form-control" id="total" readonly>
                                                    </div>
                                                </div>
                                                <!-- End col -->
                                                <div class="col-md-6">
                                                    <div class="mb-3">
                                                        <label for="currency" class="form-label">Method</label>
                                                        <select class="selectricBl payMet1 form-control" name="wallet_type" id="wallet_type" onchange="getWalletAddress(this.value)" required>
                                                            <option value="">Select Wallet Type</option>
                                                            <?php
                                                            $stmt = $conn->prepare("SELECT DISTINCT wallet_type FROM wallet");
                                                            $stmt->execute();
                                                            $stmt->store_result();
                                                            $stmt->bind_result($wallet_type);
                                                            while ($stmt->fetch()) {
                                                                echo '<option value="' . htmlspecialchars($wallet_type) . '">' . htmlspecialchars($wallet_type) . '</option>';
                                                            }
                                                            ?>
                                                        </select>
                                                    </div>
                                                </div>
                                                <!-- End col -->
                                                <div class="col-lg-12">
                                                    <div class="text-right">
                                                        <button type="submit" id="submit-button" class="btn align-item-right" style="background: red; color: #fff;">Submit</button>
                                                    </div>
                                                </div>
                                                <!-- End col -->
                                            </div>
                                            <!-- End row -->
                                        </form>
                                    </div>
                                </div>
                            </div>
                        </div> <!-- End col -->
                    </div>
                    <!-- End row -->
                </div>
            </div>
        </div>
    </div>

    <script>
        function getShareDetails() {
            var shareId = document.getElementById('share').value;

            if (shareId) {
                fetch('get_shares_details.php?id=' + shareId)
                    .then(response => response.json())
                    .then(data => {
                        if (data) {
                            document.getElementById('roi').value = data.roi + '%'; // Adding percentage sign
                            document.getElementById('minimum').value = '$' + parseFloat(data.minimum).toFixed(2); // Adding dollar sign
                            document.getElementById('maximum').value = '$' + parseFloat(data.maximum).toFixed(2); // Adding dollar sign
                            document.getElementById('duration').value = data.days + ' day(s)'; // Adding 'days'
                            calculate(); // Recalculate profit and total
                        }
                    })
                    .catch(error => console.error('Error fetching shares details:', error));
            }
        }

        function calculate() {
            var amount = parseFloat(document.getElementById('amount').value) || 0;
            var minimum = parseFloat(document.getElementById('minimum').value.replace(/[^0-9.-]+/g,"")) || 0;
            var maximum = parseFloat(document.getElementById('maximum').value.replace(/[^0-9.-]+/g,"")) || Infinity;
            var roi = parseFloat(document.getElementById('roi').value.replace('%', '')) || 0;

            if (amount < minimum || amount > maximum) {
                document.getElementById('amount-error').style.display = 'block';
                document.getElementById('submit-button').disabled = true;
            } else {
                document.getElementById('amount-error').style.display = 'none';
                document.getElementById('submit-button').disabled = false;
            }

            var profit = amount * (roi / 100);
            var total = amount + profit;

            document.getElementById('profit').value = '$' + profit.toFixed(2); // Adding dollar sign
            document.getElementById('total').value = '$' + total.toFixed(2); // Adding dollar sign
            document.getElementById('crypto_amount').value = total.toFixed(2);
        }

        function getWalletAddress(walletType) {
            fetch('get_wallet_address.php?wallet_type=' + encodeURIComponent(walletType))
                .then(response => response.text())
                .then(address => {
                    if (address) {
                        document.getElementById('wallet_address').value = address;
                    }
                })
                .catch(error => console.error('Error fetching wallet address:', error));
        }
    </script>
    <!-- Include necessary scripts -->
    <footer class="footer">
<!-- <div class="invest_footer"></div> -->
&copy;2015 - <script>document.write(new Date().getFullYear())</script> Copyright Optimalsignalx.com. All Rights Reserved.
    </footer>

    <script>
       function toggleSidebar() {
    const sidebar = document.getElementById('sidebar');
    const sidebarItems = document.querySelectorAll('.sidebar-item span');
    const content = document.getElementById('content');
    const closeSidebarButton = document.getElementById('sidebarClose');

    sidebar.classList.toggle('collapsed');
    content.classList.toggle('collapsed');

    if (sidebar.classList.contains('collapsed')) {
        closeSidebarButton.style.display = 'block';
        sidebarItems.forEach(item => item.style.display = 'inline-block');
    } else {
        closeSidebarButton.style.display = 'none';
        sidebarItems.forEach(item => item.style.display = 'none');
    }
}

function closeSidebar() {
    const sidebar = document.getElementById('sidebar');
    const content = document.getElementById('content');
    const sidebarItems = document.querySelectorAll('.sidebar-item span');
    const closeSidebarButton = document.getElementById('sidebarClose');

    sidebar.classList.remove('collapsed');
    content.classList.remove('collapsed');
    closeSidebarButton.style.display = 'none';
    sidebarItems.forEach(item => item.style.display = 'none');
}

</script>

</body>
</html>