From 76a9c311ea2752bc7eb7892887a7f47c9a6d4b98 Mon Sep 17 00:00:00 2001 From: Declan Maher Date: Sun, 9 Feb 2014 20:05:25 +0000 Subject: [PATCH] save all changes for upload --- ajax.php | 32 ++ approvedImages.class.php | 70 +++ approvedImages.txt | 0 db.php | 14 + header.php | 99 +++++ home.php | 78 ++++ index.php | 24 ++ instagram.class.php | 608 +++++++++++++++++++++++++++ instagram.config.php | 9 + nbproject/private/private.properties | 2 + nbproject/private/private.xml | 13 + nbproject/project.properties | 7 + nbproject/project.xml | 9 + popular_media.php | 17 + saveApprovedImages.php | 30 ++ style.css | 181 ++++++++ success.php | 49 +++ viewImages.php | 23 + 18 files changed, 1265 insertions(+) create mode 100644 ajax.php create mode 100644 approvedImages.class.php create mode 100644 approvedImages.txt create mode 100644 db.php create mode 100644 header.php create mode 100755 home.php create mode 100755 index.php create mode 100755 instagram.class.php create mode 100755 instagram.config.php create mode 100644 nbproject/private/private.properties create mode 100644 nbproject/private/private.xml create mode 100644 nbproject/project.properties create mode 100644 nbproject/project.xml create mode 100755 popular_media.php create mode 100644 saveApprovedImages.php create mode 100644 style.css create mode 100755 success.php create mode 100644 viewImages.php diff --git a/ajax.php b/ajax.php new file mode 100644 index 0000000..0391d07 --- /dev/null +++ b/ajax.php @@ -0,0 +1,32 @@ +getApiKey(); + + $call = new stdClass; + $call->pagination->next_max_id = $maxID; + $call->pagination->next_url = "https://api.instagram.com/v1/tags/{$tag}/media/recent?client_id={$clientID}&max_tag_id={$maxID}"; + + // Receive new data + $media = $instagram->getTagMedia($tag,$auth=false,array('max_tag_id'=>$maxID)); + + // Collect everything for json output + $images = array(); + foreach ($media->data as $data) { + $images[] = $data->images->thumbnail->url; + } + + echo json_encode(array( + 'next_id' => $media->pagination->next_max_id, + 'images' => $images + )); +?> \ No newline at end of file diff --git a/approvedImages.class.php b/approvedImages.class.php new file mode 100644 index 0000000..474a775 --- /dev/null +++ b/approvedImages.class.php @@ -0,0 +1,70 @@ +getMessage(), " \n"; + } + + } + + } + + function insert_approved_images($savedImages) { + + if(!empty($savedImages)) { + $pieces = explode(",", $savedImages); + //var_dump($pieces); + } else { + echo 'No images to save.Please go back and save Images'; + } + + if(file_exists('approvedImages.txt')){ + + try{ + if(!empty($pieces)) { + //set file name to be written to + $file ="approvedImages.txt"; + // Open the file to get existing content + $fh = fopen($file, 'w') or die("can't open file"); + + foreach($pieces as $currentImage) { + $stringnl = $currentImage . PHP_EOL;// add new line + // Write the contents back to the file + fwrite($fh, $stringnl); + } + fclose($fh); + } + } + catch (Exception $e) { + echo 'Caught exception: ', $e->getMessage(), " \n"; + } + + } + } + +} + +?> \ No newline at end of file diff --git a/approvedImages.txt b/approvedImages.txt new file mode 100644 index 0000000..e69de29 diff --git a/db.php b/db.php new file mode 100644 index 0000000..e5f74cb --- /dev/null +++ b/db.php @@ -0,0 +1,14 @@ + diff --git a/header.php b/header.php new file mode 100644 index 0000000..9090c7a --- /dev/null +++ b/header.php @@ -0,0 +1,99 @@ + + + + Instagram Approval App + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/home.php b/home.php new file mode 100755 index 0000000..53ee23a --- /dev/null +++ b/home.php @@ -0,0 +1,78 @@ + +setAccessToken($data); +} +else +{ +header('Location: index.php'); +} + +//get header +require 'header.php'; + // Get the tag to search for - set in config file +$tag = $instagram->getTagtoSearchFor(); + + +?> +
+

Approve Photos '; ?>

+

