Example #1
0
    tag($target_id, $chaser_id);
    $num_tagged = '';
    if ($chaser_id) {
        $num_tagged = get_num_tagged_by($chaser_id);
    }
    echo "<p>Runner {$target_id} has been tagged.</p>";
    if ($cookie_rid == $chaser_id) {
        $tagged_twitter = get_runner_twitter($target_id);
        if ($tagged_twitter) {
            $twitterString = "I just tagged @{$tagged_twitter} -- victim number {$num_tagged}! #sxsw #jtteotn";
        } else {
            $tagged_name = get_runner_name($target_id);
            if ($tagged_name) {
                $twitterString = "I just tagged {$tagged_name} -- victim number {$num_tagged}! #sxsw #jtteotn";
            } else {
                $twitterString = "I just tagged victim number {$num_tagged}! #sxsw #jtteotn";
            }
        }
        echo "<p><a href='http://twitter.com/intent/tweet?text=" . clean_tweet($twitterString) . "'>Tweet it!</a> {$twitterString}</p>";
    } elseif ($cookie_rid == $target_id) {
        if ($chaser_id) {
            $chaser_twitter = get_runner_twitter($chaser_id);
        }
        if ($chaser_twitter) {
            $twitterString = "I've been tagged by @{$chaser_twitter} -- I am now transformed; a chaser, ready to stalk the runners through the night. #sxsw #jtteotn";
        } else {
            $twitterString = "I've been tagged -- I am now transformed; a chaser, ready to stalk the runners through the night. #sxsw #jtteotn";
        }
        echo "<p><a href=\"http://twitter.com/intent/tweet?text=" . clean_tweet($twitterString) . "\">Tweet it!</a> {$twitterString}</p>";
    }
}
<?php

require_once 'functions.php';
$cookie_rid = $_COOKIE["jlog-rid"];
if ($cookie_rid) {
    echo "<p>You are logged in with runner id ", $cookie_rid, "</p>\n";
} else {
    echo "<p>Scan your QR code to log in.</p>\n";
}
echo "<p>Your instructions: After scanning your QR code to log in, scan the QR codes of the checkpoints in order to log your time at each one.  If you are tagged, the chaser may scan your QR code to register that you are tagged.  If you tag someone, you can scan their QR code to record that you tagged them.  You can always scan your own QR code again to get your stats.</p>";
if ($cookie_rid) {
    if (get_runner_twitter($cookie_rid)) {
        $seconds_until_start = $game_start_time - time();
        if ($seconds_until_start > 0) {
            $m = (int) ($seconds_until_start / 60);
            $s = $seconds_until_start % 60;
            $h = (int) ($m / 60);
            $m = $m % 60;
            $timestring = str_pad($h, 2, '0', STR_PAD_LEFT) . ":" . str_pad($m, 2, '0', STR_PAD_LEFT) . ":" . str_pad($s, 2, '0', STR_PAD_LEFT);
            $twitterString = "T - {$timestring} and counting until Journey starts! Find me at Spiral Hill in Butler Park! #sxsw #jtteotn";
            echo "<p><a href='http://twitter.com/intent/tweet?text=" . clean_tweet($twitterString) . "'>Tweet it!</a> {$twitterString}</p>";
        }
    }
    echo "<p><a href='/runners/", $cookie_rid, "'>View your stats</a></p>\n";
} else {
    echo "<p>Scan your QR code to log in.</p>\n";
}