コード例 #1
0
function getTopTags($images)
{
    global $client;
    $tags = [];
    $max = 0;
    foreach ($images as $image) {
        $response = $client->tagging($image['small_url']);
        if ($response->getErrors()) {
            foreach ($response->getErrors() as $err) {
                echo 'Error: ' . $err->getMessage() . ', status code: ' . $err->getStatusCode();
                exit;
            }
        }
        foreach ($response->getResults() as $result) {
            foreach ($result->getTags() as $tag) {
                $score = getScore($tag->getConfidence());
                if ($score < 1) {
                    break;
                }
                if (!isset($tags[$tag->getLabel()])) {
                    $tags[$tag->getLabel()] = 0;
                }
                $tags[$tag->getLabel()] += getScore($tag->getConfidence());
                if ($tags[$tag->getLabel()] > $max) {
                    $max = $tags[$tag->getLabel()];
                }
            }
        }
    }
    return [$tags, $max];
}
コード例 #2
0
ファイル: part1.php プロジェクト: ultramega/adventofcode2015
function getBestRecipe($total, array $ings, array $props, &$best, array $amounts = array())
{
    $level = count($amounts);
    if ($level < count($ings)) {
        $ing = array_keys($ings)[$level];
        for ($i = $total; $i > 0; $i--) {
            $amounts[$ing] = $i;
            getBestRecipe($total - $i, $ings, $props, $best, $amounts);
        }
    } elseif ($total === 0) {
        $best = max(array($best, getScore($ings, $props, $amounts)));
    }
}
コード例 #3
0
ファイル: score.php プロジェクト: neodyymi/Tsoha-Bootstrap
 /**
  * Fetches all scores from database.
  *
  * @return array Returns a listing of all scores in database.
  */
 public static function all()
 {
     $query = DB::connection()->prepare('SELECT * FROM Score');
     $query->execute();
     $rows = $query->fetchAll();
     $scores = array();
     foreach ($rows as $row) {
         $tmp = getScore($row['id']);
         $throws = $tmp['throws'];
         $par = $tmp['par'];
         $scores[] = new Score(array('id' => $row['id'], 'player' => $row['playerid'], 'roundId' => $row['roundid'], 'throws' => $throws, 'par' => $par));
     }
     return $scores;
 }
