function getEmailAccounts()
{
    try {
        $stmt = getAccounts();
        $emails = array();
        while ($result = $stmt->fetch(PDO::FETCH_OBJ)) {
            $emails[] = $result->email;
        }
        return $emails;
    } catch (PDOException $e) {
        header('Location: ../vues/vue_interface_admin.php?error=db');
        exit;
    }
}
Пример #2
0
<?php
include('config.php');
include('functions.php');
include('classes/client.class.php');
include('classes/security.class.php');
include('classes/securitycollection.class.php');
include('classes/isin.class.php');
include('classes/isincollection.class.php');
include('classes/transactioncollection.class.php');
//check, if client is already logged in.
login();
if(!logged())
{
  include('login_header.php');
}
//process data	
  $transaction = new TransactionCollection();
  $collection = new SecurityCollection();
  $isinCollection = new IsinCollection;
  $client = new Client;
  $isins = $isinCollection->getIsins();
  $accounts = getAccounts();

  include($templates.'menu.html');
  echo strtoupper('THANK YOU!<br/><br/>YOUR ORDER HAS BEEN SUCCESSFULLY PROCESSED!');  
  include($templates.'welcome.html');
  include($templates.'footer.html');

?>
Пример #3
0
function getUserData()
{
    $uid = intval($_POST['uid']);
    if ($uid == 0) {
        die("error");
    }
    if ($uid === intval($_SESSION['uid'])) {
        die(json_encode(getAccounts($uid)[0]));
    }
    $result = getAccounts($uid)[0];
    if (isset($_SESSION['admin'])) {
        if (intval($result['user_id']) == intval($_SESSION['uid'])) {
            die(json_encode($result));
        }
        if (intval($result['status']) > 1) {
            die(json_encode("error"));
        }
    }
    die(json_encode($result));
}
Пример #4
0
<?php

