<?php
// MLM - PHP Script
// Author: DeluxeScript
// Website: www.deluxescript.com
if(!defined('V1_INSTALLED')){
    header("HTTP/1.0 404 Not Found");
	exit;
}
if(!checkSession()) {
    $redirect = $settings['url']."login";
    header("Location: $redirect");
}
?>
<div class="container-fluid py-4">
        
    <div class="row">
        
        <?php
        $GetUserWallets = $db->query("SELECT * FROM users_wallets WHERE uid='$_SESSION[uid]' ORDER BY id");
        if($GetUserWallets->num_rows>0) {
            while($guw = $GetUserWallets->fetch_assoc()) { ?>
            
            <div class="col-xl-3 col-sm-6 mb-xl-0 mb-4" style="margin-top:4px;">
            <div class="card">
                <div class="card-body p-3">
                    <div class="row">
                        <div class="col-8">
                            <div class="numbers">
                                <p class="text-sm mb-0 text-capitalize font-weight-bold"><?=$guw['currency']?>  Balance</p>
                                <h5 class="font-weight-bolder mb-0">
                                    <?=get_wallet_balance($_SESSION['uid'],$guw['currency'])?>
                                    <span class="text-success text-sm font-weight-bolder"></span>
                                </h5>
                            </div>
                        </div>
                        <div class="col-4 text-end">
                            <img src="<?= $settings['url'] ?>assets/flag/<?=$guw['currency']?>.png" style="width:55%;">
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <?php
        
            }
        }
        ?>
    </div>
      <?php
        $GetUserRequests = $db->query("SELECT * FROM requests WHERE uid='$_SESSION[uid]' and status='1'");
        if($GetUserRequests->num_rows>0) {
      ?>
    <div class="row my-4">
        <div class="col">
          <div class="card">
            <div class="card-header pb-0">
              <div class="row">
                <div class="col">
                  <h6>Request Money</h6>
                </div>
              </div>
            </div>
            <div class="card-body px-0 pb-2">
                <div class="table-responsive">
                    <table class="table table-striped">
                        <tbody>
                        <?php while($gur = $GetUserRequests->fetch_assoc()) { ?>
                        <tr>
                                <td><?php if(idinfo($gur['fromu'],"account_type") == "1") { echo idinfo($gur['fromu'],"first_name")." ".idinfo($gur['fromu'],"last_name"); } else { echo idinfo($gur['fromu'],"business_name"); } ?> request <?php echo filter_var($gur['amount']." ".$gur['currency'], FILTER_SANITIZE_STRING); ?> from you.<br/>Description: <?php echo filter_var($gur['description'], FILTER_SANITIZE_STRING); ?></td>
                                <td>
                                    <a href="<?php echo filter_var($settings['url'], FILTER_SANITIZE_STRING); ?>account/money/request/pay/<?php echo filter_var($gur['id'], FILTER_SANITIZE_STRING); ?>" class="btn btn-success btn-sm"><i class="fa fa-check"></i> Pay</a> 
                                    <a href="<?php echo filter_var($settings['url'], FILTER_SANITIZE_STRING); ?>account/money/request/cancel/<?php echo filter_var($gur['id'], FILTER_SANITIZE_STRING); ?>" class="btn btn-danger btn-sm"><i class="fa fa-times"></i> Cancel</a>
                                </td>
                            </tr>
                        <?php } ?>
                        </tbody>
                    </table>
                </div>
            </div>
          </div>
        </div>
    </div>
                                            
                                        
                        <?php
                    }
                    ?>
      
      <div class="row my-4">
        <div class="col-lg-8 col-md-6 mb-md-0 mb-4">
          <div class="card">
            <div class="card-header pb-0">
              <div class="row">
                <div class="col-lg-6 col-7">
                  <h6>Recent Activity</h6>
                </div>
              </div>
            </div>
            <div class="card-body px-0 pb-2">
              <div class="table-responsive">
                <table class="table align-items-center mb-0">
                  <thead>
                    <tr>
                      <th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Date</th>
                      <th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Amount</th>
                      <th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Status</th>
                      <th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7 ps-2">Action</th>
                    </tr>
                  </thead>
                  <tbody>
                    
                    <?php
                        $GetUserActivity = $db->query("SELECT * FROM activity WHERE uid='$_SESSION[uid]' ORDER BY id DESC LIMIT 7");
                        if($GetUserActivity->num_rows>0) {
                            while($gua = $GetUserActivity->fetch_assoc()) {
                                $amount = $gua['amount'];
                                if($gua['type'] == "2" or $gua['type'] == "4" or $gua['type'] == "6" or $gua['type'] == "7" or $gua['type'] == "8" or $gua['type'] == "299" or $gua['type'] == "29") {
                                    $amount = '-'.$amount;
                                } else {
                                    $amount = '+'.$amount;
                                } ?>
                    
                    <tr>
                      <td>
                        <div class="d-flex px-2 py-1">
                          <div>
                            <small><?= ActivityDate($gua['created']) ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</small>
                          </div>
                          <div class="d-flex flex-column justify-content-center">
                            <h6 class="mb-0 text-sm"><?php echo filter_var(DecodeUserActivity($gua['id']), FILTER_SANITIZE_STRING) ?></h6>
                          </div>
                        </div>
                      </td>
                      <td class="align-middle text-center text-sm">
                        <span class="text-xs font-weight-bold"> <?php echo filter_var($amount.' '.$gua['currency'], FILTER_SANITIZE_STRING) ?> </span>
                      </td>
                      <td class="align-middle">
                        <center><span class="text-xs font-weight-bold"> <?php echo DecodeTXStatus($gua['status']) ?> </span></center>
                      </td>
                      <td>
                        <div class="avatar-group mt-2 text-xs">
                          <a href="<?php echo filter_var($settings['url'], FILTER_SANITIZE_STRING); ?>account/transaction/<?php echo filter_var($gua['txid'], FILTER_SANITIZE_STRING) ?>" class="btn btn-warning text-xs">View</a>
                        </div>
                      </td>
                    </tr>
                    <?php    }
                        } else { 
                            echo '<tr>
                                <td>'.$lang['info_8'].'</td>
                            </tr>';
                        }
                        ?>
                  </tbody>
                </table>
              </div>
            </div>
          </div>
        </div>
        <div class="col-md">
          <div class="card">
            <div class="card-header pb-0">
              <h6>How to get started?</h6>
            </div>
            <div class="card-body p-3">
              <div class="timeline timeline-one-side">
                <div class="timeline-block mb-3">
                  <span class="timeline-step">
                    <i class="ni ni-bell-55 text-success text-gradient"></i>
                  </span>
                  <div class="timeline-content">
                    <h6 class="text-dark text-sm font-weight-bold mb-0">Deposit Fund</h6>
                    <p class="text-secondary font-weight-bold text-xs mt-1 mb-0">Deposit some fund to activate a membership.</p>
                  </div>
                </div>
                <div class="timeline-block mb-3">
                  <span class="timeline-step">
                    <i class="ni ni-send text-danger text-gradient"></i>
                  </span>
                  <div class="timeline-content">
                    <h6 class="text-dark text-sm font-weight-bold mb-0">Buy Membership</h6>
                    <p class="text-secondary font-weight-bold text-xs mt-1 mb-0">Purchase membership and make referrals.</p>
                  </div>
                </div>
                <div class="timeline-block mb-3">
                  <span class="timeline-step">
                    <i class="ni ni-money-coins text-info text-gradient"></i>
                  </span>
                  <div class="timeline-content">
                    <h6 class="text-dark text-sm font-weight-bold mb-0">Enjoy Earning</h6>
                    <p class="text-secondary font-weight-bold text-xs mt-1 mb-0">Enjoy your happing and sweet earning with us.</p>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      
    </div> 

