// Update addresses in session from database
            $user_address =& cw_session_register('user_address', array());
            $user_address['current_address'] = cw_user_get_address($customer_id, 'current');
            $user_address['main_address'] = cw_user_get_address($customer_id, 'main');
            db_query("update {$tables['customers_system_info']} set last_login='******' where customer_id='{$customer_id}'");
            $current_language = $user_data['language'];
            $items_per_page_targets = cw_core_restore_navigation($customer_id);
            cw_include('init/lng.php');
            $cart =& cw_session_register('cart', array());
            if ($current_area == "C" && cw_is_cart_empty($cart)) {
                $cart = cw_user_get_stored_cart($customer_id);
            }
            $userinfo = cw_user_get_info($customer_id);
            $products = cw_call('cw_products_in_cart', array($cart, $userinfo));
            $cart = cw_func_call('cw_cart_calc', array('cart' => $cart, 'products' => $products, 'userinfo' => $userinfo));
            cw_event('on_login', array($customer_id, $current_area, 0));
            if (!empty($instagram_login_info['return_url'])) {
                cw_header_location($instagram_login_info['return_url']);
            } else {
                cw_header_location($instagram_redirect_url);
            }
        }
    } else {
        //For Guest user, get instagram login url
        $instagram_login_authUrl = $instagram->getLoginUrl();
        $smarty->assign('instagram_login_authUrl', $instagram_login_authUrl);
        if (!$is_ajax) {
            $instagram_login_info['return_url'] = $current_host_location . $_SERVER['REQUEST_URI'];
        }
    }
}
Ejemplo n.º 2
0
Archivo: index.php Proyecto: nuiz/api2
<?php

require "../bootstrap.php";
$instagram = new MetzWeb\Instagram\Instagram(array('apiKey' => '2edda6ebe18d4422b609c93bda5744f9', 'apiSecret' => '5c23e7f88dcf4c45827fb59692665e02', 'apiCallback' => 'http://api1.papangping.com/instragram'));
if (empty($_SESSION['instragram']) && empty($_GET['code'])) {
    header("Location: " . $instagram->getLoginUrl());
    exit;
}
if (!empty($_GET['code'])) {
    $code = $_GET['code'];
    $data = $instagram->getOAuthToken($code);
    $_SESSION['instragram'] = $data;
    header("Location: index.php");
    exit;
}
?>
<html>
<head>
	<meta charset="utf-8">
	<script type="text/javascript" src="public/jquery/jquery-1.11.3.min.js"></script>
</head>
<body>
<div>
<img src="<?php 
echo $_SESSION['instragram']->user->profile_picture;
?>
"> <strong><?php 
echo $_SESSION['instragram']->user->username;
?>
</strong>
<div>