示例#1
0
if ($_SESSION['guestInit'] == false || $_SESSION['username'] == 'Guest') {
    require_once 'config.php';
    $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql');
    mysql_select_db($dbname);
    mysql_query("SET NAMES UTF8");
    $u = preg_replace('#[^a-z0-9]#i', '', 'Guest' . rand(1, 5000));
    $ip = preg_replace('#[^0-9.]#', '', getenv('REMOTE_ADDR'));
    $sql = sprintf("INSERT INTO users (username, ip, is_guest, notescheck) VALUES('%s','%s','1',now())", $u, $ip);
    $query = mysql_query($sql) or die(mysql_error());
    $userID = mysql_insert_id($conn);
    require_once 'stats.php';
    setStat('conf', $userID, '0');
    setStat('maxconf', $userID, '150');
    setStat('lv', $userID, '1');
    setStat('gold', $userID, '0');
    setStat('dmd', $userID, '0');
    //Set Initial Deck
    //setOwnershipDeck('hirkat',$userID);
    //setOwnershipvStyle('hirkat','audioR',$userID);
    //setOwnershipDeck('minna',$userID);//sets ownership of deck(adds this deck to users' user_decks); initializesdeck_lv, deck_progress, deck_prog_max
    setOwnershipDeck('minna', $userID);
    //sets ownership of deck(adds this deck to users' user_decks); initializesdeck_lv, deck_progress, deck_prog_max
    setSkill('cvset', $userID, 'minna');
    setSkill('vstyle', $userID, 'kanjiRE');
    // CREATE THEIR SESSIONS AND COOKIES
    $_SESSION['username'] = $u;
    $_SESSION['prevID'] = 1;
    $_SESSION['guestInit'] = true;
}
/******************************************************************************************************************/
require_once 'words.php';
示例#2
0
文件: index.php 项目: Hjorvar/bbg
<?php

session_start();
$name = $_SESSION['username'];
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/dump.include.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/include/db_browsergame.inc.php';
require $_SERVER['DOCUMENT_ROOT'] . '/browsergame/inc/logincheck.inc.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/browsergame/functions/stats.function.php';
$phand = getStat('phand', $userID);
$shand = getStat('shand', $userID);
if ($_POST) {
    setStat('phand', $userID, $shand);
    setStat('shand', $userID, $phand);
    $temp = $shand;
    $shand = $phand;
    $phand = $temp;
}
try {
    $sql = "SELECT name FROM items WHERE id = :phand";
    $s = $pdo->prepare($sql);
    $s->bindValue(':phand', $phand);
    $s->execute();
} catch (PDOException $e) {
    $error = 'Error fetching primary hand.' . $e->getMessage();
    include $_SERVER['DOCUMENT_ROOT'] . '/include/error.html.php';
    exit;
}
if ($s) {
    list($phand_name) = $s->fetch(PDO::FETCH_ASSOC);
    $phand = $phand_name;
}
示例#3
0
文件: index.php 项目: Knixd/JPVocab
    require_once 'stats.php';
    setStat('atk', $userID, '5');
    setStat('def', $userID, '2');
    setStat('conf', $userID, '0');
    setStat('maxconf', $userID, '150');
    setStat('mag', $userID, '5');
    setStat('lv', $userID, '1');
    //Set Money
    setStat('gold', $userID, '0');
    setStat('dmd', $userID, '0');
    //Set Initial Deck
    setOwnershipDeck('hirkat', $userID);
    setOwnershipvStyle('hirkat', 'audioR', $userID);
    setOwnershipDeck('minna', $userID);
    //sets ownership of deck(adds this deck to users' user_decks); initializesdeck_lv, deck_progress, deck_prog_max
    setStat('ttldks', $userID, '2');
    setSkill('cvset', $userID, 'hirkat');
    setSkill('vstyle', $userID, 'kanjiRE');
    setAchiev('submit_jlpt', $userID, '1');
    //Could create a folder for this user at this point. Folder would hold their files
    //Email the suer their activation link
    $to = "{$e}";
    $from = "*****@*****.**";
    //create this
    $subject = 'Free JP decks for ' . $u . ' coming right up! One step left.';
    $message = '<!DOCTYPE html><html><head><meta charset="UTF-8"><title>jpvocab.com Email Confirmation</title></head><body style="margin:0px; font-family:Tahoma, Geneva, sans-serif;"><div style="padding:10px; background: #2c3e50; font-size:24px; color:#CCC;"><a href="http://www.jpvocab.com" style="color:white;"><!--<img src="http://www.jpvocab.com/img/logo.png" width="36" height="30" alt="jpvocab.com" style="border:none; float:left;"></a>-->jpvocab.com Account Activation</div><div style="padding:24px; font-size:17px;">Welcome ' . $u . '!<p>I am so grateful that you decided to check out jpvocab! My name is Ben and I am a Japanese learner just like you. I went on a year exchange to Japan in 2012-2013 and it changed my life. Now I am working towards helping others learn Japanese even faster than I did.</p><p>So, free vocab decks? All you need to do is click the link to confirm your email and they\'ll be transmorgified straight to your account (Calvin & Hobbes reference anyone?).</p><p>Sincerely,</p><p>Ben<br />jpvocab.com</p><p>Click the link to activate your account.</p><p><a href="http://www.jpvocab.com/activation.php?id=' . $userID . '&u=' . $u . '&e=' . $e . '&p=' . $pHashed . '">Click to activate</a><br /><br />Your login info:<br /><b>Username:</b> ' . $u . '<br /><b>Email:</b> ' . $e . '</div><br /><a href="https://twitter.com/jpvocab_ben" target="_blank"><img
