} } } } } else { if (empty($runner_id)) { print $runner_id; print 'Please scan your Runner ID code to register, or type it in here... <form name="runner" action="' . $_SERVER['PHP_SELF'] . '?act=hand" method="post"> <p><input type="text" name="runner_id" value="' . $runner_id . '"> <p><input type="submit" value="Submit"></p> </form> '; die; } if (!is_valid_runner($runner_id)) { print "Invalid runner"; die; } if ($runner_id == $jlogRID) { print ' <h3>Runner ID: ' . $runner_id . '</h3> <p>Your phone is bound to Runner ID ' . $runner_id . ', you can now scan another player\'s Runner ID code to claim them as a tag.<br /> <form name="bind_runner" action="/clear" method="post"> <p><input type="submit" value="Unbind phone from Runner ID"></p> </form> <form name="update_runner" action="' . $_SERVER['PHP_SELF'] . '?act=up" method="post">
function new_runner_id() { $new_id = random_runner_id(); while (is_valid_runner($new_id)) { $new_id = random_runner_id(); } return $new_id; }
function tag_exists($tagger_id, $runner_id) { $runner_id = clean_runner_id($runner_id); $tagger_id = clean_chaser_id($tagger_id); if (!is_valid_runner($tagger_id) || !is_valid_runner($runner_id)) { print "Invalid runner or tagger id<br/ >"; return false; } $mysql = connectdb(true); $query = "SELECT tag_id FROM " . TAGS_TBL . " WHERE tagger_id = '" . $tagger_id . "' AND runner_id = '" . $runner_id . "'"; $result = mysql_query($query, $mysql); if (mysql_num_rows($result) > 0) { return true; } else { return false; } }
<?php require_once 'functions.php'; $cookie_rid = $_COOKIE["jlog-rid"]; $url_rid = $command[0]; if ($cookie_rid && $cookie_rid == $url_rid) { # rid cookie already assigned; redirect to runner profile redirect_to('/runners/' . $url_rid); } elseif (!$cookie_rid && $url_rid) { # no cookie; if the runner is already created, log in and redirect to runner profile; if not, create if (is_valid_runner($url_rid)) { login($url_rid); redirect_to('/runners/' . $url_rid); } else { redirect_to('/create_runner/' . $url_rid); } } elseif ($cookie_rid && !$url_rid) { # logged in, going to base page (no runner id in url) -- redirect to runner info redirect_to('/runners/' . $cookie_rid); } elseif ($cookie_rid && $url_rid && $cookie_id != $url_rid) { # scanning a different rid than the one you're logged in as; if you're a chaser, then probably a tag; otherwise...direct to the target's runner page (will note that you have to mark yourself as a chaser to tag them, log out to log in as them) if (is_chaser($cookie_rid)) { redirect_to('/tagged/' . $url_rid . '/' . $cookie_rid); } else { redirect_to('/runners/' . $url_rid); } } else { # no cookie and no url id -- probably direct url access by bot or player? redirect to instructions redirect_to('/instructions'); }