Example #1
0
function insertCard($card, $set)
{
    $db = dbcon();
    $cmc = getConvertedCost($card['Cost']);
    $isw = $isu = $isb = $isr = $isg = 0;
    if (preg_match("/W/", $card['Cost'])) {
        $isw = 1;
    }
    if (preg_match("/U/", $card['Cost'])) {
        $isu = 1;
    }
    if (preg_match("/B/", $card['Cost'])) {
        $isb = 1;
    }
    if (preg_match("/R/", $card['Cost'])) {
        $isr = 1;
    }
    if (preg_match("/G/", $card['Cost'])) {
        $isg = 1;
    }
    # new gatherer - card type is now a . because of unicode
    $card['Type'] = str_replace('.', '-', $card['Type']);
    $query = "INSERT INTO cards(cost, convertedcost, name, cardset, type,\n\t\tisw, isu, isb, isr, isg) VALUES (\"{$card['Cost']}\", {$cmc},\n\t\t\"{$card['Name']}\", \"{$set}\", \"{$card['Type']}\", {$isw}, {$isu}, \n\t\t{$isb}, {$isr}, {$isg})";
    echo "{$query}<br>\n";
    mysql_query($query, $db) or die(mysql_error());
    mysql_close($db);
}
Example #2
0
function setList($set)
{
    $db = dbcon();
    $query = "SELECT name, isw, isg, isu, isr, isb \n\t\tFROM cards WHERE cardset=\"{$set}\"";
    $result = mysql_query($query, $db);
    $ret = array();
    $n = 0;
    while ($row = mysql_fetch_assoc($result)) {
        $ret[$n] = $row;
        $n++;
    }
    return $ret;
}
Example #3
0
function content()
{
    $db = dbcon();
    $query = "CREATE TEMPORARY TABLE scores(\n\t\tid BIGINT UNSIGNED, type VARCHAR(40), score BIGINT)";
    mysql_query($query, $db) or die(mysql_error());
    $query = "SELECT DISTINCT decktype FROM typeinfo";
    $result = mysql_query($query, $db) or die(mysql_error());
    $decktypes = array();
    while ($row = mysql_fetch_assoc($result)) {
        $decktypes[] = $row['decktype'];
    }
    $query = "SELECT dc.deck, d.name, SUM(dc.qty) AS n \n\t\tFROM deckcontents dc, decks d\n\t\tWHERE dc.issideboard=0 AND d.id=dc.deck GROUP BY dc.deck\n\t\tHAVING n > 40";
    $result = mysql_query($query, $db) or die(mysql_error());
    while ($row = mysql_fetch_assoc($result)) {
        $maxscore = -32000;
        $type = "Unclassified";
        for ($i = 0; $i < sizeof($decktypes); $i++) {
            $score = scoredeck($row['deck'], $decktypes[$i], $db);
            if ($score > $maxscore) {
                $maxscore = $score;
            }
            if ($score > 31) {
                $type = $decktypes[$i];
            }
        }
        $query = "INSERT INTO scores(id, type, score) \n\t\t\tVALUES({$row['deck']}, \"{$type}\", {$maxscore})";
        mysql_query($query, $db) or die(mysql_error());
    }
    $query = "SELECT s.id, s.type, s.score, d.name FROM scores s, decks d WHERE  d.id=s.id ORDER BY score DESC";
    $result = mysql_query($query, $db);
    echo "<table>";
    while ($row = mysql_fetch_assoc($result)) {
        echo "<tr><td><a href=\"/gatherling/deck.php?mode=view&id={$row['id']}\">";
        echo "{$row['name']}</a></td>";
        echo "<td>{$row['type']} ({$row['score']})</td></tr>\n";
    }
    echo "</table>";
}
Example #4
0
					<tr>
						<td colspan="5" class="tdfun"><table width="100%" border="0" cellspacing="0" cellpadding="0">
								<tr>
									<td bgcolor="#6699FF"><font color="#FFFFFF" size="2" face="arial"><b><span class="titulo">Escola
                </span></b></font></td>
								</tr>
					</table>					</tr>
					<tr>
      <td width="4" valign="top">&nbsp;</td>
      <td width="117" id="cbConsultor">Consultor</td>

      <td valign="top">
      <select name="cbConsultor" class="label_obrigatorio" id="cbConsultor">
        <option value="0" selected="selected"></option>
		<?php 
dbcon();
$SQL = "SELECT idpes, nome FROM pessoa ORDER BY nome";
$result = mysql_query($SQL);
while ($array = mysql_fetch_array($result)) {
    ?>
        <option value="<?php 
    echo $array["idpes"];
    ?>
"><?php 
    echo $array["nome"];
    ?>
</option>
		<?php 
}
?>
      </select>	  </td>
Example #5
0
<?php

require_once '../lib.php';
$db = dbcon();
header("Content-type: text/plain");
$query = "SELECT name FROM events WHERE start < NOW() ORDER BY series, season DESC, number DESC, name";
$result = mysql_query($query, $db) or die(mysql_error());
$n = 0;
while ($row = mysql_fetch_assoc($result)) {
    printf("[trophy]%s[/trophy]", $row['name']);
    $n++;
    if ($n % 3 == 0) {
        echo "\n";
    }
}
Example #6
0
	<head>
		<title>Job Details</title>
		<!--Import PHP functions-->
		<?php 
require 'include/functions.inc';
?>
	</head>
	<?php 
sessionTest();
//confirm user logged in
if (isset($_SESSION['userID'])) {
    // run a query to see if the job belongs to them
    $usr = $_SESSION['userID'];
    $job = $_GET['jobID'];
    //connect to db
    $pdo = dbcon();
    //select rows containing this user's ID and the selected JOB id (prevent people from accessing this page without correct privileges)
    $query = "\n\t\t\t\t\tSELECT J.JobID,\n\t\t\t\t\t\tJT.JobTypeDesc,\n\t\t\t\t\t\tJ.JobDescription,\n\t\t\t\t\t\tCONCAT(V.FirstName,' ',V.LastName) as 'assignee',\n\t\t\t\t\t\tCONCAT(M.FirstName,' ',M.LastName) as 'creator',\n\t\t\t\t\t\tJ.CreatedTimestamp\n\t\t\t\t\tFROM Jobs J\n\t\t\t\t\t\tINNER JOIN JobType JT on J.JobType = JT.JobTypeID\n\t\t\t\t\t\tLEFT JOIN Users V on J.AssignedUser = V.UserID\n\t\t\t\t\t\tLEFT JOIN Users M on J.CreatedUser = M.UserID\n\t\t\t";
    if ($_SESSION['userLevel'] == 2) {
        $query .= " WHERE JobID = :job;";
        $statement = $pdo->prepare($query);
        $statement->bindValue(':job', $job);
    } else {
        $query .= " WHERE CreatedUser = :usr\n\t\t\t\t\t\t\t\tAND JobID = :job;\n\t\t\t\t";
        $statement = $pdo->prepare($query);
        $statement->bindValue(':usr', $usr);
        $statement->bindValue(':job', $job);
    }
    $statement->execute();
    //echo "statement ran \n";
    //echo $statement->rowCount();