+ Click on images below to select as an Approved Image. Click on the 'Load More...'button to view more images.
+ When you have selected all your approved images, click on 'Save Approved Images' button to save.
+ You can clear all the selected images by clicking the 'Reset' button. +

+ + +
+ + + + + +
+ +getTagMedia($tag); + + // Display first set of results (future sets displayed with ajax) + echo ''; + + // Show 'load more' button + echo '
'; +?> +
+ + \ No newline at end of file diff --git a/index.php b/index.php new file mode 100755 index 0000000..caf05d9 --- /dev/null +++ b/index.php @@ -0,0 +1,24 @@ + +
+ + + getLoginUrl(); + echo "Sign in with Instagram"; + ?> + + + + \ No newline at end of file diff --git a/instagram.class.php b/instagram.class.php new file mode 100755 index 0000000..8fb78df --- /dev/null +++ b/instagram.class.php @@ -0,0 +1,608 @@ +setApiKey($config['apiKey']); + $this->setApiSecret($config['apiSecret']); + $this->setApiCallback($config['apiCallback']); + $this->setTagtoSearchFor($config['tagtoSearchFor']); + + } else if (true === is_string($config)) { + // if you only want to access public data + $this->setApiKey($config); + } else { + throw new Exception("Error: __construct() - Configuration data is missing."); + } + } + + /** + * Generates the OAuth login URL + * + * @param array [optional] $scope Requesting additional permissions + * @return string Instagram OAuth login URL + */ + public function getLoginUrl($scope = array('basic')) { + if (is_array($scope) && count(array_intersect($scope, $this->_scopes)) === count($scope)) { + return self::API_OAUTH_URL . '?client_id=' . $this->getApiKey() . '&redirect_uri=' . $this->getApiCallback() . '&scope=' . implode('+', $scope) . '&response_type=code'; + } else { + throw new Exception("Error: getLoginUrl() - The parameter isn't an array or invalid scope permissions used."); + } + } + + /** + * Search for a user + * + * @param string $name Instagram username + * @param integer [optional] $limit Limit of returned results + * @return mixed + */ + public function searchUser($name, $limit = 0) { + return $this->_makeCall('users/search', false, array('q' => $name, 'count' => $limit)); + } + + /** + * Get user info + * + * @param integer [optional] $id Instagram user ID + * @return mixed + */ + public function getUser($id = 0) { + $auth = false; + if ($id === 0 && isset($this->_accesstoken)) { $id = 'self'; $auth = true; } + return $this->_makeCall('users/' . $id, $auth); + } + + /** + * Get user activity feed + * + * @param integer [optional] $limit Limit of returned results + * @return mixed + */ + public function getUserFeed($limit = 0) { + return $this->_makeCall('users/self/feed', true, array('count' => $limit)); + } + + /** + * Get user recent media + * + * @param integer [optional] $id Instagram user ID + * @param integer [optional] $limit Limit of returned results + * @return mixed + */ + public function getUserMedia($id = 'self', $limit = 0) { + return $this->_makeCall('users/' . $id . '/media/recent', ($id === 'self'), array('count' => $limit)); + } + + /** + * Get the liked photos of a user + * + * @param integer [optional] $limit Limit of returned results + * @return mixed + */ + public function getUserLikes($limit = 0) { + return $this->_makeCall('users/self/media/liked', true, array('count' => $limit)); + } + + /** + * Get the list of users this user follows + * + * @param integer [optional] $id Instagram user ID + * @param integer [optional] $limit Limit of returned results + * @return mixed + */ + public function getUserFollows($id = 'self', $limit = 0) { + return $this->_makeCall('users/' . $id . '/follows', true, array('count' => $limit)); + } + + /** + * Get the list of users this user is followed by + * + * @param integer [optional] $id Instagram user ID + * @param integer [optional] $limit Limit of returned results + * @return mixed + */ + public function getUserFollower($id = 'self', $limit = 0) { + return $this->_makeCall('users/' . $id . '/followed-by', true, array('count' => $limit)); + } + + /** + * Get information about a relationship to another user + * + * @param integer $id Instagram user ID + * @return mixed + */ + public function getUserRelationship($id) { + return $this->_makeCall('users/' . $id . '/relationship', true); + } + + /** + * Modify the relationship between the current user and the target user + * + * @param string $action Action command (follow/unfollow/block/unblock/approve/deny) + * @param integer $user Target user ID + * @return mixed + */ + public function modifyRelationship($action, $user) { + if (true === in_array($action, $this->_actions) && isset($user)) { + return $this->_makeCall('users/' . $user . '/relationship', true, array('action' => $action), 'POST'); + } + throw new Exception("Error: modifyRelationship() | This method requires an action command and the target user id."); + } + + /** + * Search media by its location + * + * @param float $lat Latitude of the center search coordinate + * @param float $lng Longitude of the center search coordinate + * @param integer [optional] $distance Distance in metres (default is 1km (distance=1000), max. is 5km) + * @param long [optional] $minTimestamp Media taken later than this timestamp (default: 5 days ago) + * @param long [optional] $maxTimestamp Media taken earlier than this timestamp (default: now) + * @return mixed + */ + public function searchMedia($lat, $lng, $distance = 1000, $minTimestamp = NULL, $maxTimestamp = NULL) { + return $this->_makeCall('media/search', false, array('lat' => $lat, 'lng' => $lng, 'distance' => $distance, 'min_timestamp' => $minTimestamp, 'max_timestamp' => $maxTimestamp)); + } + + /** + * Get media by its id + * + * @param integer $id Instagram media ID + * @return mixed + */ + public function getMedia($id) { + return $this->_makeCall('media/' . $id); + } + + /** + * Get the most popular media + * + * @return mixed + */ + public function getPopularMedia() { + return $this->_makeCall('media/popular'); + } + + /** + * Search for tags by name + * + * @param string $name Valid tag name + * @return mixed + */ + public function searchTags($name) { + return $this->_makeCall('tags/search', false, array('q' => $name)); + } + + /** + * Get info about a tag + * + * @param string $name Valid tag name + * @return mixed + */ + public function getTag($name) { + return $this->_makeCall('tags/' . $name); + } + + /** + * Get a recently tagged media + * + * @param string $name Valid tag name + * @param integer [optional] $limit Limit of returned results + * @return mixed + */ + + public function getTagMedia($name, $auth=false, $params=null) { + return $this->_makeCall('tags/' . $name . '/media/recent', $auth, $params); +} + + /** + * Get a list of users who have liked this media + * + * @param integer $id Instagram media ID + * @return mixed + */ + public function getMediaLikes($id) { + return $this->_makeCall('media/' . $id . '/likes', true); + } + + /** + * Get a list of comments for this media + * + * @param integer $id Instagram media ID + * @return mixed + */ + public function getMediaComments($id) { + return $this->_makeCall('media/' . $id . '/comments', false); + } + + /** + * Add a comment on a media + * + * @param integer $id Instagram media ID + * @param string $text Comment content + * @return mixed + */ + public function addMediaComment($id, $text) { + return $this->_makeCall('media/' . $id . '/comments', true, array('text' => $text), 'POST'); + } + + /** + * Remove user comment on a media + * + * @param integer $id Instagram media ID + * @param string $commentID User comment ID + * @return mixed + */ + public function deleteMediaComment($id, $commentID) { + return $this->_makeCall('media/' . $id . '/comments/' . $commentID, true, null, 'DELETE'); + } + + /** + * Set user like on a media + * + * @param integer $id Instagram media ID + * @return mixed + */ + public function likeMedia($id) { + return $this->_makeCall('media/' . $id . '/likes', true, null, 'POST'); + } + + /** + * Remove user like on a media + * + * @param integer $id Instagram media ID + * @return mixed + */ + public function deleteLikedMedia($id) { + return $this->_makeCall('media/' . $id . '/likes', true, null, 'DELETE'); + } + + /** + * Get information about a location + * + * @param integer $id Instagram location ID + * @return mixed + */ + public function getLocation($id) { + return $this->_makeCall('locations/' . $id, false); + } + + /** + * Get recent media from a given location + * + * @param integer $id Instagram location ID + * @return mixed + */ + public function getLocationMedia($id) { + return $this->_makeCall('locations/' . $id . '/media/recent', false); + } + + /** + * Get recent media from a given location + * + * @param float $lat Latitude of the center search coordinate + * @param float $lng Longitude of the center search coordinate + * @param integer [optional] $distance Distance in meter (max. distance: 5km = 5000) + * @return mixed + */ + public function searchLocation($lat, $lng, $distance = 1000) { + return $this->_makeCall('locations/search', false, array('lat' => $lat, 'lng' => $lng, 'distance' => $distance)); + } + + /** + * Pagination feature + * + * @param object $obj Instagram object returned by a method + * @param integer $limit Limit of returned results + * @return mixed + */ + public function pagination($obj, $limit = 0) { + if (true === is_object($obj) && !is_null($obj->pagination)) { + if (!isset($obj->pagination->next_url)) { + return; + } + $apiCall = explode('?', $obj->pagination->next_url); + if (count($apiCall) < 2) { + return; + } + $function = str_replace(self::API_URL, '', $apiCall[0]); + $auth = (strpos($apiCall[1], 'access_token') !== false); + if (isset($obj->pagination->next_max_id)) { + return $this->_makeCall($function, $auth, array('max_id' => $obj->pagination->next_max_id, 'count' => $limit)); + } else { + return $this->_makeCall($function, $auth, array('cursor' => $obj->pagination->next_cursor, 'count' => $limit)); + } + } else { + throw new Exception("Error: pagination() | This method doesn't support pagination."); + } + } + + /** + * Get the OAuth data of a user by the returned callback code + * + * @param string $code OAuth2 code variable (after a successful login) + * @param boolean [optional] $token If it's true, only the access token will be returned + * @return mixed + */ + public function getOAuthToken($code, $token = false) { + $apiData = array( + 'grant_type' => 'authorization_code', + 'client_id' => $this->getApiKey(), + 'client_secret' => $this->getApiSecret(), + 'redirect_uri' => $this->getApiCallback(), + 'code' => $code + ); + + $result = $this->_makeOAuthCall($apiData); + return (false === $token) ? $result : $result->access_token; + } + + /** + * The call operator + * + * @param string $function API resource path + * @param array [optional] $params Additional request parameters + * @param boolean [optional] $auth Whether the function requires an access token + * @param string [optional] $method Request type GET|POST + * @return mixed + */ + protected function _makeCall($function, $auth = false, $params = null, $method = 'GET') { + if (false === $auth) { + // if the call doesn't requires authentication + $authMethod = '?client_id=' . $this->getApiKey(); + } else { + // if the call needs an authenticated user + if (true === isset($this->_accesstoken)) { + $authMethod = '?access_token=' . $this->getAccessToken(); + } else { + throw new Exception("Error: _makeCall() | $function - This method requires an authenticated users access token."); + } + } + + if (isset($params) && is_array($params)) { + $paramString = '&' . http_build_query($params); + } else { + $paramString = null; + } + + $apiCall = self::API_URL . $function . $authMethod . (('GET' === $method) ? $paramString : null); + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $apiCall); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json')); + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + + if ('POST' === $method) { + curl_setopt($ch, CURLOPT_POST, count($params)); + curl_setopt($ch, CURLOPT_POSTFIELDS, ltrim($paramString, '&')); + } else if ('DELETE' === $method) { + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE'); + } + + $jsonData = curl_exec($ch); + if (false === $jsonData) { + throw new Exception("Error: _makeCall() - cURL error: " . curl_error($ch)); + } + curl_close($ch); + + return json_decode($jsonData); + } + + /** + * The OAuth call operator + * + * @param array $apiData The post API data + * @return mixed + */ + private function _makeOAuthCall($apiData) { + $apiHost = self::API_OAUTH_TOKEN_URL; + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $apiHost); + curl_setopt($ch, CURLOPT_POST, count($apiData)); + curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($apiData)); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json')); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + + $jsonData = curl_exec($ch); + if (false === $jsonData) { + throw new Exception("Error: _makeOAuthCall() - cURL error: " . curl_error($ch)); + } + curl_close($ch); + + return json_decode($jsonData); + } + + /** + * Access Token Setter + * + * @param object|string $data + * @return void + */ + public function setAccessToken($data) { + (true === is_object($data)) ? $token = $data->access_token : $token = $data; + $this->_accesstoken = $token; + } + + /** + * Access Token Getter + * + * @return string + */ + public function getAccessToken() { + return $this->_accesstoken; + } + + /** + * API-key Setter + * + * @param string $apiKey + * @return void + */ + public function setApiKey($apiKey) { + $this->_apikey = $apiKey; + } + + /** + * API Key Getter + * + * @return string + */ + public function getApiKey() { + return $this->_apikey; + } + + /** + * API Secret Setter + * + * @param string $apiSecret + * @return void + */ + public function setApiSecret($apiSecret) { + $this->_apisecret = $apiSecret; + } + + + + + /** + * API Secret Getter + * + * @return string + */ + public function getApiSecret() { + return $this->_apisecret; + } + + + /** + * Tag to Search For Setter + * + * @param string $apiKey + * @return void + */ + public function setTagtoSearchFor($tag) { + $this->_tagToSearchFor = $tag; + } + + /** + * Tag to Search For Getter + * + * @return string + */ + public function getTagtoSearchFor() { + return $this->_tagToSearchFor; + } + + + /** + * API Callback URL Setter + * + * @param string $apiCallback + * @return void + */ + public function setApiCallback($apiCallback) { + $this->_callbackurl = $apiCallback; + } + + /** + * API Callback URL Getter + * + * @return string + */ + public function getApiCallback() { + return $this->_callbackurl; + } + +} \ No newline at end of file diff --git a/instagram.config.php b/instagram.config.php new file mode 100755 index 0000000..579027f --- /dev/null +++ b/instagram.config.php @@ -0,0 +1,9 @@ + 'f289f0954ec047a99f564da06269c94e', +'apiSecret' => '88af7b71dd6341b5a6d4decd61c2fe2d', + 'tagtoSearchFor' => 'developer', +'apiCallback' => 'http://beechillpark.com/instagramScraper/success.php' // Callback URL +)); +?> \ No newline at end of file diff --git a/nbproject/private/private.properties b/nbproject/private/private.properties new file mode 100644 index 0000000..76b1562 --- /dev/null +++ b/nbproject/private/private.properties @@ -0,0 +1,2 @@ +index.file=index.php +url=http://localhost/instagramScraper/ diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml new file mode 100644 index 0000000..12864ff --- /dev/null +++ b/nbproject/private/private.xml @@ -0,0 +1,13 @@ + + + + + + file:/var/www/instagramScraper/index.php + file:/var/www/instagramScraper/header.php + file:/var/www/instagramScraper/style.css + file:/var/www/instagramScraper/home.php + file:/var/www/instagramScraper/popular_media.php + + + diff --git a/nbproject/project.properties b/nbproject/project.properties new file mode 100644 index 0000000..024c098 --- /dev/null +++ b/nbproject/project.properties @@ -0,0 +1,7 @@ +include.path=${php.global.include.path} +php.version=PHP_53 +source.encoding=UTF-8 +src.dir=. +tags.asp=false +tags.short=false +web.root=. diff --git a/nbproject/project.xml b/nbproject/project.xml new file mode 100644 index 0000000..b335af4 --- /dev/null +++ b/nbproject/project.xml @@ -0,0 +1,9 @@ + + + org.netbeans.modules.php.project + + + instagramScraper + + + diff --git a/popular_media.php b/popular_media.php new file mode 100755 index 0000000..2cec665 --- /dev/null +++ b/popular_media.php @@ -0,0 +1,17 @@ +getMedia(3047388) +$popular = $instagram->getPopularMedia(); + +// Display results +foreach ($popular->data as $data) { + echo "images->thumbnail->url}\">"; +} + +?> \ No newline at end of file diff --git a/saveApprovedImages.php b/saveApprovedImages.php new file mode 100644 index 0000000..7855471 --- /dev/null +++ b/saveApprovedImages.php @@ -0,0 +1,30 @@ + + +
+

+

Images Approved!

+insert_approved_images($_POST['savedImages']); + +} else +{ + echo 'No images to save.Please go back and save Images'; +} + +echo '

