<?php header('Content-Type: text/html; charset=utf-8'); include_once("../include/check_login.php"); //if($user_ok == false){header('location: restricted.php?refPage=buy');} include_once("../stats.php"); include_once("../words.php"); $t = $_GET['t']; if(!isset($_GET['t'])){header("location: unlock.php");} if(isset($_GET['d']) && $_GET['d'] != NULL){ $d = getDeckRow(getDeckIDFromURL($_GET['d'])); $affiliIdStr = getDeckInfo($d['short_name'], 'affiliates_str'); $affiliIdArr = explode(",",$affiliIdStr, -1); $dAffilUrl = getAffilInfo($affiliIdArr[0], 'url'); }else if(!isset($_GET['d']) OR $_GET['d'] == NULL OR empty($_GET['d'])){ $d = "no deck set"; } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"><!-- Super important! Tells googlebot that this site is responsive!--> <meta name="robots" content="NOODP"> <title>Japanese Flashcards | <?= ($_GET['d'] != '' ? $_GET['d'] : $t);?></title> <meta name="description" content="If you're looking for Japanese <?php echo $t; if($d!="no deck set"){echo " $d";}?> Vocabulary, then this free Japanese site is for you! We've done all the work for you!"> <meta name="keywords" content="Japanese Vocabulary, Japanese flashcards online, Online Japanese Flashcards, Free Flashcards, Flash cards" /> <meta name="author" content="Benjamin Cann"> <meta property="og:title" content="Online Japanese Flashcards Flashcard -JPVocab.com" /> <meta property="og:type" content="website" /> <meta property="og:url" content="http://www.JPVocab.com/Japanese-Vocabulary/deck.php?t=<?php echo $_GET['t'];?>&d=<?php echo $_GET['d'];?>" />
<small><small><a href="http://www.JPVocab.com/player.php?player=<?php echo $user['username']; ?> &report=flashcardrank">Flashcard Ranking</a>: <?php echo ordinal(getUserFCardRank($user['id'])); ?> </small> </td> <td> <small>Currently Practicing <a href="<?php echo getDeckFullUrl(getSkill('cvset', $user['id'])); ?> "> <?php echo getDeckInfo(getSkill('cvset', $user['id']), 'display_name'); ?> </a></small> </td> </tr> <tr><td colspan="2"><small><b><?php echo getStat('ttldks', $user['id']); ?> </b> Decks owned</small></td></tr> <tr><td colspan="2"><small><b><?php echo getStat('ttlpvstyl', $user['id']); ?> </b> Quiz Modes owned</small></td></tr> </table>
?> Japanese Vocabulary Deck Details Page"><?php echo getDeckInfoFromId(getDeckInfo($cvset, 'series_prev'), 'display_name'); ?> </a></i> <br /><i>Recommended next: <a href="http://www.jpvocab.com/Japanese-Vocabulary/deck.php?t=<?php echo getDeckInfoFromId(getDeckInfo($cvset, 'series_next'), 'type'); ?> &d=<?php echo getDeckInfoFromId(getDeckInfo($cvset, 'series_next'), 'display_url'); ?> " title="<?php echo getDeckInfoFromId(getDeckInfo($cvset, 'series_next'), 'display_name'); ?> Japanese Vocabulary Deck Details Page"><?php echo getDeckInfoFromId(getDeckInfo($cvset, 'series_next'), 'display_name'); ?> </a></i> </div>--> </div> </div> </div> <!-- Quiz Word--> <div class="col-sm-4"> <div class="row" ><?php include_once $_SERVER['DOCUMENT_ROOT'] . "/mc_get.php"; //include('include/kanjiRE.php'); ?> <div class="col-xs-4 small text-left">Streak: <?php echo $_SESSION['streak']; ?>
if ($vstyle == 'kanjiRE') { $gcRw = getDeckInfo($cvset, 'gc_per_kanjiRE'); } elseif ($vstyle == 'kanjiE') { $gcRw = getDeckInfo($cvset, 'gc_per_kanjiE'); } elseif ($vstyle == 'kanjiH') { $gcRw = getDeckInfo($cvset, 'gc_per_kanjiH'); $skills[] = 'kanji'; } elseif ($vstyle == 'audioR') { $gcRw = getDeckInfo($cvset, 'gc_per_audioR'); } elseif ($vstyle == 'audioE') { $gcRw = getDeckInfo($cvset, 'gc_per_audioE'); } elseif ($vstyle == 'audioK') { $gcRw = getDeckInfo($cvset, 'gc_per_audioK'); $skills[] = 'kanji'; } $gcPen = getStat('gold', $userID) < getDeckInfo($cvset, 'gc_per_kanjiRE') ? 0 : getDeckInfo($cvset, 'gc_per_kanjiRE'); //gold penalty equiv to easiest setting $progressVoc = $cvset . '_' . $vstyle . '_prog'; //********************************************* //******INCREASE STATS & SKILLS IF CORRECT***** //******************************************* if ($wordIDGuess == $answerID) { $correct = true; $_SESSION['streak']++; if ($_SESSION['streak'] > 5) { $streakBonus = round(pow($_SESSION['streak'], 1.1)); } incrStat('sumcfc', $userID); incrStat('sumc' . $vstyle, $userID); //incrUserDeckStat('stats_correct', $cvset, $vstyle, $userID); setStat('conf', $userID, getStat('conf', $userID) + $confCorrGain);
function getRanLv($cvset, $userID) { include_once 'stats.php'; $vStyle = getSkill('vStyle', $userID); $cvsetMxLv = getDeckInfo($cvset, 'levels'); $mxLv = getSkill($cvset . "_{$vStyle}" . "_lv", $userID); $prob = 0.5; //prob to make next quiz word a word from the current level. reinforces new learning. if ($mxLv >= $cvsetMxLv) { $mxLv = $cvsetMxLv; $prob = 1 / $mxLv; } $tmin = 0; $tmax = $prob * 100; $rn = mt_rand(0, 25); for ($n = 0; $n < 3; $n++) { $rn += mt_rand(0, 25); } $returned = FALSE; $j = 0; $i = $mxLv; do { //occasional errors on this. It times out. /*error_log(" words.php getRanLv()<br /> rn $rn<br /> tmin $tmin<br /> tmax $tmax<br /> j $j<br /> i(mxLv) $i<br />");*/ if ($rn > $tmin && $rn <= $tmax) { if ($i <= 0) { return 1; } else { return $i; } } else { $tmin = $tmax; $t = (100 - $tmax) * $prob; $tmax += round($t); } $j++; $i--; } while ($i > 1); return 1; //failsafe }
function setMoneyBoughtDeck($deckSN, $userId, $currency) { //Assign funds and price for chosen currency if ($currency == "gc") { $userFunds = getStat($currency, $userId); $deckPrice = getDeckInfo($deckSN, 'gold_price'); //change this to getPrice() later - after deck prices added to tbl } elseif ($currency == "dmd") { $userFunds = getStat('Diamonds', $userId); $deckPrice = getDeckInfo($deckSN, 'diamond_price'); } $balance = $userFunds - $deckPrice; if ($balance >= 0) { if ($currency == "gc") { $currencyDisplay = 'Gold'; } elseif ($currency == "dmd") { $currencyDisplay = 'Diamonds'; } setStat($currencyDisplay, $userId, $balance); return 'success'; } elseif ($balance < 0) { echo "Error: Couldn't purchase deck, insufficient funds"; return; } }
} /******************************************************************************************************************/ $username = $_GET['player']; require_once 'config.php'; require_once 'stats.php'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql'); mysql_select_db($dbname); $pid = getUserID($_GET['player']); $atk = getStat('atk', $pid); $mag = getStat('mag', $pid); $def = getStat('def', $pid); $gc = getStat('gc', $pid); $confidence = getStat('conf', $pid); $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);
<td style="background-color:#000;"></td><?php } } } //-------------------AUDIO MEDIUM if ($ownsAudE == TRUE) { ?> <td class="<?php echo $finAudE; ?> " style="vertical-align:middle;"><span class="text-default">Lv. <?php echo "{$clvAudE}"; ?> </span></td><?php } else { if ($ownsAudE == FALSE && getDeckInfo($sDeck, 'audioE') == 1) { ?> <td style="vertical-align:middle;"><button type="button" class="btn btn-sm btn-link" onClick="buyVstyle('<?php echo $sDeck; ?> ','<?php echo $value; ?> ','<?php echo $pid; ?> ','gc','audioE')">Click to upgrade deck,<br />get this quiz mode for <span class="text-info"><?php echo $paudioE; ?> Gold Coins</span> <span class="glyphicon glyphicon-hand-up"></span></button></td><?php } else {
onClick="buyVstyle('<?php echo $cvset; ?>','<?php echo getDeckInfo($cvset, 'id'); ?>','<?php echo $userID; ?>','gc', 'audioE')" > <a href="#2"> Audio Flashcards: Learn English. <span class="text-info">Click to buy for <?php echo getPrice('audioE', 'gc');?> Gold</span> </a> </li><?php }?> </li><!-- END MEDIUM AUDIO FLASHCARDS--> <!--***************HARD AUDIO MODE OWNED OR NOT OWNED*************--> <li><? if(getOwnershipDeckVstyle($cvset,'audioK',$userID)==TRUE && getDeckInfo($cvset, 'audioK')==1){?> <li role="presentation" class="<?php if($vstyle == 'audioK'){echo "";}?>" onClick="vsChange('vStyle','audioK')" > <a href="#3"> Audio Flashcards: Learn Kanji <span class="badge"><small><i>Lv.<?= $vsLvAHard; if($vsLvAHard==$mxDkLv){echo " (Max)";}?></i></small></span> </a> </li><? }else if(getOwnershipDeckVstyle($cvset,'audioK',$userID)==FALSE && getDeckInfo($cvset, 'audioK')==1){?> <li role="presentation" class="vsBuy" onClick="buyVstyle('<?php echo $cvset; ?>','<?php echo getDeckInfo($cvset, 'id'); ?>','<?php echo $userID; ?>','gc', 'audioK')" > <a href="#3"> Audio Flashcards: Learn Kanji. Click to buy <span class="text-default"><?php echo getPrice('audioK', 'gc');?> Gold </a> </li><?php }?> </li><!--END HARD MODE AUDIO--> </ul> </div>