include 'connection.php';
//handle connection to mysql DB
//call the requested function
if ($_POST['method'] == "getAccounts") {
    getAccounts();
    //call getAccounts method
} elseif ($_POST['method'] == "addAccount") {
    addAccount($_POST['json']);
}
//get all accounts
function getAccounts()
{
    global $mysqli;
    $strQuery = "SELECT * FROM accounts";
    $accounts = getAccountsByQuery($strQuery);
    //return accounts as a json Object
    echo json_encode(array('Accounts' => $accounts));
}
//get accounts from db filterd by parameter strQuery
function getAccountsByQuery($strQuery)
{
    global $mysqli;
    // get array of accounts
    $result = $mysqli->query($strQuery);
    $accounts = array();
    if ($result->num_rows > 0) {
        while ($row = $result->fetch_assoc()) {
            $accounts[] = $row;
        }
Пример #5
0
function addUser($username, $origin, $status, $password = null, $email = null, $fullname = null)
{
    global $mysql;
    $username = mysql_html($username);
    $origin = mysql_html($origin);
    $status = mysql_html($status);
    $email = mysql_html($email);
    $fullname = mysql_html($fullname);
    if ($fullname == null) {
        $fullname = $username;
    }
    if ($password !== null) {
        $password = password_hash($password, PASSWORD_DEFAULT);
    }
    $q1 = "INSERT INTO 1fx_users (username, origin, status, password, email, fullname) VALUES ('{$username}', '{$origin}', '{$status}', '{$password}', '{$email}', '{$fullname}')";
    $q2 = "SELECT user_id FROM 1fx_users WHERE username='******'";
    $res = mysqli_query($mysql, $q1);
    if (!$res) {
        die(mysqli_error($mysql));
    }
    $id = intval(mysqli_fetch_array(mysqli_query($mysql, $q2))['user_id']);
    $q3 = "INSERT INTO 1fx_preferences (user_id) VALUES ({$id})";
    mysqli_query($mysql, $q3);
    $userdata = getAccounts($id)[0];
    $emailBody = "Hello " . $userdata['fullname'] . ",<br><br>Your account has been registered to the serverpanel named <a href='" . getProtocol() . "://" . $_SERVER['SERVER_NAME'] . "'>" . substr($_SESSION['panel'], 0, -3) . "</a><br>Your account - {$username}<br>";
    if (intval($origin) == 1) {
        $emailBody .= "The account comes from IPS4 system, so you can log in with your forum password<br>";
    }
    $emailBody .= "<br>Best Regards!";
    echo sendEmail($fullname, $userdata['email'], "You have been registered to " . substr($_SESSION['panel'], 0, -3), $emailBody);
    if ($status === "3") {
        $giveServerPermissions = "INSERT INTO 1fx_servers_user_map (server_id, user_id, can_see_rcon, can_update_mod, can_access_banlist, can_see_ftp, can_access_config, can_access_mapcycle_ents, can_stop_server) SELECT server_id, {$id} AS user_id, 1 AS can_see_rcon, 1 AS can_update_mod, 1 AS can_access_banlist, 1 AS can_see_ftp, 1 AS can_access_config, 1 AS can_access_mapcycle_ents, 1 AS can_stop_servers FROM 1fx_servers";
        mysqli_query($mysql, $giveServerPermissions);
    }
}
Пример #6
0
    if (!isset($_SESSION['project_href'])) {
        getProjects($_SESSION['account_href'], $_SESSION['token']);
    }
    getTodos($_SESSION['project'], $_SESSION['token']);
} else {
    switch ($_GET['action']) {
        case 'redirect':
            if (!isset($_GET['code'])) {
                throw new InvalidArgumentException("verification code missing");
            }
            $verification_code = $_GET['code'];
            $tokens = $oauth->exchangeVerificationCode($verification_code);
            $_SESSION['token'] = $tokens['access_token'];
            setcookie('token', $tokens['access_token']);
            file_put_contents('tokens', serialize($tokens) . "\n-----------------------\n", FILE_APPEND);
            getAccounts($tokens['access_token']);
            break;
        case 'choose_user':
            $_SESSION['account_href'] = $_POST['url_base'];
            setcookie('account_href', $_POST['url_base']);
            header('Location: index.php');
            break;
        case 'choose_project':
            $_SESSION['project_href'] = $_POST['project_url'];
            setcookie('project_href', $_POST['project_url']);
            $_SESSION['project'] = $_POST['project'];
            setcookie('project', $_POST['project']);
            header('Location: index.php');
            break;
        case 'logout':
            setcookie('project', null);
Пример #7
0
// WEBSERVICES DE LA TABLA ACCOUNTS
//--------------------------------------------------------------------------------------------------
$app->get('/getAccounts', function () {
    //Importa el archivo que contiene el método
    require_once 'Servicios/getAccounts.php';
    $app = new \Slim\Slim();
    require_once 'Servicios/Auth.php';
    $deviceId = $app->request->headers->get('deviceID');
    $hash = $app->request->headers->get('hash');
    $respuesta = auth($deviceId, $hash);
    if ($respuesta != "Auth_OK") {
        echo $respuesta;
        return;
    }
    //LLama el método que lee de la base de datos y obtiene la respuesta
    $respuesta = getAccounts();
    //Muestra la respuesta al cliente
    echo $respuesta;
});
//--------------------------------------------------------------------------------------------------
$app->get('/getAccount', function () {
    //Importa el archivo que contiene el método
    require_once 'Servicios/getAccount.php';
    $app = new \Slim\Slim();
    require_once 'Servicios/Auth.php';
    $deviceId = $app->request->headers->get('deviceID');
    $hash = $app->request->headers->get('hash');
    $respuesta = auth($deviceId, $hash);
    if ($respuesta != "Auth_OK") {
        echo $respuesta;
        return;
Пример #8
0
                                    All accounts
                                </div>
                                <div class="panel-body">
                                    <div class="table-responsive table-bordered">
                                        <table class="table">
                                            <thead>
                                            <th>Username</th>
                                            <th>Origin</th>
                                            <th>E-mail</th>
                                            <th>Full name</th>
                                            <th>Status</th>
                                            <th>Options</th>
                                            </thead>
                                            <tbody>
                                                <?php 
$allAccounts = getAccounts(null, $_SESSION['uid']);
$dataGot = false;
foreach ($allAccounts as $myAccount) {
    $dataGot = true;
    ?>
<tr id="row<?php 
    echo $myAccount['id'];
    ?>
">
                                                    <td><?php 
    echo $myAccount['username'];
    ?>
</td>
                                                    <td><?php 
    if ($myAccount['origin'] === "1") {
        echo "IPS Account";