Javascript Online Compiler

Write, Run & Share Javascript code online using OneCompiler's JS online compiler for free. It's one of the robust, feature-rich online compilers for Javascript language. Getting started with the OneCompiler's Javascript editor is easy and fast. The editor shows sample boilerplate code when you choose language as Javascript and start coding.

About Javascript

Javascript(JS) is a object-oriented programming language which adhere to ECMA Script Standards. Javascript is required to design the behaviour of the web pages.

Key Features

  • Open-source
  • Just-in-time compiled language
  • Embedded along with HTML and makes web pages alive
  • Originally named as LiveScript.
  • Executable in both browser and server which has Javascript engines like V8(chrome), SpiderMonkey(Firefox) etc.

Syntax help

STDIN Example

var readline = require('readline');
var rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

rl.on('line', function(line){
    console.log("Hello, " + line);
});

variable declaration

KeywordDescriptionScope
varVar is used to declare variables(old way of declaring variables)Function or global scope
letlet is also used to declare variables(new way)Global or block Scope
constconst is used to declare const values. Once the value is assigned, it can not be modifiedGlobal or block Scope

Backtick Strings

Interpolation

let greetings = `Hello ${name}`

Multi line Strings

const msg = `
hello
world!
`

Arrays

An array is a collection of items or values.