コード例 #4
0
ファイル: scormListener.php プロジェクト: GnaritasInc/gnlms
function checkCompletion($uid, $cid, $data)
{
    global $gnlms;
    $dataObj = json_decode(stripslashes($data));
    if (!$dataObj) {
        error_log("JSON parse error: " . json_last_error());
        error_log("JSON string: {$data}");
        return;
    }
    if (isComplete($dataObj) && $gnlms->data->getUserCourseStatus($uid, $cid) != "Completed") {
        $gnlms->data->setCourseComplete($uid, $cid, getScore($dataObj));
    } else {
        if (isFailed($dataObj) && $gnlms->data->getUserCourseStatus($uid, $cid) != "Failed") {
            $gnlms->data->setCourseFailed($uid, $cid, getScore($dataObj));
        }
    }
}
コード例 #5
0
ファイル: userorder_do.php プロジェクト: piapro/AIRestaurant
                     $arr[] = $row4;
                     $user = $row4['order_user'];
                     $oid = $row4['order_id2'];
                     //订单号
                     $sql5 = "select cart_count,food_id from qiyu_cart,qiyu_food where cart_food=food_id and cart_order=" . $oid;
                     //查询外卖数量
                     $rs5 = mysql_query($sql5);
                     while ($rows5 = mysql_fetch_assoc($rs5)) {
                         $arr[] = $rows5;
                         $foodcount = $rows5['cart_count'];
                         $fid = $rows5['food_id'];
                         $sql6 = "update qiyu_food set food_count=food_count+" . $foodcount . " where food_id=" . $fid;
                         //更新外卖数量
                         mysql_query($sql6);
                     }
                     $score = floor(getScore($v));
                     $sql7 = "update qiyu_user set user_score=user_score+" . $score . " ,user_experience=user_experience+" . expUserConsume . " where user_id=" . $user;
                     //更新积分,经验值
                     if (!mysql_query($sql7)) {
                         alertInfo('取消失败,原因SQL出现异常', 'userorder.php?key=' . $key . $url, 0);
                     }
                 }
             }
         }
     }
     alertInfo('设置订单为已完成成功', 'userorder.php?key=' . $key . $url, 0);
     break;
 case 'subqx':
     //预约取消
     $idlist = $_POST['idlist'];
     if (!$idlist) {
コード例 #6
0
ファイル: ajax.php プロジェクト: rakeshsalunke/ruzzle
                if (isset(${$tmp_char}) && !empty(${$tmp_char})) {
                    $_SESSION['matrix'][$i] = ${$tmp_char};
                }
                $_SESSION['word_base_score'][$i] = isset(${$tmp_base}) && !empty(${$tmp_base}) ? ${$tmp_base} : 1;
                $_SESSION['word_spl_score'][$i] = isset(${$tmp_spl}) && !empty(${$tmp_spl}) ? ${$tmp_spl} : "";
            }
            print_r($_SESSION['matrix']);
            $_SESSION['tmp_val'] = $_SESSION['final_word_cell'] = $_SESSION['final_opt'] = $_SESSION['word_score'] = array();
            break;
        case 'getWord':
            // $_SESSION['word_cell'] = array();
            for ($j = 1; $j <= 5; $j++) {
                getword($cellCnt, $j, $_SESSION['matrix'][$cellCnt]);
            }
            echo "done";
            break;
        case 'getWordWithScore':
            // print_r($_SESSION['tmp_val']);
            $dataFile = 'master';
            $dataFile_records = file($dataFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
            $match = array_intersect($_SESSION['tmp_val'], $dataFile_records);
            $match_score = array();
            foreach ($match as $tmpK => $tmpV) {
                $tmpScore = getScore($_SESSION['final_word_cell'][$tmpK]);
                $match_score[] = array("word" => $tmpK, "score" => $tmpScore);
                $_SESSION['final_opt'][$tmpK] = $tmpScore;
            }
            echo json_encode($_SESSION['final_opt']);
            break;
    }
}
コード例 #7
0
ファイル: asynch.php プロジェクト: haverver/SVN
<?php

