Esempio n. 1
0
<?php

include 'mobile-friendly.html';
include 'functions.php';
print '<h2>Journey Log</h2>';
/* require_once('mobile_device_detect.php');
mobile_device_detect(true,false,true,true,true,true,true,'mobile/',false); */
$runner_id = clean_runner_id($_GET['rid']);
$cid = $_GET['cid'];
// Get the cid
$jlogCID = $_COOKIE["jlog-cid"];
$jlogRID = $_COOKIE["jlog-rid"];
$device_id = $_GET['did'];
$lat = $_GET['lat'];
$lon = $_GET['lon'];
$timestamp = $_GET['ts'];
if (empty($jlogRID)) {
    if (DEBUG) {
        print "RID cookie is empty<br />";
    }
}
if (empty($jlogCID)) {
    if (DEBUG) {
        print "CID cookie is empty<br />";
    }
}
//Is the checkpoint registered in cookies?
if (empty($jlogCID)) {
    //Checkpoint is not registered on device
    if (DEBUG) {
        print "You're not a checkpoint<br />";
<?php

#Register players via staff app
include 'functions.php';
$destination_folder = "/photos/";
//Receives post data and insert into database
/*
$key = $_POST['key'];

if ($key !== "doorhenge") {
	die();
}
*/
$runner_id = clean_runner_id($_POST['runner_id']);
$photo_name = $runner_id . ".jpg";
print "<h2>Journey Log<br>Autoregistering runner " . $runner_id . "</h2>";
if (empty($_POST['runner_id'])) {
    print "Missing data<br />";
    print "</body></html>";
    die;
}
if ($_FILES["player_photo"]["error"] > 0) {
    echo "Error Code: " . $_FILES["player_photo"]["error"] . "<br />";
} else {
    if (move_uploaded_file($_FILES["player_photo"]["tmp_name"], "photos/" . $photo_name)) {
        print "Successfully processed image<br />";
    } else {
        print "Error processing image<br />";
        die;
    }
}
Esempio n. 3
0
function is_already_checked_in($cid, $rid)
{
    $cid = clean_checkpoint_id($cid);
    $rid = clean_runner_id($rid);
    $mysqli = connectdb();
    $query = "SELECT COUNT(*) FROM " . CHECKINS_TBL . " WHERE checkpoint_id = ? and runner_id = ?";
    $stmt = $mysqli->prepare($query);
    $stmt->bind_param('ss', $cid, $rid);
    $stmt->execute();
    $stmt->bind_result($is_checkedin_already);
    $stmt->fetch();
    $stmt->close();
    if ($is_checkedin_already) {
        return true;
    } else {
        return false;
    }
}
Esempio n. 4
0
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;
    }
}
Esempio n. 5
0
<?php

require_once 'functions.php';
$rid = $_COOKIE["jlog-rid"];
# confirm that cookie is set properly
if (!$rid) {
    echo "<p>You must log in first. Scan your QR code.</p>";
} else {
    if ($_SERVER['REQUEST_METHOD'] == 'GET') {
        $rid = clean_runner_id($rid);
        list($name, $email, $twitter) = get_runner_details($rid);
        # print out a new form with this rid and player details
        echo form_results($rid, $name, $email, $twitter, false);
    } else {
        $rid = clean_runner_id($rid);
        $name = $_POST['name'];
        $email = $_POST['email'];
        $twitter = $_POST['twitter'];
        $form = form_results($rid, $name, $email, $twitter, true);
        if (!$form) {
            # passed validation
            update_or_create_new_runner($rid, $name, $email, $twitter, $rid);
            redirect_to('/runners/' . $rid);
        } else {
            # had errors; redisplay form
            echo $form;
        }
    }
}