예제 #1
0
파일: mercs.php 프로젝트: Naddiseo/WW2Game
		if ($cgi['mercs_attacks'] > $user->samercs) $cgi['mercs_attacks'] = $merc->samercs;
		$gold = $cgi['mercs_attacks'] * 5000;
		updateMercenary(" attackSpecCount=attackSpecCount+{$cgi['mercs_attacks']} ");
		updateUser($_SESSION['isLogined'], " samercs=samercs-{$cgi['mercs_attacks']} , gold=gold+$gold ");
	}
	if ($cgi['mercs_defends']) {
		if ($cgi['mercs_defends'] < 1.0) {
			$cgi['mercs_defends'] = 1;
		}
		$cgi['mercs_defends'] = round($cgi['mercs_defends'], 0);
		if ($cgi['mercs_defends'] > $user->damercs) $cgi['mercs_defends'] = $user->damercs;
		$gold = $cgi['mercs_defends'] * 5000;
		updateMercenary(" defSpecCount =defSpecCount +{$cgi['mercs_defends']} ");
		updateUser($_SESSION['isLogined'], " damercs=damercs-{$cgi['mercs_defends']}  , gold=gold+$gold ");
	}
	updateUserStats($user);
	header("Location: mercs.php?strErr=$strErr");
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML><HEAD><TITLE><? echo $conf["sitename"]; ?> :: Neutral Portuguese Mercenaries  </TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1"><!-- ZoneLabs Privacy Insertion -->
<SCRIPT language=javascript src="js/js"></SCRIPT>
<LINK href="css/common.css" type=text/css rel=stylesheet>
<META  
content="ww2 , rpg, mmorpg, role playing, game, online game, text based game, armory, mercenaries, spy, attack, army, battle, recruit, spies, spy skill, weapons, messaging, sabotage, recon, intelligence, pnp, mud, games, stockade, free, browser game" 
name=keywords>
<META 
content="World War 2 is a Massively Multiplayer Online Role Playing Game with over 500,000 players. Players can choose one of four races: Orcs, Humans,  Elves and Dwarves and build armies, recruit friends as officers, buy weapons, and spy and attack on each other." 
name=description>
예제 #2
0
            }
        }
    }
    $sent = htmlspecialchars(trim($_POST['voc']), 0, 'UTF-8');
    if ($correct) {
        $answertext = "<p class=\"correct\"><span>Richtig</span><br />{$sent}</p>";
    } else {
        $answertext = "<p class=\"wrong\"><span>Falsch</span><br />{$sent}</p>";
    }
    $stats = getUserInfo($_SESSION['userid']);
    if ($correct) {
        $stats->correct++;
    } else {
        $stats->wrong++;
    }
    updateUserStats($_SESSION['userid'], $stats->correct, $stats->wrong);
    $_SESSION['userinfo'] = $stats;
    $answertext .= <<<EOT