include_once '../../includes/class.init.php';
include_once '../../includes/class.player.php';
include '../../includes/class.data.php';
$init = new init(0, 0, 0);
$data = new data();
switch ($init->repository->get_data("asynchAction")) {
    case 1:
        getRatingData($init, $data);
        break;
    case 2:
        getScore($init, $data);
        break;
    case 3:
        getOpponentMatches($init, $data);
        break;
    case 4:
        getOpponentScores($init, $data);
        break;
}
function getRatingData($init, $data)
{
    $player = new player($init->settings, $init->repository->get_data("player"));
    echo json_encode($player->getRatingData());
}
function getScore($init, $data)
{
    $player = new player($init->settings, $init->repository->get_data("player"));
    echo json_encode($player->getScores($init->repository->get_data("color"), $init->repository->get_data("tempo")));
}
コード例 #8
0
$pagename = "examenresultatentoevoegen";
checkSession();
checkIfAdminIsLoggedOn();
if (isset($_POST['examen_id'])) {
    $examen_id = $_POST['examen_id'];
    unset($_POST['examen_id']);
    $GEGEVENS = $_POST;
    $gebruiker = $_SESSION['gebruiker_id'];
    $totaalscore = 0;
    $puntenaftrek = $_POST['puntenaftrek'];
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
        if (isset($_POST['test'])) {
            unset($GEGEVENS['test']);
            foreach ($GEGEVENS as $examenvraagid => $score) {
                $totaalscore = $totaalscore + $score;
                $data = getScore($gebruiker, $examenvraagid);
                if (empty($data)) {
                    //score inserten in tabel score
                    insertScore($gebruiker, $examenvraagid, $score);
                    //score updaten in tabel resultaat
                } else {
                    //score inserten in tabel score
                    updateScore($gebruiker, $examenvraagid, $score);
                }
            }
            $check = checkIfExamResultExists($_SESSION['gebruiker_id'], $examen_id);
            if ($check) {
                //totaal score updaten in tabel resultaat
                insertScoreTabelResultaat($_SESSION['gebruiker_id'], $totaalscore, $examen_id, $puntenaftrek);
            } else {
                //totaal score updaten in tabel resultaat
コード例 #9
0
<?php

$result = $_POST;
//var_dump($result);
$answer = array();
$score = 0;
$filename = 'gen_knowledge.json';
$data = json_decode(file_get_contents($filename));
$answer = getAnswer($data);
$score = getScore($answer, $result);
echo "Your Score is {$score}";
function getAnswer($data)
{
    $contents = $data->contents;
    //var_dump($contents);
    $index = 0;
    foreach ($contents as $value) {
        $answer[$index++] = $value->answer;
    }
    return $answer;
}
function getScore($answer, $result)
{
    $index = 0;
    $score = 0;
    //var_dump($answer);
    //var_dump($result);
    foreach ($result as $key => $value) {
        switch ($key) {
            case 'q1':
                $index = 0;
コード例 #10
0
ファイル: whatif.php プロジェクト: andrewroth/winbolo
            } else {
                $listB = getPlayers($playerB, 50);
            }
        }
    }
    if (sizeof($listA) == 1 && sizeof($listB) == 1) {
        if ($listA[0] == $playerA && $listB[0] == $playerB) {
            #We have found a match
            $found = true;
            if ($isTeam == true) {
                $idA = getTid($listA[0]);
                $idB = getTid($listB[0]);
            } else {
                $idA = getPid($listA[0]);
                $idB = getPid($listB[0]);
            }
            $scoreA = getScore($idA, $gt, $isTeam);
            $scoreB = getScore($idB, $gt, $isTeam);
            $newScoreA_1 = floor(calculateElo($scoreA, $scoreB, true));
            $newScoreB_1 = floor(calculateElo($scoreB, $scoreA, false));
            $newScoreA_2 = floor(calculateElo($scoreA, $scoreB, false));
            $newScoreB_2 = floor(calculateElo($scoreB, $scoreA, true));
        }
    }
}
if ($found == true) {
    include "{$BASE_FILES}/inc_whatif_results.php";
} else {
    include "{$BASE_FILES}/inc_whatif.php";
}
include "{$BASE_FILES}/inc_bottom.php";
コード例 #11
0
ファイル: stuScoList.php プロジェクト: nextinfos/htdocs
$instructorID = $confUserID;
$term = getTerm();
$year = getYear();
$scoreID = $_REQUEST['scoreID'];
$objQuery = getStuRegList($subjectID, $instructorID, $year, $term);
if ($objQuery && mysql_num_rows($objQuery) > 0) {
    while ($row = mysql_fetch_array($objQuery)) {
        if ($scoreType == 'GRADE') {
            $grade = getGrade($row['studentID'], $subjectID, $term, $year);
            $select = '<select name="score" style="width: 80px;">';
            $select .= '<option value="">--</option>';
            $select .= '<option value="4"' . selected($grade, '4') . '>4.0</option>';
            $select .= '<option value="3.5"' . selected($grade, '3.5') . '>3.5</option>';
            $select .= '<option value="3"' . selected($grade, '3') . '>3.0</option>';
            $select .= '<option value="2.5"' . selected($grade, '2.5') . '>2.5</option>';
            $select .= '<option value="2"' . selected($grade, '2') . '>2.0</option>';
            $select .= '<option value="1.5"' . selected($grade, '1.5') . '>1.5</option>';
            $select .= '<option value="1"' . selected($grade, '1') . '>1.0</option>';
            $select .= '<option value="0"' . selected($grade, '0') . '>0</option>';
            $select .= '<option value="W"' . selected($grade, 'W') . '>W</option>';
            $select .= '</select>';
            $data['data'][] = array('cardID' => '<span style="display:none;">' . $row['cardID'] . '</span>', 'secondCardID' => '<span style="display:none;">' . $row['secondCardID'] . '</span>', 'studentID' => $row['studentID'], 'firstName' => $row['firstName'], 'lastName' => $row['lastName'], 'score' => '<input type="hidden" name="studentID" value="' . $row['studentID'] . '">' . $select);
        } else {
            $dataScore = $addStatus == '1' ? '' : getScore($scoreID, $row['studentID']);
            $data['data'][] = array('cardID' => '<span style="display:none;">' . $row['cardID'] . '</span>', 'secondCardID' => '<span style="display:none;">' . $row['secondCardID'] . '</span>', 'studentID' => $row['studentID'], 'firstName' => $row['firstName'], 'lastName' => $row['lastName'], 'score' => '<input type="hidden" name="studentID" value="' . $row['studentID'] . '"><input type="text" name="score" value="' . $dataScore . '" />');
        }
    }
} else {
    $data['data'][] = array('cardID' => '', 'secondCardID' => '', 'studentID' => '', 'firstName' => 'ไม่พบข้อมูล', 'lastName' => '', 'score' => '');
}
echo json_encode($data);
コード例 #12
0
ファイル: wbn-gameend.php プロジェクト: andrewroth/winbolo
function calculateRanksPlayers($sqlServerKey, $winnerKey, $gameType)
{
    $sql = "select distinct ge_playera from game_event where ge_serverkey='{$sqlServerKey}' and ge_playera is not null and ge_playera <> '{$winnerKey}' and (ge_eventtype = " . WINBOLO_NET_EVENT_BASE_CAPTURE . " or ge_eventtype = " . WINBOLO_NET_EVENT_PILL_CAPTURE . " or ge_eventtype = " . WINBOLO_NET_EVENT_BASE_STEAL . " or ge_eventtype = " . WINBOLO_NET_EVENT_PILL_STEAL . ")";
    $result = mysql_query($sql);
    $loserKey = mysql_result($result, 0, 0);
    $winnerPid = getPidFromKey($winnerKey, $sqlServerKey);
    $loserPid = getPidFromKey($loserKey, $sqlServerKey);
    if ($winnerPid == 0 || $loserPid == 0) {
        return;
    }
    # Get player Ranks
    $winnerScore = getScore($winnerPid, $gameType, false);
    $loserScore = getScore($loserPid, $gameType, false);
    # Calclulate New Scores
    $newWinnerScore = calculateElo($winnerScore, $loserScore, true);
    $newLoserScore = calculateElo($loserScore, $winnerScore, false);
    # Update ranks
    setScore($winnerPid, $gameType, $newWinnerScore, false);
    setScore($loserPid, $gameType, $newLoserScore, false);
    updateWinsLoses($winnerPid, $gameType, true, false);
    updateWinsLoses($loserPid, $gameType, false, false);
}
コード例 #13
0
ファイル: dontbemean.php プロジェクト: cederw/winfoHackathon
        if ($_GET['sub'] == 'SUBJECTIVE') {
            $score += 50;
        }
    }
    //  echo $score;
    if ($_GET['agr'] == 'AGREEMENT') {
        $score += 10;
    } else {
        if ($_GET['agr'] == 'DISAGREEMENT') {
            $score += 5;
        }
    }
    $score = $score * $_GET['conf'];
    return $score;
}
try {
    $conn = new PDO("mysql:host={$servername};dbname={$dbname}", $username, $password);
    // set the PDO error mode to exception
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $sql = "INSERT INTO COMMENT_ANALYSIS (\n    \tUser, \n    \tComment, \n    \tRating, \n    \tIrony, \n    \tSubjective, \n    \tAgreement, \n    \tConfidence,\n    \tScore)\n    VALUES (\n    \t'" . $_GET['user'] . "',\n    \t'" . $_GET['comm'] . "',\n    \t'" . $_GET['rate'] . "',\n    \t'" . $_GET['ir'] . "',\n    \t'" . $_GET['sub'] . "',\n    \t'" . $_GET['agr'] . "',\n    \t'" . $_GET['conf'] . "',\n    \t'" . getScore() . "')";
    // use exec() because no results are returned
    $conn->exec($sql);
    //echo "New record created successfully";
    header('Location: index.php');
} catch (PDOException $e) {
    echo $sql . "<br>" . $e->getMessage();
}
$conn = null;
?>

