<commit_before>﻿<?php
	include('session.php');
	echo "fetch2    " .	$fetch2['session'] . "<br>";
	echo "session2  " . $session2 . "<br>" ;
	echo "session3  " . $session3 . "<br>" ;
	$diff=$session3-$fetch2['session'];
	echo "Diffrence " . $diff . "<br>" ;
	
	echo "query2    " . $query2  . "<br>";

?>

<html>
   
   <head>
      <title>Welcome to Buy Ships</title>
   </head>
   	<body>
	<h1>Welcome <?php echo $login_session; ?></h1>
<?php
	$resources = "SELECT metal, fuel, money , diamond FROM Base, Account 
	WHERE Account.name='$user_check' and Account.base=Base.base";
	$resources2=$con->query($resources);
	while($resources3 = $resources2->fetch_assoc()) {
		echo "Your Current resources: Metal <B>" . $resources3["metal"] . "</B> Fuel <B>" . $resources3["fuel"] . 
		"</B> Diamond <B>" . $resources3["diamond"] . "</B> Money <B>" . $resources3["money"]	. "</B><br>" ;
	}
	$resources2->close();
?>
        <h2>Ships that you can buy</h2>
        <?php
        $buy_avaible = "Select name_id, firepower, shield, hull, prize_metal, prize_fuel, prize_diamond,
        prize_cash from Ship, Base, Account
        where Account.base=Base.base  and Base.money>=Ship.prize_cash and Account.name='$user_check'";
        $buy_avaible2=$con->query($buy_avaible);
        echo "<table border=1><tr><td>Avaible Ships: </td><td>Firepower</td><td>Shield</td><td>Hull</td>
        <td>Metal</td><td>Fuel</td><td>Diamond</td><td>Cash</td>\t";
        while($buy_avaible3 = $buy_avaible2->fetch_row()) {
        echo "<tr><td>"
        . $buy_avaible3[0] . "</td><td>" . $buy_avaible3[1] . "</td><td>" . $buy_avaible3[2] .  "</td><td>"
        . $buy_avaible3[3] . "</td><td>" . $buy_avaible3[4] . "</td><td>" . $buy_avaible3[5] . "</td><td>"
        . $buy_avaible3[6] . "</td><td>" . $buy_avaible3[7] . "</td><td>
		<form action = '' method = 'post'><input type ='submit' value = 'buy'/></form></td></tr>" ;
        }
        echo "</tr></table>";
		
	$buy_avaible2->close();

if($_SERVER["REQUEST_METHOD"] == "POST") {
// 	Tarkita mihin fleet kuuluu login_user
	#$query_buy= "INSERT INTO tzcrew.Fleet (`id`, `fleet`, `ship`, `damage`) VALUES ('', $fetch_buy, $buy_avaible3[0], '0') where Account.base=Base.base and Base.fleet=Fleet.fleet and Account.name='$user_check'";
	$query_buy= "INSERT INTO Fleet(fleet, ship, damage) VALUES ('fleet1', '$buy_avaible3[0]', '0')";
	$result_buy=$con->query($query_buy);
	#$fetch_buy = mysqli_fetch_assoc($result_buy);
	#$name_buy = $fetch_buy["fleet"];
	
	}
?>	
	<h2><a href="welcome.php">Welcome link</a></h2>
	<h2><a href="build.php">Build link</a></h2>
	<h2><a href="logout.php">Sign Out</a></h2>
   </body>
 
</html><commit_msg>Still try get working buy.php<commit_after>﻿<?php
	include('session.php');
	echo "fetch2    " .	$fetch2['session'] . "<br>";
	echo "session2  " . $session2 . "<br>" ;
	echo "session3  " . $session3 . "<br>" ;
	$diff=$session3-$fetch2['session'];
	echo "Diffrence " . $diff . "<br>" ;
	
	echo "query2    " . $query2  . "<br>";

?>

<html>
   
   <head>
      <title>Welcome to Buy Ships</title>
   </head>
   	<body>
	<h1>Welcome <?php echo $login_session; ?></h1>
<?php
	$resources = "SELECT metal, fuel, money , diamond FROM Base, Account 
	WHERE Account.name='$user_check' and Account.base=Base.base";
	$resources2=$con->query($resources);
	while($resources3 = $resources2->fetch_assoc()) {
		echo "Your Current resources: Metal <B>" . $resources3["metal"] . "</B> Fuel <B>" . $resources3["fuel"] . 
		"</B> Diamond <B>" . $resources3["diamond"] . "</B> Money <B>" . $resources3["money"]	. "</B><br>" ;
	}
	$resources2->close();
?>
        <h2>Ships that you can buy</h2>
        <?php
        $buy_avaible = "Select name_id, firepower, shield, hull, prize_metal, prize_fuel, prize_diamond,
        prize_cash from Ship, Base, Account
        where Account.base=Base.base  and Base.money>=Ship.prize_cash and Account.name='$user_check'";
        $buy_avaible2=$con->query($buy_avaible);
        echo "<table border=1><tr><td>Avaible Ships: </td><td>Firepower</td><td>Shield</td><td>Hull</td>
        <td>Metal</td><td>Fuel</td><td>Diamond</td><td>Cash</td>\t";
		$buy_list3=0;
        while($buy_avaible3 = $buy_avaible2->fetch_row()) {
        echo "<tr><td>"
        . $buy_avaible3[0] . "</td><td>" . $buy_avaible3[1] . "</td><td>" . $buy_avaible3[2] .  "</td><td>"
        . $buy_avaible3[3] . "</td><td>" . $buy_avaible3[4] . "</td><td>" . $buy_avaible3[5] . "</td><td>"
        . $buy_avaible3[6] . "</td><td>" . $buy_avaible3[7] . "</td><td>
		<form action = '' method = 'post'><input type ='submit' value = '$buy_list3'/></form></td></tr>" ;

		$buy_list3=$buy_list3++;
        }
        echo "</tr></table>";
		
	$buy_avaible2->close();

		//Listauksen jälkeen jokaiselle laivalle "oma tunniste" josta sitten se ostaa oikean
		if($_SERVER["REQUEST_METHOD"] == "POST") {
		$buy_avaible3sql=$buy_avaible3[0];
	// 	Tarkita mihin fleet kuuluu login_user
		#$query_buy= "INSERT INTO tzcrew.Fleet (`id`, `fleet`, `ship`, `damage`) VALUES ('', $fetch_buy, $buy_avaible3[0], '0') where Account.base=Base.base and Base.fleet=Fleet.fleet and Account.name='$user_check'";
		$query_buy= "INSERT INTO Fleet(fleet, ship, damage) VALUES ('fleet1', '$buy_avaible3sql', '0')";
		$result_buy=$con->query($query_buy);
		#$fetch_buy = mysqli_fetch_assoc($result_buy);
		#$name_buy = $fetch_buy["fleet"];
	
		}

?>	
	<h2><a href="welcome.php">Welcome link</a></h2>
	<h2><a href="build.php">Build link</a></h2>
	<h2><a href="logout.php">Sign Out</a></h2>
   </body>
 
</html>
{'fraction_non_alphanumeric': 0.22598154514203003, 'fraction_numerical': 0.02153066763162656, 'mean_word_length': 3.7944492627927144, 'pattern_counts': {'":': 0, '<': 173, '<?xml version=': 0, '>': 189, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '267071', 'n_tokens_mistral': 2312, 'n_tokens_neox': 2148, 'n_words': 395}