-
Notifications
You must be signed in to change notification settings - Fork 1
/
printer.php
29 lines (23 loc) · 825 Bytes
/
printer.php
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
<?php
header('Content-Type: text/plain');
# target database
$target = $argv[1] ?? $_GET['t'] ?? null;
if ($target == null) die("No target detected!");
require __DIR__ . '/modules/Database.php';
$db = new Database($target);
$u = $db->queryUser($target);
//header("Content-Disposition: attachment; filename=\"{$u['user']}.txt\";" );
# print user details
$createdAt = date('j F Y, H:i:s', $u['created_at']);
$tweetCount = $db->countTweets($target);
echo "{$u['name']} (@{$u['user']})
Joined at $createdAt.
Location: {$u['location']}
{$u['following']} following, {$u['followers']} followers, $tweetCount tweets
Bio:
{$u['description']}
";
# read & print tweets
$tweets = $db->queryTweets($target, length: 0);
while ($ent = $tweets->fetchArray())
echo date('Y/m/d, H:i:s', $ent['time']) . ' : ' . $ent['text'] . "\n\n";