Enter the text for the post, then drag & drop a file [jpg, png, mp3, m4a, mp4, m4v or mov] on the dropzone to start the upload process and automatically post to app.net
please don't use this to upload files you don't own / didn't create
// BLIMSCAST DROPLOADER include_once('/home/sites/blims/htdocs/includes/Classes.php'); ini_set("session.cookie_domain",".".$cookiedomain); ini_set("session.cache_expire",100000); $app_name = 'BLIMSCAST'; // used for session $client_id = 'vCKGKWzEqtP8fMbHGxZmepzPv5qnySmC'; $client_secret = 'CcVcdXWz8KZnmfDNcgn5EwmXbV8d7rEF'; // MAIN BLI.MS //$client_id = '424RQtjWS96PQj2KzDzHStWdNazS4naL'; //$client_secret = 'VQ4KAubYeEEEEtKTCZdvfkjsxszzeRcq'; $blims_client_id = 'EJzjVeZCWKKqTSHAAVguXC6xN9aaUJHX'; $blims_app_key = '7ced0f5b0d0a0d72aa344ed79d123e22'; $redirect_uri = 'https://bli.ms/cast/'; $scopes = 'files,basic,follow,stream,write_post'; //$Session = new Session; session_start(); if(isset($_GET['logout'])){ session_destroy(); header('Location: '.$redirect_uri); exit; } $action = "new"; function showConnect(){ global $client_id, $scopes, $redirect_uri; // html head include_once('template/head.php'); echo '
'; //echo $data; //echo ''; return $data; } if(!isset($_SESSION[$app_name]['access_token'])){ if(isset($_GET['code'])){ $code = $_GET['code']; $details = Array(); $details['client_id'] = $client_id; $details['client_secret'] = $client_secret; $details['grant_type'] = 'authorization_code'; $details['redirect_uri'] = $redirect_uri; $details['code'] = $code; // get the access token $at = curly('https://account.app.net/oauth/access_token','','',$details); logIt('ACCESS TOKEN RESPONSE : '.$at); //echo $at; $adn = json_decode($at); //logIt('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'); //logIt(print_r($adn->token->user, true)); //logIt('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'); $user_json = json_encode($adn->token->user); $adn_access_token = $adn->access_token; $adn_username = $adn->username; $adn_user_id = $adn->user_id; //echo 'access_token:
'; //print_r($adn); //echo ''; //exit; /* curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Authorization: Bearer '.base64_encode($client_id.":".$client_secret), 'Identity-Delegate-Token: '.$delegate_token ) */ //$header = array('Authorization: Bearer '.$adn_access_token); //$details = Array(); //$details['grant_type'] = 'delegate'; //$details['delegate_client_id'] = $client_id; $app_object['client_id'] = $client_id; $app_json = json_encode($app_object); $del = json_decode(getDelegateToken($adn_access_token, $blims_client_id)); $_SESSION[$app_name]['access_token'] = $adn_access_token; $_SESSION[$app_name]['adn_username'] = $adn_username; $_SESSION[$app_name]['adn_user_id'] = $adn_user_id; $_SESSION[$app_name]['delegate_token'] = $del->delegate_token; // check user // get user_json //$uj = curly('https://api.app.net/users/'.$adn_user_id); //$user_json = json_decode($uj); //$app_json = json_decode($app_json); //$user_json = json_decode($adn->token->usern); //logIt($app_json); //logIt($user_json); //logIt('HMMMMM.... '); $ap = json_decode($app_json); //logIt($ap->client_id); $uj = json_decode($user_json); logIt($uj->id); // This will look up or create a new app_users user updateConnectingAppUser($ap, $uj); //logIt('AND THEN ??.... '); // update connecting user.... // store blims access_token to app_users. $sql = new $dbType("$host", "$user", "$pass", "$database"); $query = "UPDATE app_users SET blims_access_token = '".$adn_access_token."' WHERE app_user_id = ".$adn_user_id.";"; $sql->Query($query); $sql->Close(); //echo $adn_access_token.'
'; //print_r($del); //echo ''; logIt('bli.ms/cast logged in :'.$adn_username.' ['.$adn_access_token.']'); header('Location: '.$redirect_uri); exit; } else { showConnect(); //header('Location: /'); } } $in_reply_to = 0; if(isset($_GET['irt'])){ $in_reply_to = intval($_GET['irt']); } ?>