php Copyright 2009 by Nicolae Vartolomei nvartolomei gmail com author

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
/**
* Copyright (c) 2009 by Nicolae Vartolomei <nvartolomei@gmail.com>
*
* @author Nicolae Vartolomei <nvartolomei@gmail.com>
*/
if (isset($_GET['uId'])) {
$uId = $_GET['uId'];
} else {
header("location: /defaults/403.html");
}
define("ROOT", dirname(__FILE__));
define("API_KEY", "922342b504546a2cd1ad41d6aec48e5e");
define("API_SECRET", "7a5de10901bf6e94");
require_once ROOT . "/lib/phpFlickr.php";
$flickr = new phpFlickr(API_KEY);
$Id = $flickr->people_findByUsername($uId);
$photos = $flickr->people_getPublicPhotos($Id['id']);
$totalViews = 0;
foreach($photos['photos']['photo'] as $photo) {
$info = $flickr->photos_getInfo($photo['id']);
$totalViews += $info['views'];
}
echo "The user <b>$uId</b> has $totalViews views.";