Images are now approved.

'; + +echo ' Click here to view the images you have approved.'; + +?> +

\ No newline at end of file diff --git a/style.css b/style.css new file mode 100644 index 0000000..e975555 --- /dev/null +++ b/style.css @@ -0,0 +1,181 @@ +/* +Contains styles for web app +*/ +/* + Created on : 07-Feb-2014, 15:06:55 + Author : declan maher +*/ + + body + { + + font: 100%/1.4 helvetica, arial, sans-serif; + color: #444; + background: #fff; + } + + h1, h2, h3, h4, h5, h6 + { + margin: 0 0 .6em; + line-height: 1.1; + } + + h2, h3 { color: #fff; } + h2 { font-size: 150%; } + h3 { font-size: 120%; color:#444 } + #content h3 { clear: left; } + + + .main{ + margin: 10px; + } + + mainlogin{ + margin: 200px; + text-align:center; + } + + /* ----------------------------------- + header + ----------------------------------- */ + #header-container + { + float: left; + width: 100%; + background: #075385 repeat-x 0 100%; + border-bottom: 1px solid #cae298; + } + + .home #header-container { border-bottom: 1px solid #609dbc; } + + #header + { + margin: 0 auto; + padding: 0px 50px 20px 10px; + } + + + /* ----------------------------------- + navigation + ----------------------------------- */ + #navigation + { + margin: 38px 0; + font-size: 93.75%; + line-height: 1; + } + + #navigation ul + { + margin: 0; + padding: 0; + } + + #navigation li + { + margin: 0; + padding: 0; + display: inline; + list-style-type: none; + } + + #navigation a + { + display: block; + float: left; + margin: 0 0 0 2px; + padding: 6px 10px; + color: #fff; + font-weight: bold; + text-decoration: none; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; + } + + .home #home-nav a + { + background: #6e9800; + } + + #navigation a:focus + { + color: #fff; + background: #000; + } + + #navigation a:hover + { + color: #003d5d; + background: #d5f1f9; + -webkit-transition-duration: 0.7s; + -webkit-transform: scale(1); + } + + img{ + border: 2px; + } + + + article, aside, figure, footer, header, hgroup, + menu, nav, section { + display: block; } + ul { + width: 100%; + } + ul > li { + float: left; + list-style: none; + padding: 4px; + } + + +.button { + -moz-box-shadow:inset 0px 1px 0px 0px #ffffff; + -webkit-box-shadow:inset 0px 1px 0px 0px #ffffff; + box-shadow:inset 0px 1px 0px 0px #ffffff; + background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #dfdfdf) ); + background:-moz-linear-gradient( center top, #ededed 5%, #dfdfdf 100% ); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#dfdfdf'); + background-color:#ededed; + -webkit-border-top-left-radius:6px; + -moz-border-radius-topleft:6px; + border-top-left-radius:6px; + -webkit-border-top-right-radius:6px; + -moz-border-radius-topright:6px; + border-top-right-radius:6px; + -webkit-border-bottom-right-radius:6px; + -moz-border-radius-bottomright:6px; + border-bottom-right-radius:6px; + -webkit-border-bottom-left-radius:6px; + -moz-border-radius-bottomleft:6px; + border-bottom-left-radius:6px; + text-indent:0; + border:1px solid #dcdcdc; + display:inline-block; + color:#777777; + font-family:arial; + font-size:14px; + font-weight:bold; + font-style:normal; + height:50px; + line-height:50px; + width:178px; + text-decoration:none; + text-align:center; + text-shadow:1px 1px 0px #ffffff; +} +.button:hover { + background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #dfdfdf), color-stop(1, #ededed) ); + background:-moz-linear-gradient( center top, #dfdfdf 5%, #ededed 100% ); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#dfdfdf', endColorstr='#ededed'); + background-color:#dfdfdf; +}.button:active { + position:relative; + top:1px; +} + +#help{ + margin-left: 20px; + padding: 5px 10px 5px 10px; +} \ No newline at end of file diff --git a/success.php b/success.php new file mode 100755 index 0000000..44448af --- /dev/null +++ b/success.php @@ -0,0 +1,49 @@ +getOAuthToken($code); + // Take a look at the API response + +if(empty($data->user->username)) +{ +header('Location: index.php'); +} +else +{ + session_start(); + $_SESSION['userdetails']=$data; + $user=$data->user->username; + $fullname=$data->user->full_name; + $bio=$data->user->bio; + $website=$data->user->website; + $id=$data->user->id; + $token=$data->access_token; + +$id=mysql_query("select instagram_id from instagram_users where instagram_id='$id'"); + +if(mysql_num_rows($id) == 0) +{ +mysql_query("insert into instagram_users(username,Name,Bio,Website,instagram_id,instagram_access_token) values('$user','$fullname','$bio','$website','$id','$token')"); +} + +header('Location: home.php'); +} +} +else +{ +// Check whether an error occurred +if (true === isset($_GET['error'])) +{ + echo 'An error occurred: '.$_GET['error_description']; +} +} +?> diff --git a/viewImages.php b/viewImages.php new file mode 100644 index 0000000..b63c6f9 --- /dev/null +++ b/viewImages.php @@ -0,0 +1,23 @@ + +

Approved Images

+
+ +get_approved_images(); + +foreach ($lines as $line_num => $line) { + echo ''; +} + +?> + + \ No newline at end of file