コード例 #14
0
ファイル: stuScore.php プロジェクト: Vagor/seu
<?php

session_start();
$uid = $_SESSION["uid"];
header("Content-Type:text/plain;charset=utf-8");
if (empty($_POST["term"])) {
    $term = 1;
    $kind = $_POST["kind"];
} else {
    $term = $_POST["term"];
    $kind = $_POST["kind"];
}
include_once 'fun.inc.php';
linkDB();
$arr = getScore($uid, $term, $kind);
echo json_encode($arr, JSON_UNESCAPED_UNICODE);
コード例 #15
0
ファイル: reversi.php プロジェクト: rev84/ConsoleReversi
/**
 * 成績を描画
 * @param array $board 
 * @return void
 */
function drawScore($board)
{
    list($blackScore, $whiteScore) = getScore($board);
    echoConsole("黒:" . $blackScore . "  白:" . $whiteScore . "\n");
}
コード例 #16
0
ファイル: c.php プロジェクト: elyaagoubimhamed/THYP-1516
<?php

session_start();
include_once 'connect.php';
switch ($_GET["table"]) {
    case "score":
        createScore($_GET);
        break;
    case "getscore":
        getScore();
        break;
    case "personne":
        createPersonne($_GET);
        break;
    case "deletepersonne":
        deletePersonne($_GET);
        break;
    case "updatepersonne":
        updatePersonne($_GET);
        break;
    case "getpersonne":
        getPersonne();
        break;
    case "auth":
        auth($_GET);
        break;
    case "document":
        getDoc();
        break;
    case "coords":
        getCoords($_GET["idDoc"]);
コード例 #17
0
ファイル: file.php プロジェクト: GrottoCenter/GrottoCenter
 $e_t_underground = isset($_POST['e_t_underground']) ? $_POST['e_t_underground'] : '';
 $e_t_trail = isset($_POST['e_t_trail']) ? $_POST['e_t_trail'] : '';
 $aestheticism = isset($_POST['aestheticism']) ? $_POST['aestheticism'] : '';
 $caving = isset($_POST['caving']) ? $_POST['caving'] : '';
 $approach = isset($_POST['approach']) ? $_POST['approach'] : '';
 $alert_me = isset($_POST['alert_me']) ? $_POST['alert_me'] : '';
 $id_answered = isset($_POST['id_answered']) ? $_POST['id_answered'] : '';
 $aestheticism = limitValue($aestheticism, 0, 10);
 $caving = limitValue($caving, 0, 10);
 $approach = limitValue($approach, 0, 10);
 //Relevance of the contribution
 $smallStr = false;
 if ($ncat == "rigging" || $ncat == "bibliography") {
     $smallStr = true;
 }
 $contribRelevance = getScore($body . " " . $title, "", false, $smallStr);
 $caverRelevance = $contribRelevance;
 updateCaverRelevance($caverRelevance, $_SESSION['user_id']);
 //Querry
 $sql = "INSERT INTO `" . $_SESSION['Application_host'] . "`.`T_" . $ncat . "` ( ";
 $sql .= "Relevance, ";
 if ($ncat == "comment" || $ncat == "description" || $ncat == "rigging") {
     $sql .= "Title, ";
 }
 if ($ncat == "rigging" || $ncat == "description" || $ncat == "comment") {
     $sql .= "Id_exit, ";
 }
 if ($ncat == "rigging") {
     $sql .= "Obstacles, ";
     $sql .= "Ropes, ";
     $sql .= "Anchors, ";
コード例 #18
0
function lib_getcommentlist(&$ctag, &$refObj)
{
    global $dsql;
    $attlist = "row|5,flag|all,type|comment,level|0,limit|0,isproduct|0";
    FillAttsDefault($ctag->CAttribute->Items, $attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    //$commenthomeid=$refObj->Fields['commenthomeid'];
    //根据aid来获取当前aid的评论
    //$commenthomeid=$refObj->Fields['aid'];
    //获取全部评论
    if ($flag == 'all') {
        $where = 'where typeid!=4 and typeid !=6';
    } else {
        if ($flag == 'line') {
            $where = 'where typeid = 1';
            $commenthomeid = $refObj->Fields['id'];
        } else {
            if ($flag == 'hotel') {
                $where = 'where typeid = 2';
                $commenthomeid = $refObj->Fields['id'];
            } else {
                if ($flag == 'car') {
                    $where = 'where typeid = 3';
                    $commenthomeid = $refObj->Fields['id'];
                } else {
                    if ($flag == 'spot') {
                        $where = 'where typeid = 5';
                        $commenthomeid = $refObj->Fields['id'];
                    } else {
                        if ($flag == 'visa') {
                            $where = 'where typeid = 8';
                            $commenthomeid = $refObj->Fields['id'];
                        } else {
                            if ($flag == 'tuan') {
                                $where = 'where typeid = 13';
                                $commenthomeid = $refObj->Fields['aid'];
                            } else {
                                if ($flag == 'tongyong') {
                                    $typeid = $refObj->Fields['typeid'];
                                    if (empty($typeid)) {
                                        return '';
                                    }
                                    $where = "where typeid = {$typeid}";
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    if ($level != 0) {
        $where .= " and level={$level}";
    }
    if (!empty($commenthomeid)) {
        $where .= ' and articleid=' . $commenthomeid;
    }
    $where .= " and isshow=1 ";
    $sql = "select * from #@__comment {$where}  order by addtime  desc limit {$limit},{$row}";
    if ($isproduct == 1) {
        $sql = "select * from #@__comment {$where} group by typeid,articleid order by addtime desc limit {$limit},{$row}";
    }
    $innertext = trim($ctag->GetInnertext());
    $dsql->SetQuery($sql);
    $dsql->Execute();
    $ctp = new STTagParse();
    $ctp->SetNameSpace("field", "[", "]");
    $ctp->LoadSource($innertext);
    $GLOBALS['autoindex'] = 0;
    $revalue = '';
    while ($row = $dsql->GetArray()) {
        $GLOBALS['autoindex']++;
        $awardinfo = getAwardInfo($row['orderid']);
        $row['jifentprice'] = $awardinfo['jifentprice'];
        $row['jifencomment'] = $awardinfo['jifencomment'];
        $row['jifenbook'] = $awardinfo['jifenbook'];
        $row['score'] = getScore($row);
        //分数
        $row['nickname'] = getMemberName($row['memberid']);
        //昵称
        $row['litpic'] = getMemberPic($row['memberid']);
        $row['pltime'] = Helper_Archive::formatAddTime($row['addtime']);
        //评论时间
        $row['percent'] = 20 * $row['score'] . '%';
        $row['percent1'] = 20 * $row['score1'] . '%';
        $row['percent2'] = 20 * $row['score2'] . '%';
        $row['percent3'] = 20 * $row['score3'] . '%';
        $row['percent4'] = 20 * $row['score4'] . '%';
        $row['productname'] = $row['typeid'] != '4' && $row['typeid'] != '6' ? getOrderName2($row['articleid'], $row['typeid'], '', $row['id']) : '';
        if ($row['productname'] == '') {
            continue;
        }
        $row['sellnum'] = getSellNum($row['productautoid']);
        //销售数量
        foreach ($ctp->CTags as $tagid => $ctag) {
            if ($ctag->GetName() == 'array') {
                $ctp->Assign($tagid, $row);
            } else {
                if ($row[$ctag->GetName()]) {
                    $ctp->Assign($tagid, $row[$ctag->GetName()]);
                }
            }
        }
        $revalue .= $ctp->GetResult();
    }
    return $revalue;
}
コード例 #19
0
ファイル: player.php プロジェクト: Knixd/JPVocab
$maxconf = getStat('maxconf', $pid);
$lv = getStat('lv', $pid);
$cvDN = getDeckInfo(getSkill('cvset', $pid), 'display_name');
$currentHP = getStat('curhp', $pid);
$maximumHP = getStat('maxhp', $pid);
$setHP = getStat('sethp', $pid);
$ttldks = getStat('ttldks', $pid);
$ttlpvstyl = getStat('ttlpvstyl', $pid);
$sumcfc = getStat('sumcfc', $pid);
$sumckanjiRE = getStat('sumckanjiRE', $pid);
$sumckanjiE = getStat('sumckanjiE', $pid);
$sumckanjiH = getStat('sumckanjiH', $pid);
$sumcaudioR = getStat('sumcaudioR', $pid);
$vocabulary = round(getScore('vocabulary', $pid), 2);
$listening = round(getScore('listening', $pid), 2);
$kanji = round(getScore('kanji', $pid), 2);
$ttldks = countUserDecks($pid);
$pDecks = getUserDecks($pid);
$pDecksSrtAscArr = sortDeckArrDN($pDecks);
//careful with this. vertNav.php uses $uDecksSrtAscArr
include "pdc.php";
try {
    $stmt = $db->query("SELECT  uo.*,\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\tSELECT  COUNT(*)\n\t\t\t\t\t\t\tFROM    user_stats ui\n\t\t\t\t\t\t\tWHERE   (ui.value) >= (uo.value)\n\t\t\t\t\t\t\tAND ui.stat_id=14\n\t\t\t\t\t\t\t) AS rank\n\t\t\t\t\t\tFROM    user_stats uo\n\t\t\t\t\t\tWHERE user_id={$pid}\n\t\t\t\t\t\tAND stat_id=14");
    $urank = $stmt->fetchALL(PDO::FETCH_ASSOC);
} catch (PDOException $ex) {
    echo "Couldn't get rank <br />";
}
$ranktfca = $urank[0]['value'] != 0 ? $urank[0]['rank'] : 'N/A';
require_once 'stats.php';
?>
<!DOCTYPE html>
コード例 #20
0
ファイル: check.php プロジェクト: Knixd/JPDrills
     //$changeLog[] = "<li>Overall Player Confidence:<b>+$confCorrGain</b> Confidence points</span></li>";
     //$changeLog[] = "<li>Quiz Mode:<b> +$skillCorrGain</b> Confidence points</span></li>";
     //$changeLog[] = "<li>Streak Bonus: <b>+$streakBonus</b> Confidence points</span></li>";
     //------------------INCREMENT GENERAL SKILLS
     $result = "<span style='color:green;'>CORRECT!</span>";
 } elseif ($wordIDGuess != $answerID) {
     $correct = false;
     setStat('conf', $userID, getStat('conf', $userID) - $confWrongPen);
     //overall conf stat
     setSkill($progressVoc, $userID, getSkill($progressVoc, $userID) - $skillWrongPen);
     //cvset prog skill
     setStat('gold', $userID, getStat('gold', $userID) - $gcPen);
     //gold
     incrUserDeckStat('stats_incorrect', $cvset, $vstyle, $userID);
     for ($i = 0; $i < sizeof($skills); $i++) {
         setStat($skills[$i], $userID, getScore($skills[$i], $userID) - $scoreDecr);
         $changeLog[] = "<li>" . getStatInfo($skills[$i], 'display_name') . ": <span class='text-danger'>-{$scoreDecr} Confidence points</span></li>";
     }
     $_SESSION['streak'] = 0;
 }
 //Update Statistics	//insertFlashcardResults($user_id,$deck_id,$word_id,$word_lv,$vstyle_id,$correct,$time_taken);
 //******************************************************
 //****CHECK IF PLAYER LEVELED UP & PREPARE DISPLAY VARIABLES***
 //********************************************
 $lvUp = setLevelUp($userID, 'quiz');
 //change lv's if needed
 //***Used to give display correct answer if user guessed wrong
 $original_kanji = getWord($_POST['questionID'], $questionFromBank);
 $reading_tmp = getReading($_POST['questionID'], $questionFromBank);
 $original_reading = $original_kanji == $reading_tmp ? '-' : getReading($_POST['questionID'], $questionFromBank);
 $original_translation = getWord($answerID, 'etest');
コード例 #21
0
ファイル: insertComment.php プロジェクト: AmedeoLeo/OpenIdeas
<?php

/** 
 * @author Amedeo Leo
 */
use Stichoza\GoogleTranslate\TranslateClient;
session_start();
require 'manageDB.php';
$content = $_POST['content'];
$idIdea = $_POST['idIdea'];
$idUser = $_SESSION['email'];
$scores = getScore($content);
insertComment($idUser, $idIdea, $content, $scores);
$comments = getCommentsByIdIdea($idIdea);
$idea = getIdeaById($idIdea);
$user_comment = getUserById($idUser);
$flag = 0;
$nameSurname = $user_comment['User']['name'] . " " . $user_comment['User']['surname'];
echo $nameSurname;
$followers = getFollowersByIdIdea($idIdea);
$alreadySent = array();
foreach ($followers as $follower) {
    if ($follower['idUser'] != $idUser) {
        $mail_destinatario = "{$follower['idUser']}";
        $mail_oggetto = "C'è un nuovo commento ad un'idea che stai seguendo!";
        $title = "L'idea {$idea['Idea']['nome']} ha un nuovo commento!";
        $nameSurname = $user_comment['User']['name'] . " " . $user_comment['User']['surname'];
        $body = "L'idea {$idea['Idea']['nome']} ha un nuovo commento: [{$nameSurname}]: {$content}";
        $alreadySent[] = $follower['idUser'];
        $text_idea = $idea['Idea']['nome'];
        $text = "La idea " . $text_idea . " che stai seguendo ha un nuovo commento:[" . $nameSurname . "]: " . $content;
コード例 #22
0
ファイル: day14.php プロジェクト: RedBoool/AdventOfCode
 * @param integer $stopTime
 *
 * @return mixed
 */
function getScore($reindeerList, $stopTime)
{
    for ($i = 1; $i <= $stopTime; $i++) {
        $positionList = getPosition($reindeerList, $i);
        $max = max($positionList);
        foreach ($positionList as $reindeer => $position) {
            if ($position === $max) {
                if (empty($score[$reindeer])) {
                    $score[$reindeer] = 0;
                }
                $score[$reindeer]++;
            }
        }
    }
    return $score;
}
$stopTime = 2503;
// Part 1
$reindeerListPart1 = array('comet' => array('speed' => 14, 'duration' => 10, 'rest' => 127, 'score' => 0), 'dancer' => array('speed' => 16, 'duration' => 11, 'rest' => 162, 'score' => 0));
$positionList = getPosition($reindeerListPart1, $stopTime);
print 'Part1: ' . max($positionList);
print PHP_EOL;
// Part 2
$reindeerListPart2 = getReindeerList();
$score = getScore($reindeerListPart2, 2503);
print 'Part2: ' . max($score);
print PHP_EOL;
コード例 #23
0
ファイル: index.php プロジェクト: rave6231/silverjack
</head>

    <body>
        <div id="wrapper">
        	<h1 style ='text-align:center'>Silver-Jack</h1>
        	
        	<?php 
$deck = generatedeck();
$hand1 = newhand();
$hand2 = newhand();
$hand3 = newhand();
$hand4 = newhand();
$score1 = getScore($hand1);
$score2 = getScore($hand2);
$score3 = getScore($hand3);
$score4 = getScore($hand4);
$scores = array("HILARY" => $score1, "SARAH" => $score2, "BOBBY" => $score3, "DONALD" => $score4);
?>
			
		<table>
			<tr>
				<td><img src='img/player_1.png'></td>
				<td><?php 
displayhand($hand1);
?>
</td>
				<td><?php 
echo $score1;
?>
</td>
			</tr>