<?php
session_start();
$pay_to_win = $_POST['paytowin'];
$race = $_POST['race'];
$gender = $_POST['gender'];
$_SESSION['pay_to_win'] = $pay_to_win;
$_SESSION['race'] = $race;
$_SESSION['gender'] = $gender;
print_r($_POST);
// echo "debug: you are passing pay to win = $pay_to_win, race = $race
// and gender = $gender";
if ($pay_to_win == "yes")
{
$strength = mt_rand(50,100);
$intelligence = mt_rand(0,50);
$agility =mt_rand(0,100);
$stamina = mt_rand(0,100);
$luck = mt_rand(50,100);
$charisma = mt_rand(0,100);
}
else
{
$strength = mt_rand(0,100);
$intelligence = mt_rand(0,100);
$agility =mt_rand(0,100);
$stamina = mt_rand(0,100);
$luck = mt_rand(50,100);
$charisma = mt_rand(0,100);
}
echo "<p>Strength: $strength </p>";
echo "<p>Intelligence: $intelligence </p>";
echo "<p>Agility: $agility </p>";
echo "<p>Stamina: $stamina </p>";
echo "<p>Luck: $luck </p>";
echo "<p>Charisma: $charisma </p>";
$_SESSION["strength"] = $strength;
$_SESSION["intelligence"] = $intelligence;
$_SESSION["agility"] = $agility;
$_SESSION["stamina"] = $stamina;
$_SESSION["luck"] = $luck;
$_SESSION["charisma"] = $charisma;
echo "<p>Please choose a class</p>";
$classes = ["Fighter","Wizard","Barbarian","Cleric","Hunter","Warlock","Chef"];
$premium_classes = ["Paladin","Monk","Chuck Norris"];
echo "<form action=\"char_gen_3.php\" method=\"post\">";
foreach ($classes as $i)
{
echo "<p> <input type=\"radio\" name=\"player_class\" value=\"$i\"> $i </p>";
}
if ($pay_to_win == "yes")
{
foreach ($premium_classes as $i)
{
echo "<p> <input type=\"radio\" name=\"player_class\" value=\"$i\"> $i </p>";
}
}
else
{
echo "<p>If you had premium, you would see premium classes here!</p>";
}
?>
<input type="submit" value="Onto step 3" />
</form>