Syntax:

let arrayName = [value1, value2,..etc];
// or
let arrayName = new Array("value1","value2",..etc);

Example:

let mobiles = ["iPhone", "Samsung", "Pixel"];

// accessing an array
console.log(mobiles[0]);

// changing an array element
mobiles[3] = "Nokia";

Arrow functions

Arrow Functions helps developers to write code in concise way, it’s introduced in ES6.
Arrow functions can be written in multiple ways. Below are couple of ways to use arrow function but it can be written in many other ways as well.

Syntax:

() => expression

Example:

const numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
const squaresOfEvenNumbers = numbers.filter(ele => ele % 2 == 0)
                                    .map(ele => ele ** 2);
console.log(squaresOfEvenNumbers);

De-structuring

Arrays

let [firstName, lastName] = ['Foo', 'Bar']

Objects

let {firstName, lastName} = {
  firstName: 'Foo',
  lastName: 'Bar'
}

rest(...) operator

 const {
    title,
    firstName,
    lastName,
    ...rest
  } = record;

Spread(...) operator

//Object spread
const post = {
  ...options,
  type: "new"
}
//array spread
const users = [
  ...adminUsers,
  ...normalUsers
]

Functions

function greetings({ name = 'Foo' } = {}) { //Defaulting name to Foo
  console.log(`Hello ${name}!`);
}
 
greet() // Hello Foo
greet({ name: 'Bar' }) // Hi Bar

Loops

1. If:

IF is used to execute a block of code based on a condition.

Syntax

if(condition){
    // code
}

2. If-Else:

Else part is used to execute the block of code when the condition fails.

Syntax

if(condition){
    // code
} else {
    // code
}

3. Switch:

Switch is used to replace nested If-Else statements.

Syntax

switch(condition){
    case 'value1' :
        //code
        [break;]
    case 'value2' :
        //code
        [break;]
    .......
    default :
        //code
        [break;]
}

4. For

For loop is used to iterate a set of statements based on a condition.

for(Initialization; Condition; Increment/decrement){  
//code  
} 

5. While

While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.

while (condition) {  
  // code 
}  

6. Do-While

Do-while is also used to iterate a set of statements based on a condition. It is mostly used when you need to execute the statements atleast once.

do {  
  // code 
} while (condition); 

Classes

ES6 introduced classes along with OOPS concepts in JS. Class is similar to a function which you can think like kind of template which will get called when ever you initialize class.

Syntax:

class className {
  constructor() { ... } //Mandatory Class method
  method1() { ... }
  method2() { ... }
  ...
}

Example:

class Mobile {
  constructor(model) {
    this.name = model;
  }
}

mbl = new Mobile("iPhone");