Example #1
0
 if (isset($_SESSION['meter'])) {
     unset($_SESSION['meter']);
 }
 for ($i = 1; $i <= 10; $i++) {
     $d++;
     $def_name = "defect" . $d;
     //$tab[$i]=0;
     echo "</ BR></BR>";
     //echo $_POST[$weight];
     //echo " ";
     //echo $_POST[$cat_id];
     if (isset($_POST["{$def_name}"])) {
         if ($_POST["{$def_name}"] == "1") {
             echo $d;
             echo $_POST["def_name"];
             $nam = checkin($d);
             $insert4 = "INSERT INTO`defect`( `Test_id_test` ,`state` ,`notes`) \r\n     VALUES ('{$last_id_t}','{$nam}',NULL )";
             echo mysql_query($insert4) or die("INSERT defect wrong");
         }
     }
 }
 //echo $sum_sub;
 //$tab[$_POST[$cat_id]]+=$sum_sub;
 //echo $site;
 /*
   $pre=1;        
   $insert5="INSERT INTO `quantity` (`Item_id_item` ,`quantity`) 
 VALUES ('$id_item_l','$pre'
 ) ";
   
     
Example #2
0
<?php

require_once 'config.php';
require_once 'functions.php';
$sql = "INSERT INTO statistics(person, date, service, expires, checkin, code, location, activity, room)\n            SELECT :person, current_date, (SELECT name FROM services WHERE id = :service),\n              '23:59:59', now()::timestamp, :code, :location, activities.name, rooms.name FROM data \n              LEFT JOIN activities ON data.activity=activities.id\n              LEFT JOIN rooms ON data.room = rooms.id\n              WHERE data.id = :person;";
$dbh = db_connect();
$sth = $dbh->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
ob_start();
include "/usr/lib/cgi-bin/secure-code.php";
$code = ob_get_clean();
function checkin($person, $service)
{
    global $code, $sth;
    $sth->execute(array(":person" => $person, ":service" => $service, ":code" => $code, ":location" => get_client_ip()));
}
header('Content-type: application/json');
if (!array_key_exists("services", $_REQUEST)) {
    checkin($_REQUEST["person"], $_REQUEST["service"]);
    echo json_encode(array("success" => true));
} else {
    $services = intval($_REQUEST["services"]);
    for ($i = 0; $i < floor(log($services, 2)) + 1; $i++) {
        if ($services >> $i & 1) {
            checkin($_REQUEST["person"], $i);
        }
    }
    echo json_encode(array("success" => true));
}
//TODO http://taxidi-kiosk1.local:8888/print.php?token=foxesarepawesome&action=print&id=2243
Example #3
0
require_once 'functions.php';
$cid = $command[1];
list($checkpoint_name, $checked_in_so_far) = get_checkpoint_name_and_status($cid);
$cookie_rid = $_COOKIE["jlog-rid"];
# echo "got cid ", $cid, " with runner id in cookie ", $cookie_rid, " and name ", $checkpoint_name, " and checked in so far ", $checked_in_so_far, "<br />\n";
if (!$cookie_rid) {
    echo "<p>You need to log in first!  Scan your QR code.</p>";
} elseif (!$checkpoint_name) {
    # TODO: this should never happen, unless someone tries entering a bad checkpoint code, so a confusing redirect/not mentioning the error is probably okay...but printing errors is usually better
    redirect_to('/instructions');
} else {
    if (is_chaser($cookie_rid)) {
        echo "<p>Sorry...you're a chaser.  We're glad you made it to this checkpoint, but your goal is now to tag runners.</p>";
        echo "<p><a href='/runners/{$cookie_rid}'>Check your stats</a></p>";
    } else {
        if (checkin($cookie_rid, $cid, $checked_in_so_far)) {
            echo "<p>You successfully checked in at ", $checkpoint_name, ". Only ", $checked_in_so_far, " runners checked in here before you did.</p>";
            $seconds_since_start = time() - $game_start_time;
            $m = (int) ($seconds_since_start / 60);
            $s = $seconds_since_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 = "I survived to {$checkpoint_name}! Made it in {$timestring}, with only {$checked_in_so_far} runners ahead of me. #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}'>Check your stats</a></p>";
        } else {
            echo "<p>You FAILED to check in at ", $checkpoint_name, "!</p>";
        }
    }
}
Example #4
0
		<h1>コンタクトタイム計測システム</h1>
		<table class="table table-bordered table-hover">
			<thead >
				<tr>
					<th>ランク</th>
					<th>名前</th>
					<th>合計</th>
					<th>最終履歴</th>
					<th>#</th>
				</tr>
			</thead>
			<tbody>
			<?php 
require "logic.php";
if (isset($_GET["name_id"])) {
    $result = checkin($_GET["name_id"]);
} else {
    if (isset($_GET["id"])) {
        $result = checkout($_GET["id"]);
    }
}
$result = getNames();
$time_add = array();
$start = array();
$end = array();
$flag = array();
$ids = array();
while ($row = mysql_fetch_assoc($result)) {
    $time_result = getTimes($row["id"]);
    $time_add[$row["name"]] = 0;
    $flag[$row["name"]] = 0;