Exemplo n.º 1
0
// User info
$params = array("badges" => 1, "mayor" => 1);
$foursquareUser = $foursquareObj->get_user($params);
$user_info = $foursquareUser->response['user'];
$_SESSION['currentUserID'] = $user_info['id'];
$_SESSION['4sq_user'] = $user_info;
$_SESSION['4sq_obj'] = $foursquareObj;
try {
    // alert if homebase isn't set -> should do this during registration -> after registration, but before page access -> shouldn't be able to get to this page without homebase being set
    // what if homebase isn't a foursquare location?
    /* -> can guide user through creation of venue (cumbersome)
    * -> can set foursquare vid to 0 or -1 and set geolocation (geolong, geolat) via google maps
    */
    //ideally, these items should be stored in the Footprint db to save on 4sq API calls
    //hardcoded homebase
    $homebase = $foursquareObj->get_venue(array("vid" => $homebase_vid));
    // $homebaseVID = 4500522; this should now be instantiated in config.php
    $homebaseGeoLat = $homebase->venue->geolat;
    $homebaseGeoLong = $homebase->venue->geolong;
    $homebaseURL = $homebase->venue->short_url;
    $_SESSION["homebase"] = array("geolat" => $homebaseGeoLat, "geolong" => $homebaseGeoLong);
    ?>

<?php 
    //see if there are any records in the db
    //order by timestamp desc
    //if there are, get the most recent record's timestamp and set it as sinceid as option in history query
    $destinationsQuery = mysql_query("select foursquarecheckinid from destinations where userid=" . $_SESSION['currentUserID'] . " order by foursquarecheckinid desc");
    if (mysql_num_rows($destinationsQuery) == 0) {
        $sinceID = "";
    } else {