Exemple #1
0
<?php

require_once '../config.php';
require_once '../Db.php';
require_once '../Banking.php';
require_once '../functions.php';
require_once 'Banklink.php';
session_start();
if (isset($_POST) && empty($_SESSION["authenticated"]) || $_SESSION["authenticated"] != 'true') {
    if (array_key_exists('username', $_POST) && array_key_exists('password', $_POST)) {
        if (login_auth($_POST['username'], $_POST['password'])) {
            $user_details = get_user_details($_POST['username']);
            $_SESSION["authenticated"] = 'true';
            $_SESSION["username"] = $_POST['username'];
            unset($_POST['username']);
            unset($_POST['password']);
            $user_details = get_user_details($_SESSION["username"]);
            $_SESSION['owner_name'] = $user_details['owner_name'];
            $_SESSION['account_number'] = $user_details['account_number'];
            $_SESSION['available_funds'] = $user_details['amount'];
        } else {
            $_SESSION["failed"] = 'true';
            header('Location:login.php');
            exit;
        }
    }
}
if (!empty($_SESSION["authenticated"]) && $_SESSION["authenticated"]) {
    if (array_key_exists('confirm', $_POST)) {
        $transfer = Banking::tranfer($_SESSION['account_number'], $_SESSION['beneficiary_account'], $_SESSION['amount'], $_SESSION['description']);
        if ($transfer === 'Your payment is made') {
Exemple #2
0
<?php

include "template.php";
login_auth();
$state = $_POST['state'];
$gpio_number = $_POST['gpio_number'];
if ($state === '0') {
    ssh2_cmd('sh /var/www/script/gpiooff.sh ' . $gpio_number);
} else {
    ssh2_cmd('sh /var/www/script/gpioon.sh ' . $gpio_number);
}
function login_process()
{
    if (isset($_POST['login_submit'])) {
        login_auth($_POST['login_name'], $_POST['login_password']);
    }
    login_form();
}