src="http://static.viewbook.com/images/social_icons/twitter_32.png"/></a></p></body></html>';
    $headers = "From: {$from}\n";
    $headers .= "MIME-Version: 1.0\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\n";
    if (mail($to, $subject, $message, $headers)) {
示例#4
0
session_start();
header('Content-Type: text/html; charset=utf-8');
include_once "../include/check_login.php";
if ($user_ok == false) {
    header("location: ../restricted.php");
}
include_once '../stats.php';
include "../pdc.php";
$skill = $_POST['el'];
$price = $_POST['val'];
$uid = getUserID(preg_replace('#[^a-z0-9]#i', '', $_POST['user']));
$sessUid = getUserID(preg_replace('#[^a-z0-9]#i', '', $_SESSION['username']));
$gold = getStat('gold', $uid);
//double check post is same as session username
if ($uid != $sessUid) {
    echo "error";
    die;
} else {
    if ($gold < $price) {
        echo "error";
        die;
    } else {
        setStat($skill, $uid, getStat($skill, $uid) + 1);
        setStat('gold', $uid, getStat('gold', $uid) - $price);
        echo "success";
    }
}
//double check enough gold
//increase skill
//decrease gold
            $query = sprintf("SELECT name FROM items WHERE id = %s", mysql_real_escape_string($itemID));
            $result = mysql_query($query);
            list($itemName) = mysql_fetch_row($result);
            $smarty->assign('item', $itemName);
            $monster_exp = getMonsterStat('exp', $monsterID);
            $smarty->assign('exp', $monster_exp);
            $exp_rem = getStat('exp_rem', $userID);
            $exp_rem -= $monster_exp;
            $level_up = 0;
            if ($exp_rem <= 0) {
                // level up!
                $exp_rem = 100;
                $level_up = 1;
            }
            $smarty->assign('level_up', $level_up);
            setStat('exp_rem', $userID, $exp_rem);
        } else {
            // monster won
            $smarty->assign('lost', 1);
        }
        $smarty->assign('combat', $combat);
    } else {
        // Running away! Send them back to the main page
        header('Location: index.php');
    }
} else {
    $area_id = $_GET['area'];
    $query = sprintf("SELECT monster FROM area_monsters WHERE area = %s ORDER BY RAND() LIMIT 1", mysql_real_escape_string($area_id));
    $result = mysql_query($query);
    list($monster_id) = mysql_fetch_row($result);
    $query = sprintf("SELECT name FROM monsters WHERE id = %s", mysql_real_escape_string($monster_id));
示例#6
0
文件: index.php 项目: Hjorvar/bbg
     } else {
         $attacker =& $player;
         $defender =& $monster;
     }
     $damage = 0;
     if ($attacker['attack'] > $defender['defence']) {
         $damage = $attacker['attack'] - $defender['defence'];
     }
     $defender['curhp'] -= $damage;
     $combat[$turns] = array(attacker => $attacker['name'], defender => $defender['name'], damage => $damage);
     $turns++;
 }
 setStat('curhp', $userID, $player['curhp']);
 if ($player['curhp'] > 0) {
     // player won
     setStat('gc', $userID, getStat('gc', $userID) + getMonsterStat('gc', $monsterID));
     $won = 1;
     $gold = getMonsterStat('gc', $monsterID);
     $rand = rand(0, 100);
     try {
         $sql = "SELECT item_id FROM monster_items WHERE monster_id = :monsterid AND rarity >= :rand ORDER BY RAND() LIMIT 1";
         $s = $pdo->prepare($sql);
         $s->bindValue(':monsterid', $monsterID);
         $s->bindValue(':rand', $rand);
         $s->execute();
     } catch (PDOException $e) {
         $error = 'Error fetching item from monster.' . $e->getMessage();
         include $_SERVER['DOCUMENT_ROOT'] . '/include/error.html.php';
         exit;
     }
     list($itemID) = $s->fetch();
<?php

require_once 'smarty.php';
session_start();
require_once 'config.php';
// our database settings
require_once 'stats.php';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql');
mysql_select_db($dbname);
// retrieve user ID
$query = sprintf("SELECT id FROM users WHERE UPPER(username) = UPPER('%s')", mysql_real_escape_string($_SESSION['username']));
$result = mysql_query($query);
list($userID) = mysql_fetch_row($result);
if ($_POST) {
    $amount = $_POST['amount'];
    $gold = getStat('gc', $userID);
    $needed = getStat('maxhp', $userID) - getStat('curhp', $userID);
    if ($amount > $needed || $amount == '') {
        $amount = $needed;
    }
    if ($amount > $gold) {
        $amount = $gold;
    }
    setStat('gc', $userID, getStat('gc', $userID) - $amount);
    setStat('curhp', $userID, getStat('curhp', $userID) + $amount);
    $smarty->assign('healed', $amount);
}
$smarty->assign('curhp', getStat('curhp', $userID));
$smarty->assign('maxhp', getStat('maxhp', $userID));
$smarty->assign('gold', getStat('gc', $userID));
$smarty->display('healer.tpl');
mysql_select_db($dbname);
// retrieve user ID
$query = sprintf("SELECT id FROM users WHERE UPPER(username) = UPPER('%s')", mysql_real_escape_string($_SESSION['username']));
$result = mysql_query($query);
list($userID) = mysql_fetch_row($result);
$gold = getStat('gc', $userID);
if ($_POST) {
    $amount = $_POST['amount'];
    if ($_POST['action'] == 'Deposit') {
        if ($amount > $gold || $amount == '') {
            // the user input something weird - assume the maximum
            $amount = $gold;
        }
        $amount = abs($amount);
        setStat('gc', $userID, getStat('gc', $userID) - $amount);
        setStat('bankgc', $userID, getStat('bankgc', $userID) + $amount);
        $smarty->assign('deposited', $amount);
    } else {
        $bankGold = getStat('bankgc', $userID);
        if ($amount > $bankGold || $amount == '') {
            // the user input something weird again - again, assume the maximum
            $amount = $bankGold;
        }
        setStat('gc', $userID, getStat('gc', $userID) + $amount);
        setStat('bankgc', $userID, getStat('bankgc', $userID) - $amount);
        $smarty->assign('withdrawn', $amount);
    }
}
$smarty->assign('gold', getStat('gc', $userID));
$smarty->assign('inbank', getStat('bankgc', $userID));
$smarty->display('bank.tpl');
示例#9
0
文件: temple.php 项目: Knixd/JPVocab
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql');
mysql_select_db($dbname);
require_once 'stats.php';
$userID = getUserID(preg_replace('#[^a-z0-9]#i', '', $_SESSION['username']));
$player = array(name => preg_replace('#[^a-z0-9]#i', '', $_SESSION['username']), attack => getStat('atk', $userID), defence => getStat('def', $userID), magic => getStat('mag', $userID), curhp => getStat('curhp', $userID), maxhp => getStat('maxhp', $userID), level => getStat('lv', $userID), xp => getStat('conf', $userID), maxxp => getStat('maxconf', $userID), gold => getStat('gc', $userID));
if ($_POST) {
    if ($_POST['action'] == 'offense') {
        $cost = 500;
        if ($player['gold'] - $cost < 0) {
            $monk = "We cannot train you for free. Come back when you're able to pay.";
        } else {
            $monk = "...";
            //decrease gold
            //set status to training
            //increase stat
            setStat('gc', $userID, $player['gold'] - $healCost);
            $healAmt = $player['maxhp'] - $player['curhp'];
            $healTime = $healAmt;
            $result = "You offer the monk <b>{$cost} gold</b>. He accepts ... you think.\r\r\n\t\t\t\t<p>Without saying anything he turns and slowly makes his way across the courtyard and points inside the temple. You assume he's letting you go inside. You bow reverently and walk up the familiar wooden steps.</p>\r\r\n\t\t\t\t<p> Inside, you proceed to the center. You kneel and wait, for you know your training has already begun...</p>";
        }
    }
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta name="robots" content="NOODP">
	<meta name="description" content="Japanese Flashcards. Many decks. Many styles. - jpvocab.com">
示例#10
0
文件: index.php 项目: Hjorvar/bbg
<?php

session_start();
$name = $_SESSION['username'];
include $_SERVER['DOCUMENT_ROOT'] . '/include/db_browsergame.inc.php';
require $_SERVER['DOCUMENT_ROOT'] . '/browsergame/inc/logincheck.inc.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/browsergame/functions/stats.function.php';
$setHP = getStat('sethp', $userID);
if ($setHP == 0) {
    setStat('curhp', $userID, 10);
    setStat('maxhp', $userID, 10);
    setStat('sethp', $userID, 1);
}
$attack = getStat('atk', $userID);
$magic = getStat('mag', $userID);
$defence = getStat('def', $userID);
$gold = getStat('gc', $userID);
$currentHP = getStat('curhp', $userID);
$maximumHP = getStat('maxhp', $userID);
require "main.html.php";
示例#11
0
mysql_query("SET NAMES UTF8");
$userID = getUserID($_SESSION['username']);
$fcrank = getUserFCardRank($userID);
$ttldks = getStat('ttldks', $userID);
$ttlpvstyl = getStat('ttlpvstyl', $userID);
$fcrankFA = $fcrank > 50 ? '<i class="fa fa-frown-o text-danger"></i>' : ($fcrank > 25 ? '<i class="fa fa-meh-o"></i>' : ($fcrank <= 25 ? '<i class="fa fa-smile-o text-success"></i>' : ''));
$dksFA = $ttldks < 3 ? '<i class="fa fa-frown-o text-danger"></i>' : ($ttldks >= 3 && $ttldks < 7 ? '<i class="fa fa-meh-o"></i>' : ($ttldks >= 7 ? '<i class="fa fa-smile-o text-success"></i>' : ''));
$vstylFA = $ttlpvstyl < 3 ? '<i class="fa fa-frown-o text-danger"></i>' : ($ttlpvstyl >= 3 && $ttlpvstyl < 7 ? '<i class="fa fa-meh-o"></i>' : ($ttlpvstyl >= 7 ? '<i class="fa fa-smile-o text-success"></i>' : ''));
if ($ttldks == 0) {
    $ttldks = countUserDecks($userID);
    setStat('ttldks', $userID, $ttldks);
}
//make sure db is correc
if ($ttlpvstyl == 0) {
    $ttlpvstyl = countUserVStyle($userID);
    setStat('ttlpvstyl', $userID, $ttlpvstyl);
}
?>


<!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>Display Deck Words</title>
	<meta name="description" content="We're dedicated to Japanese practice. Learn elsewhere, practice here. We feature modern design, anime flashcards, and free online Japanese practice quizzes.">
	<meta name="keywords" content="Learning Japanese, Japanese practice, online Japanese exercises, login, sign up">
	<meta property="og:title" content="Best Free Online Japanese practice site. Lobby!" />
	<meta property="og:type" content="website" />
示例#12
0
文件: forest.php 项目: Knixd/JPVocab
        if ($_POST['action'] == 'Heal for 5GC and run home!') {
            $healCost = 5;
            if (getStat('gc', $userID) - $healCost < 0) {
                $result = "Insufficient Funds to Heal. Go train some more for GC";
            } else {
                setStat('curhp', $userID, getStat('maxhp', $userID));
                setStat('gc', $userID, getStat('gc', $userID) - $healCost);
                $result = "You've healed yourself for {$healCost} GC!</br>";
            }
        } else {
            // running away! send them back to the main page
            $lostGold = getStat('gc', $userID) - 10;
            if ($lostGold < 0) {
                setStat('gc', $userID, 0);
            } else {
                setStat('gc', $userID, $lostGold);
            }
            header('Location: index.php');
        }
    }
}
/*$query = sprintf("SELECT name FROM monsters ORDER BY RAND() LIMIT 1");
	$result = mysql_query($query);
	list($tmonster) = mysql_fetch_row($result);*/
