rendered paste body<?php$xusername = $_GET["xusername"];?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Xfire Friend List Cleaner</title> <style type="text/css"> body, table, th { font-size: 10pt; font-family: Tahoma, Arial, sans-serif; } .xfform { border: 1px dashed #AA0000; background-color: #EEEEBC; padding: 25px; } .xtotal { padding: 15px; font-size: 18pt; font-weight: bold; color: #00AA00; } table.xfire_lastseen { border: 1px dashed #AA0000; } table.xfire_lastseen td { font-size: 8pt; } table.xfire_lastseen th.xfnick { width: 325px; } table.xfire_lastseen th.xfstatus { width: 75px; } table.xfire_lastseen th.xfseen { width: 125px; } table.xfire_lastseen th { background-color: #EEEEBC; } table.xfire_lastseen td { background-color: #FEFEFE; padding: 3px; } </style> <script src="js/sorttable.js" type="text/javascript"></script> </head> <body> <h1>Last Seen - Friend List Cleaner</h1> <?php if( empty( $xusername ) ) { ?> <div class="xfform"> <form action="friends_cleanup.php" method="get"> Enter your username: <input type="text" name="xusername" /><br /> <input type="submit" value="Cleanup!" /> </form> </div> <?php } else { ?> <p><?php if( $_GET["filteronline" ] != 1 ) { ?><a href="friends_cleanup.php?xusername=<?php echo $xusername; ?>&filteronline=1">Filter Out Online Users</a><?php } else { ?><a href="friends_cleanup.php?xusername=<?php echo $xusername; ?>">Show all friends</a><?php }?> - <a href="friends_cleanup.php?xusername=<?php echo $xusername; ?>&daysfilter=60">Only show users inactive for more than 60 days</a></p> <table class="sortable xfire_lastseen"> <tr> <th class="xfnick">Nickname</th> <th class="xfstatus">Status</th> <th class="sorttable_numeric xfseen">Last Online</th> </tr> <?php include( "xfireparser.class.php" ); $xf = new xfire_data( $xusername, true ); $friends = $xf->GetFriends(); $timenow = date( "U" ); foreach( $friends as $k => $v ) { $nickname = base64_decode( $v["nickname_base64" ] ); $filteronline = (bool)$_GET["filteronline"]; if( empty( $nickname ) ) { $nickname = $v["username"]; } if( $v["status"] == "online" ) { $statustext = "<span style=\"color: #00AA00\">Online</span>"; $diff_text = "<span style=\"color: #9F9F9F\">n/a</span>"; $diff = 0; } else { $statustext = "<span style=\"color: #AA0000\">Offline</span>"; $lastlogoff = $v["last_logoff_ts"]; $diff = (($timenow - $lastlogoff)/86400); if( $diff < 1 ) { $diff_text = "Less than a day ago"; } else { if( (int)$diff < 2 ) { $diff_text = "1 day ago"; } else { $diff_text = (int)$diff . " days ago"; } } } if( ( $filteronline == true && $v["status" ] == "online" ) || ( !empty($_GET["daysfilter" ]) && $diff < $_GET["daysfilter" ] ) ) { echo "<!-- Skipped online user -->\n"; $hiddenfriends++; } else { echo "\n\t\t\t<tr>\n\t\t\t\t<td><a href=\"http://xfire.com/profile/" . $v["username"] . "/\" title=\"Xfire username: " . $v["username"] . "\">" . htmlentities( utf8_decode( $nickname ) ) . "</a></td>\n\t\t\t\t<td>$statustext</td>\n\t\t\t\t<td sorttable_customkey=\"$diff\">$diff_text</td>\n\t\t\t</tr>"; $shownfriends++; } $total++; } ?> </table> <div class="xtotal"><?php echo $shownfriends ?> out of <?php echo $total; ?> friends shown<?php if( $hiddenfriends > 0 ) { ?> (<?php echo $hiddenfriends ?> hidden)<?php } ?>.</div> <?php } ?> <p>© 2008 Stephen Swires. Original idea by <a href="http://multicoregamers.com">BennyRom</a></p> </body></html>