function reRegisterPerson($isParticipant, $key)
{
    include 'DBHelperClass.php';
    // create database helper
    $db = new DBHelperClass();
    // unregister
    $ret = $db->redoRegistration($isParticipant, $key);
    // close database helper
    $db->close();
    return $ret;
}
<?php

include_once '../signupScripts/DBHelperClass.php';
include_once '../signupScripts/GeneralHelper.php';
$result = array();
$result["result"] = "failure";
$result["data"] = "Error: Unknown";
// check if token exists
if (array_key_exists("token", $_GET)) {
    // create database helper
    $db = new DBHelperClass();
    // test token
    if (!$db->loginToken($_GET["token"])) {
        $result["data"] = "Error: Token did not match.";
    } else {
        if (!array_key_exists("id", $_GET)) {
            $result["data"] = "Error: No id identifer.";
        } else {
            if (!array_key_exists("key", $_GET)) {
                $result["data"] = "Error: No key identifer.";
            } else {
                if (!array_key_exists("badge", $_GET)) {
                    $result["data"] = "Error: No badge identifer.";
                } else {
                    $id = $_GET["id"];
                    $key = $_GET["key"];
                    $badge = $_GET["badge"];
                    $res_checkin = $db->updateRecordIdKey($id, $key, "checked_in", 1);
                    if (!$res_checkin) {
                        $result["data"] = "Error: Could not check person in.";
                    } else {
Exemplo n.º 3
0
    $participants = $db->getParticipants();
    // get mentors
    $mentors = $db->getMentors();
    // close helper
    $db->close();
    // no session
} else {
    // check if loggin in
    if (array_key_exists("login", $_POST) && $_POST["login"] == 1) {
        // check if username and login exists
        if (array_key_exists("username", $_POST) && array_key_exists("password", $_POST)) {
            // get data
            $username = $_POST["username"];
            $password = $_POST["password"];
            // create helper
            $db = new DBHelperClass();
            // check if correct login
            if ($db->login($username, $password)) {
                // correct, so set cookie
                setcookie("t9hacks_login", "1", time() + 60 * 60 * 24);
                // close helper
                $db->close();
                // relocate to same page without post data
                header('Location: view.php');
            }
            // close helper
            $db->close();
        }
    }
}
//echo '<pre>' . print_r($participants, true) . '</pre>';
<?php

include_once '../signupScripts/DBHelperClass.php';
include_once '../signupScripts/GeneralHelper.php';
$result = array();
$result["result"] = "failure";
$result["data"] = "Error: Unknown";
// check if token exists
if (array_key_exists("token", $_GET)) {
    // create database helper
    $db = new DBHelperClass();
    // test token
    if ($db->loginToken($_GET["token"])) {
        //if(false) {
        // create an array for people
        //$people = array("participants" => array(), "mentors" => array());
        // fields desired
        $fields = array("id", "key", "name", "email", "phone", "shirt", "checked_in");
        // get participants
        $participants = $db->getParticipants();
        foreach ($participants as $id => $participant) {
            if ($participant["approved"] == 1 && $participant["unregistered"] == 0) {
                $participantData = array("type" => "participant");
                foreach ($fields as $field) {
                    $participantData[$field] = $participant[$field];
                    //$people["participants"][$participant["id"]][$field] = $participant[$field];
                }
                $people[] = $participantData;
            }
        }
        // get mentors
<?php

include_once 'DBHelperClass.php';
// create helper
$db = new DBHelperClass();
// get participants
$participants = $db->getParticipants();
//echo '<pre>'.print_r($participants, true).'</pre>'; die();
// get mentors
$mentors = $db->getMentors();
//echo '<pre>'.print_r($mentors, true).'</pre>'; die();
// close helper
$db->close();
// output headers so that the file is downloaded rather than displayed
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=data.csv');
// create a file pointer connected to the output stream
$output = fopen('php://output', 'w');
/*
// output the column headings
fputcsv($output, array('Column 1', 'Column 2', 'Column 3'));

// fetch the data
mysql_connect('localhost', 'username', 'password');
mysql_select_db('database');
$rows = mysql_query('SELECT field1,field2,field3 FROM table');

// loop over the rows, outputting them
while ($row = mysql_fetch_assoc($rows)) 
	fputcsv($output, $row);
*/