$query = sprintf("SELECT username FROM users WHERE id != '%s' AND is_guest != 1 ORDER BY RAND() LIMIT 1", mysql_real_escape_string($userID));
$result = mysql_query($query);
list($tmonster) = mysql_fetch_row($result);
$ranCase = array("You were walking home late at night and noticed that someone was following you. You walked a little farther but couldn't take it anymore. You suddenly turned around and saw that it was the notorious <a href='player.php?player={$tmonster}'>{$tmonster}</a> from the baby diaper commercials. <i>But they didn't know you had been studying Japanese.", "The next day you stop to tie your shoelace when suddenly you feel somebody watching you. Cold shivers run up and down your spine. You're paralyzed with fear because you know in this humidity, at this beach, in this type of sunshine, with all all these people that it could only mean one thing, <a href='player.php?player={$tmonster}'>{$tmonster}</a>. <i>But they didn't know you had been studying Japanese.", "A group of common thugs surround you. They hold baseball bats and busted up pieces of pipe. Scars and a stench not unlike Axe body spray eminates from every pore. Sickening. Their leader identifies themselves as <a href='player.php?player={$tmonster}'>{$tmonster}</a> and they want your gold. <i>But they didn't know you had been studying Japanese.", "<p>You're trapped. Held hostage against your own will on the SS Dorivdad Space Cruiser currently leaving Sector 8. All you know is that you were taking the space elavator from the small Janton planet below, listening to the news about the notorious space pirate Captain <a href='player.php?player={$tmonster}'>{$tmonster}</a> wreaking havic to Justic Space Corp patrols like yours when there was a pop as the elevator lights suddenly exploded. From there you felt the back of your head slam against the glass wall behind you as a fist crashed into your face.</p><p>  You're groggy. They must've drugged you. From the looks of your cell you're not alone. Two other regular looking civilians were chained beside you. Suddenly you hear heavy footsteps coming to your cell. <i>But they didn't know you had been studying Japanese.", "<p>You didn't mean to knock over the orange-laden fruit stand. You were just minding your own business, dropping in on the grocery store to grab some almonds because your bakery was running short on them this morning. But now there's an angry fruit-stand designer in front of you. Today happened to be the national Fruit-Stand Design Seminar with famous guest designers from Russia, Japan, England, France, and more. The internationally renowned and two-time receiver of the French Fruit-stand Design Accolade <a href='player.php?player={$tmonster}'>{$tmonster}</a> saw you knock over the oranges display.</p> <p>Due to the recent negative media from a controversal fruit-stand design in New York, <a href='player.php?player={$tmonster}'>{$tmonster}</a> took it personally and claims you were deliberate. Seminar guests who you previously thought were regular grocery shoppers have started gathering around, drawn to the area by the noise <a href='player.php?player={$tmonster}'>{$tmonster}</a> was making. <i>But they didn't know you had been studying Japanese.</p>", "Something is wrong. You look around the tavern but don't see anyone suspiciou.... well actually everyone is suspicious here but you don't see anything out of the ordinary. Wait! You have no recollection of how long you've been here or how much food and drink you've bought! You check your wallet and it's empty. You look up to see the bartender smirk. The bartender's nametage reads <i>'<a href='player.php?player={$tmonster}'>{$tmonster}</a>'</i>...wait! That's none other than a famous dark jedi that hasn't been seen or heard of for years! You don't know why this jedi is here; you have to report it to headquarters fast! You were jedi-mind tricked into buying more than you needed. <i>But they didn't know you had been studying Japanese.");
$ranKey = mt_rand(0, count($ranCase) - 1);
//$smarty->assign('monster',$monster);
//$smarty->display('forest.tpl');
示例#13
0
文件: index.php 项目: Hjorvar/bbg
        }
        $row = $s->fetch();
        if ($row) {
            $error = 'Error: that username is taken.';
            include $_SERVER['DOCUMENT_ROOT'] . '/include/error.html.php';
            exit;
        } else {
            try {
                $sql = 'INSERT INTO users SET 
				username = :username
				,password = :password';
                $s = $pdo->prepare($sql);
                $s->bindValue(':username', $_POST['username']);
                $s->bindValue(':password', $securepass);
                $s->execute();
            } catch (PDOException $e) {
                $error = 'Error adding submitted user and password.';
                include $_SERVER['DOCUMENT_ROOT'] . '/include/error.html.php';
                exit;
            }
            $userID = $pdo->lastInsertId();
            require_once $_SERVER['DOCUMENT_ROOT'] . '/browsergame/functions/stats.function.php';
            setStat('atk', $userID, '5');
            setStat('def', $userID, '5');
            setStat('mag', $userID, '5');
            header('Location:http://www.skolahysing.com/browsergame/main/index.php');
            exit;
        }
    }
}
include 'register.html.php';
示例#14
0
文件: index.php 项目: Hjorvar/bbg
            $s = $pdo->prepare($sql);
            $s->bindValue(':armorid', $armorID);
            $s->execute();
        } catch (PDOException $e) {
            $error = 'Error item cost details.';
            include $_SERVER['DOCUMENT_ROOT'] . '/include/error.html.php';
            exit;
        }
        list($cost) = $s->fetch(PDO::FETCH_ASSOC);
        $gold = getStat('gc', $userID);
        if ($gold > $cost) {
            $slot = getArmorStat('aslot', $armorID);
            $equipped = getStat($slot, $userID);
            if (!$equipped) {
                setStat($slot, $userID, $armorID);
                setStat('gc', $userID, $gold - $cost);
                $message = 'You purchased and equipped the new armor.';
            } else {
                // they already have something equipped - display an error
                $error = 'You are already wearing a piece of that kind of armor! You will need to sell your current armor before you can buy new armor.';
            }
        } else {
            $error = 'You cannot afford that piece of armor.';
        }
    }
}
try {
    $result = $pdo->query('SELECT DISTINCT(id), name, price FROM items WHERE type = \'Armor\' ORDER BY RAND() LIMIT 10');
} catch (PDOException $e) {
    $error = 'Error fetching item name and price from the database!';
    include $_SERVER['DOCUMENT_ROOT'] . '/include/error.html.php';
示例#15
0
文件: stats.php 项目: Knixd/JPDrills
function setMoneyBalances($sElement, $sMethod, $userId)
{
    $userFunds = getStat($sMethod, $userId);
    $elementP = getPrice($sElement, $sMethod);
    $balance = $userFunds - $elementP;
    if ($balance >= 0) {
        setStat($sMethod, $userId, $balance);
        return 'success';
    }
}
示例#16
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');
示例#17
0
<?php

session_start();
include '../stats.php';
$t = $_POST['t'];
$u = $_POST['u'];
if ($_POST['query'] == 'check') {
    $status = getAchiev($t, $u) == '1' ? 'claimed' : 'not claimed';
    error_log("getAchiev..{$t},{$u}.ss {$status}");
    echo $status;
} else {
    if ($_POST['query'] == 'claim') {
        if ($t == 'dmd_reg_bonus') {
            setStat('dmd', $u, getStat('dmd', $u) + getAchievInfo($t, 'reward'));
            setAchiev($t, $u, '1');
            echo "Success";
        } else {
            if ($t == 'submit_jlpt') {
                $j = $_POST['j'];
                setUserDetail('jlpt', $j, $u);
                setStat(getAchievInfo($t, 'reward_type'), $u, getStat(getAchievInfo($t, 'reward_type'), $u) + getAchievInfo($t, 'reward'));
                setAchiev($t, $u, '1');
                echo "Success";
            } else {
                echo "Fail";
            }
        }
    }
}
error_log("nuthin" . $_POST['query']);