<table class="voc list">
\t<tbody>
EOT;
    foreach ($_SESSION['vocs'] as $v) {
        $english = htmlspecialchars($v->english, 0, 'UTF-8');
        $german = htmlspecialchars($v->german, 0, 'UTF-8');
        $id = $v->id;
        $answertext .= <<<EOT
\t\t<tr>
\t\t\t<td><a href="{$SETTINGS['path']}/mod/{$id}">{$german}</a></td>
\t\t\t<td><a href="{$SETTINGS['path']}/mod/{$id}">{$english}</a></td>
\t\t</tr>
EOT;
예제 #3
0
            exit;
        }
        if (($taskID = isTaskRunning($conn)) == 0) {
            //if no task is running, create a new one.
            $taskID = createTask($conn, count($users));
        }
        if ($taskID != 0) {
            for ($i = getTaskUserCountProgress($conn, $taskID); $i < count($users); $i++) {
                //If time elapsed is more than 15 seconds, rerun the script to bypass PHP timeout
                if (time() - $startTime > 15) {
                    asyncExecuteScript('update_user_stats.php?action=continue');
                    exit('Script continuing on another process.');
                }
                updateTaskProgress($conn, $taskID, $users[$i]['id']);
                $newUserStats = fetchUserStatsFromKid($users[$i]['invite_url']);
                updateUserStats($conn, $users[$i]['username'], explode(';', $newUserStats)[0], explode(';', $newUserStats)[1]);
            }
            setTaskFinished($conn, $taskID, -1);
            exit('Update finished.');
        } else {
            exit('error : Couldn\'t create task in database.');
        }
    }
} else {
    exit('error : Couldn\'t connect to database.');
}
/**
 * The reason why we don't want sorting is because the script calls itself after having updated a few
 * users. This can change the index order.
 *
 * @param $conn
예제 #4
0
function setUserQuestionStatus($id, $user, $question, $usersStatusStr, $isCorrect)
{
    parse_str($usersStatusStr, $usersStatusAssoc);
    if ($isCorrect) {
        if ($usersStatusAssoc[$user] === "2") {
            $usersStatusAssoc[$user] = (string) ((int) $usersStatusAssoc[$user] + 1);
            updateQuestionDifficulty($id, $question, $usersStatusAssoc);
            updateUserStats($user, 2);
            updateGroupStats($user, 2);
        } else {
            $usersStatusAssoc[$user] = "1";
            updateQuestionDifficulty($id, $question, $usersStatusAssoc);
            updateUserStats($user, 1);
            updateGroupStats($user, 1);
        }
    } else {
        if ($usersStatusAssoc[$user] === "2") {
            $usersStatusAssoc[$user] = (string) ((int) $usersStatusAssoc[$user] + 2);
            updateQuestionDifficulty($id, $question, $usersStatusAssoc);
            updateUserStats($user, 0);
            updateGroupStats($user, 0);
        } else {
            $usersStatusAssoc[$user] = "2";
        }
    }
    $usersStatusStr = http_build_query($usersStatusAssoc);
    $query = "update " . $id . " set users_status='{$usersStatusStr}' where id='{$question}'";
    $mysqli = new mysqli("localhost", "root", "8PaHucre", "nuptse_questions");
    $mysqli->query($query);
    $mysqli->close();
}
예제 #5
0
파일: attack.php 프로젝트: Naddiseo/WW2Game
			$atdam = damageWeapons($_SESSION['isLogined'], 1, $radamage, $cgi['attacks'], $a);
			$atdamD = damageWeapons($_SESSION['isLogined'], 0, $radamage, $cgi['attacks'], $a);
			$acount = $atdam['count'];
			$atdam = round($atdam['per'], 2);
			$atdamD = round($atdamD['per'], 2);
		}
		$fields = "attackturns,attackStrength, defStrength, gold,  attackUsersKilled, defUsersKilled,	 
	 attackTrained, attackUnTrained, defTrained,defUnTrained, attackWeapons,defWeapons, time, attackWeaponCount, 
	 defWeaponCount, pergold,attackMercs, defMercs, defexp,attexp,attper,defper, userhost,defuserhost,	 
	 type, raeff ";
		$time = time();
		$values = "$cgi[attacks],$sa,$da,$gold,$attackUsersKilled,$defUsersKilled,$attackTrained,$attackUnTrained,
				$defTrained,$defUnTrained,'$atdam:$atdamD','$defdam:$defdamA',$time,$acount,$dcount,$pergold,$attackMercs,
				$defMercs,$defexp,$attexp,$saper,$daper,$userhost,$defuserhost,0," . round($radamage * 100, 2);
		updateUserStats($attacker);
		updateUserStats($defender);
		//addAttack($_SESSION['isLogined'],$cgi['id'],$fields,$values);
		$sql = "INSERT INTO AttackLog (userID,toUserID,$fields) VALUES ($_SESSION[isLogined],$cgi[id],$values);";
		//echo $sql;
		mysql_query($sql) or die(mysql_error() . "err");
		$attak = getAttackByUser1User2AndTime($_SESSION['isLogined'], $cgi['id'], $time, " ID ");
		header("Location: battlelog.php?id={$attak->ID}");
		exit;
	} else {
		$strErr = "You do not have enough turns.";
	}
} elseif ($cgi['defender_id']) {
	$cgi['id'] = $cgi['defender_id'];
	$attacker = getUserDetails($_SESSION['isLogined']);
	if ($cgi['numspies'] < 1.0) {
		$cgi['numspies'] = 1;
예제 #6
0
파일: vsys.php 프로젝트: Naddiseo/WW2Game
function Trainupgrade($user, $type) {
	global $cgi, $conf_use_savings;
	$user = getUserDetails($_SESSION["isLogined"], 'ID,calevel,gold,race,up,savings,sflevel,maxofficers,exp,bankper,weapper,hhlevel,nukelevel,scientists');
	if ($type == 'spy') {
		$pris = pow(2, $user->calevel) * 12000;
		if ($pris <= ($user->gold)) {
			$q = mysql_query("update `UserDetails` set calevel=calevel+'1', gold=gold-'$pris' where ID='$user->ID' ");
			updateUserStats($user);
		} elseif ($pris <= ($user->savings) AND $conf_use_savings AND $cgi['c_savings']) {
			$q = mysql_query("update `UserDetails` set calevel=calevel+'1', savings=savings-'$pris' where ID='$user->ID' ");
			updateUserStats($user);
		} else {
			return 'NO GOLD LEFT!!!';
		}
	}
	if ($type == 'unit') {
		if ($user->race == 4) {
			$pris = ($user->up * 8500) + 10000;
		} else {
			$pris = ($user->up * 10000) + 10000;
		}
		if ($pris <= $user->gold) {
			$q = mysql_query("update `UserDetails` set up=up+'1', gold=gold-'$pris' where ID='$user->ID' ");
		} elseif ($pris <= $user->savings AND $conf_use_savings AND $cgi['c_savings']) {
			$q = mysql_query("update `UserDetails` set up=up+'1', savings=savings-'$pris' where ID='$user->ID' ");
		} else {
			return 'NO GOLD LEFT!!!';
		}
	}
	if ($type == 'sf') {
		$pris = pow(2, $user->sflevel) * 100000 + 100000;
		if ($pris <= ($user->gold)) {
			$q = mysql_query("update `UserDetails` set sflevel=sflevel+'1', gold=gold-'$pris' where ID='$user->ID' ");
			updateUserStats($user);
		} elseif ($pris <= ($user->savings) AND $conf_use_savings AND $cgi['c_savings']) {
			$q = mysql_query("update `UserDetails` set sflevel=sflevel+'1', savings=savings-'$pris' where ID='$user->ID' ");
			updateUserStats($user);
		} else {
			return 'NO GOLD LEFT!!!';
		}
	}
	if ($type == 'of') {
		if ($user->maxofficers >= 15) {
			return 'You cannot have more than 15 officers';
		}
		$pris = pow(2, floor($user->maxofficers / 2)) * 1000;
		if ($pris <= ($user->exp)) {
			$q = mysql_query("update `UserDetails` set maxofficers=maxofficers+'1', exp=exp-'$pris' where ID='$user->ID' ");
		}
		else {
			return 'NOT ENOUGH EXPERIENCE!!!';
		}
	}
	if ($type == 'b') {
		$pris = pow(3, (10 - $user->bankper)) * 1800 + 1500;
		if ($user->bankper == 1) {
			return "YOU CANNOT UPGRADE AGAIN!!!";
		}
		if ($pris <= ($user->exp)) $q = mysql_query("update `UserDetails` set bankper=bankper-'1', exp=exp-'$pris' where ID='$user->ID' ");
		else return 'NOT ENOUGH EXPERIENCE!!!';
	}
	if ($type == 'w') {
		$pris = pow(4, $user->weapper) * 1800 + 1500;
		if ($user->weapper == 4) {
			return "YOU CANNOT UPGRADE AGAIN!!!";
		}
		if ($pris <= ($user->exp)) {
			$q = mysql_query("update `UserDetails` set weapper=weapper+'1', exp=exp-'$pris' where ID='$user->ID' ");
			return 'Purchase successful';
		} else {
			return 'NOT ENOUGH EXPERIENCE!!!';
		}
	}
	if ($type == 'hh') {
		$pris = pow(2.5, $user->hhlevel) * 125000 + 112500;
		if ($pris <= ($user->gold)) {
			$q = mysql_query("update `UserDetails` set hhlevel=hhlevel+'1', gold=gold-'$pris' where ID='$user->ID' ");
			updateUserStats($user);
		} elseif ($pris <= ($user->savings) AND $conf_use_savings AND $cgi['c_savings']) {
			$q = mysql_query("update `UserDetails` set hhlevel=hhlevel+'1', savings=savings-'$pris' where ID='$user->ID' ");
			updateUserStats($user);
		} else {
			return 'NOT ENOUGH GOLD!!!';
		}
	}
	return 'Success';
}