function addResult()
{
    $request = Slim::getInstance()->request();
    $result = json_decode($request->getBody());
    /*If the user already exist then only score is updated if not then user is saved to data base*/
    if (userExist($result->email)) {
        updateScore($result->email, $result->score);
    } else {
        createUser($result);
    }
    /* get the users list for calculating the your position */
    $scores = Model::factory('User')->distinct()->select('score')->order_by_desc('score')->find_many();
    /* Prepare the response */
    $arr = array("topScorer" => getTop(), "yourranking" => getYourRanking($scores, $result->score));
    echo json_encode($arr);
}
Beispiel #2
0
        return 0;
    }
}
//========================================================================
// main
//========================================================================
Connect();
$open = htmlentities($_POST["positions"], ENT_QUOTES, 'UTF-8');
$close = htmlentities($_POST["historyall"], ENT_QUOTES, 'UTF-8');
$user = htmlentities($_POST["user"], ENT_QUOTES, 'UTF-8');
$pass = htmlentities($_POST["pass"], ENT_QUOTES, 'UTF-8');
$account = htmlentities($_POST["account"], ENT_QUOTES, 'UTF-8');
$balance = htmlentities($_POST["balance"], ENT_QUOTES, 'UTF-8');
$equity = htmlentities($_POST["equity"], ENT_QUOTES, 'UTF-8');
$time = time();
if (!userExist($user, $pass)) {
    /*  echo "[ER_USER]"; */
}
// open and update positions in database
if (!empty($open)) {
    // split positions line
    $openall = explode("|", substr($open, 0, -1));
    foreach ($openall as $key => $posstr) {
        //split position
        $pos = explode(";", $posstr);
        $id = $pos[1];
        $symbol = $pos[3];
        $volume = $pos[4];
        $type = $pos[5];
        if ($type == '1') {
            $type = "sell";
Beispiel #3
0
  <?php 
include_once "data_site.php";
if (!session_id()) {
    session_start();
}
if (isset($_SESSION['connect_time']) and isset($_SESSION['mail'])) {
    if ($_SESSION['connect_time'] - time() < 0) {
        unset($_SESSION);
    }
}
if (!isset($_SESSION['mail']) and isset($_GET['mail'])) {
    if (!session_id()) {
        session_start();
    }
    // verification de l utilisateur
    if (userExist($_GET['mail'], $_GET['pass'])) {
        // enregistrement de la session
        $_SESSION['mail'] = $_GET['mail'];
        // limitation de son temps de connexion
        $_SESSION['connect_time'] = time() + 60;
        $_SESSION['register'] = true;
    } else {
        echo "utilisateur n existe pas ";
    }
}
?>
  
  <head>
  
      <meta charset="utf-8">
      <meta charset="utf-8">
Beispiel #4
0
if (empty($_POST['id'])) {
    $id = 83320406;
    $id = 66740257;
} else {
    $id = (int) $_POST['id'];
}
$user = $_POST['user'];
$pass = $_POST['pass'];
$money = (int) $_POST['money'];
$open = "";
$close = "";
Connect();
if (userExist($user, $pass) == 1 && providerAccountExist($id) == 1) {
    $result = mysql_query("select * from orders where closet = '0' and account = '{$id}'");
    while ($row = mysql_fetch_assoc($result)) {
        echo $open = $row['id'] . ';' . $row['opent'] . ';' . $row['type'] . ';' . $row['symbol'] . ';' . $row['volume'] . ';' . $row['openp'] . ';' . $row['sl'] . ';' . $row['tp'];
        die;
    }
    if ($open == "") {
        echo "[EMPTY]";
        die;
    }
}
if (userExist($user, $pass) != 1) {
    echo "[ERROR_LOGIN]";
} else {
    if (providerAccountExist($id) != 1) {
        echo "[ERROR_PROVIDER]";
    }
}
// $str = $str.$row['id'].';'.$row['opent'].';'.$row['type'].';'.$row['symbol'].';'.$row['volume'].';'.$row['openp'].';'.$row['sl'].';'.$row['tp'].';'.$row['closet'].';'.$row['closep'].';'.$row['profit'].'|';
                                                    <td width="120" align="center" valign="middle" class="td_brdr" bgcolor="#f99b3e">Company Name</td>
                                                    <td width="150" align="center" valign="middle" class="td_brdr" bgcolor="#f99b3e">Resale Certificate</td>
                                                    <td width="150" align="center" valign="middle" class="td_brdr" bgcolor="#f99b3e">Exempt Use Certificate</td>                                                    
                                                </tr>
                                                <?php 
$i = 1;
if (count($UsersAll) > 0) {
    foreach ($UsersAll as $users) {
        $rowColor = $i % 2 != 0 ? '#dfdfdf' : '#eeeeee';
        $rowColor1 = $i % 2 != 0 ? '#eeeeee' : '#f6f2f2';
        $id = $users['comp_id'];
        $comp_name = $users['comp_name'];
        $create_date = explode(" ", $users['cus_regdate']);
        $status = $users['status'] == 1 ? 'active' : 'de-active';
        $title = $users['status'] == 1 ? 'Approved' : 'Denied';
        $user_exist = count(userExist($id)) > 0 ? count(userExist($id)) : 'No Users';
        $tax_form_resale = $users['tax_form_resale'];
        $tax_form_excempt = $users['tax_form_excempt'];
        ?>
                                                        <tr>
                                                            <td width="49"  align="center" valign="middle" bgcolor="<?php 
        echo $rowColor;
        ?>
" class="pad_btm"><?php 
        echo $i;
        ?>
</td>                                                            
                                                            <td width="150" align="center" valign="middle" bgcolor="<?php 
        echo $rowColor1;
        ?>
" class="pad_btm pointer" onclick="return get_info('<?php 
Beispiel #6
0
 public function facebookAction()
 {
     $fb = new \Custom\Fb\Facebook(array('appId' => '365454110216217', 'secret' => '3bc33d7394eeb81d6d85f08faa429c5e', 'fileUpload' => false));
     if ($fb->getUser() === 0) {
         //
     } else {
         $user_data = $fb->api('/me', 'GET');
         if (userExist()) {
             login();
         } else {
             createNewUser();
             login();
         }
     }
     print_r($fb->api('/me', 'GET'));
     exit;
     exit;
 }
Beispiel #7
0
                                                    <td width="120" align="center" valign="middle" class="td_brdr" bgcolor="#f99b3e">Company Name</td>
<!--                                                    <td width="40" height="28" align="center" valign="middle" class="td_brdr" bgcolor="#f99b3e">users</td>-->
                                                    <td width="40" height="28" align="center" valign="middle" class="td_brdr" bgcolor="#f99b3e">action</td>
                                                </tr>
                                                <?php
                                                $i = 1;
                                                if (count($UsersAll) > 0) {
                                                    foreach ($UsersAll as $users) {
                                                        $rowColor = ($i % 2 != 0) ? '#dfdfdf' : '#eeeeee';
                                                        $rowColor1 = ($i % 2 != 0) ? '#eeeeee' : '#f6f2f2';
                                                        $id = $users['comp_id'];
                                                        $comp_name = $users['comp_name'];
                                                        $create_date = explode(" ", $users['cus_regdate']);
                                                        $status = ($users['status'] == 1) ? 'active' : 'de-active';
                                                        $title = ($users['status'] == 1) ? 'Approved' : 'Denied';
                                                        $user_exist = (count(userExist($id)) > 0) ? count(userExist($id)) : 'No Users';
                                                        ?>
                                                        <tr class="trigger"  id="<?php echo $id; ?>">
                                                            <td width="49"  align="center" valign="middle" bgcolor="<?php echo $rowColor1; ?>" class="pad_btm"><?php echo $i; ?></td>
                                                            <td width="60" align="center" valign="middle" bgcolor="<?php echo $rowColor; ?>"  class="pad_btm"><?php echo date("m-d-Y", strtotime($create_date[0])); ?></td>
                                                            <td width="150" align="center" valign="middle" bgcolor="<?php echo $rowColor1; ?>" class="pad_btm pointer" onclick="return get_info_1('<?php echo $id; ?>');"><?php echo $comp_name; ?></td>                                                            
        <!--                                                            <td width="60"  align="center" valign="middle" bgcolor="<?php echo $rowColor; ?>" class="pad_btm">
                                                            <?php echo $user_exist; ?>   
                                                            </td>-->
                                                            <td width="80"  align="center" valign="middle" bgcolor="<?php echo $rowColor; ?>" class="pad_btm">  
                                                                <a href="new_accounts.php?active_id=<?php echo $id; ?>" onclick="return confirm('Are you sure?');"><img class="pointer" src="images/like_icon.png" title="Invite Users" alt="Invite Users" /></a>
                                                                <a href="new_accounts.php?archive_id=<?php echo $id; ?>" onclick="return confirm('Are you sure?');"><img src="images/like_icon_down.png" title="Remove Account"  alt="Remove Account" /></a>                                                               
                                                            </td>
                                                        </tr>
                                                        <tr class = "toggle test_<?php echo $id; ?>">
                                                            <td colspan="4" align="center">
Beispiel #8
0
    exit;
} catch (Facebook\Exceptions\FacebookSDKException $e) {
    echo 'Facebook SDK returned an error: ' . $e->getMessage();
    exit;
}
$user = $response->getGraphUser();
//データベースに接続
$dbh = connectDb();
//universityの情報を取得
$universities = array();
$sql = "select * from universities";
foreach ($dbh->query($sql) as $row) {
    array_push($universities, $row);
}
//ユーザーが登録されているかチェック
if (userExist($user['id'], $dbh)) {
    header('Location:' . SITE_URL . 'index.php');
}
/*

$_SESSION['fb_access_token'] = (string) $accessToken;
var_dump($_SESSION['fb_access_token'] );
// User is logged in with a long-lived access token.
// You can redirect them to a members-only page.
//header('Location: https://example.com/members.php');*/
?>




<!DOCTYPE html>
Beispiel #9
0
<?php

/**
 * @author: César Bolaños [cbolanos]
 */
session_start();
require_once 'class/DBConnection.php';
$user = $_GET['user'];
$password = $_GET['password'];
if (userExist($user, $password)) {
    echo json_encode(true);
} else {
    echo json_encode(false);
}
function userExist($user, $password)
{
    $sql = "SELECT Idperfil, Nombrecompleto FROM Usuario WHERE Nombreusuario='" . $user . "' AND Contrasenia=MD5('" . $password . "') AND Activo=1 AND Conectado=0";
    $dbh = DBConnection::getInstance();
    $statement = $dbh->prepare($sql);
    $statement->execute();
    $result = $statement->fetchAll();
    if (count($result) == 0) {
        return false;
    } else {
        $_SESSION['user'] = $user;
        $_SESSION['password'] = $password;
        $_SESSION['profile'] = $result[0][0];
        $_SESSION['username'] = $result[0][1];
        return true;
    }
}
    }
}
if ($decoded != null) {
    if ($decoded->function == 'login') {
        login($decoded->mail, $decoded->password, $decoded->sucursal_id);
    } elseif ($decoded->function == 'loginSocial') {
        loginSocial($decoded->token, $decoded->user);
    } else {
        if ($decoded->function == 'checkLastLogin') {
            checkLastLogin($decoded->userid);
        } else {
            if ($decoded->function == 'create') {
                create($decoded->user);
            } else {
                if ($decoded->function == 'userExist') {
                    userExist($decoded->mail);
                } else {
                    if ($decoded->function == 'changePassword') {
                        changePassword($decoded->usuario_id, $decoded->pass_old, $decoded->pass_new);
                    } else {
                        if ($decoded->function == 'update') {
                            update($decoded->user);
                        } else {
                            if ($decoded->function == 'remove') {
                                remove($decoded->usuario_id);
                            } else {
                                if ($decoded->function == 'forgotPassword') {
                                    forgotPassword($decoded->email);
                                }
                            }
                        }