<?php
include ('logue.php');
include ('entete2.php');
$sql = "SELECT pts,techanti_lvl,labo_lvl,ada_ressource,ura_ressource,fer_ressource,techanti_evolution FROM matgraph_users WHERE id='$planete' ";
$res = db_mysql_Query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error());
$row = mysql_fetch_array($res);
$sql2 = "SELECT techanti_lvl, techanti_evolution FROM matgraph_users WHERE id='$idlogin' ";
$res2 = db_mysql_Query($sql2)or die('erreur sql<br>'.$sql2.'<br>'.mysql_error());
$row2 = mysql_fetch_array($res2);
if ($row2[techanti_lvl] == "0") {
$Depense_techanti_fer = 1000;
$Depense_techanti_ada = 500;
$Depense_techanti_ura = 200;
}
else {
$Depense_techanti_fer = round((500 * ( bcpow( 2, ($row2[techanti_lvl] + 1),3))),0);
$Depense_techanti_ada = round((250 * ( bcpow( 2, ($row2[techanti_lvl] + 1),3))),0);
$Depense_techanti_ura = round((100 * ( bcpow( 2, ($row2[techanti_lvl] + 1),3))),0);
}
$New_fer_ressource = ($row[fer_ressource] + $Depense_techanti_fer) ;
$New_ada_ressource = ($row[ada_ressource] + $Depense_techanti_ada) ;
$New_ura_ressource = ($row[ura_ressource] + $Depense_techanti_ura) ;
if ($row2[techanti_evolution] != "0000-00-00 00:00:00" ) {
$sql = "UPDATE matgraph_users SET fer_ressource=$New_fer_ressource, ura_ressource=$New_ura_ressource, ada_ressource=$New_ada_ressource WHERE id='$planete'";
$res = db_mysql_Query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error());
$sql2 = "UPDATE matgraph_users SET techanti_evolution=\"0000-00-00 00:00:00\" , labo_util = '$planete' WHERE id='$idlogin'";
$res2 = db_mysql_Query($sql2)or die('erreur sql<br>'.$sql2.'<br>'.mysql_error()); }
echo '<script language="javascript" type="text/javascript">
<!--
window.location.replace("labo.php");
-->
</script>';
?>