<?php
include ('logue.php'); 
include ('entete2.php');
$sql = "SELECT pts,chantier_lvl,robo_lvl,fer_ressource,or_ressource,ada_ressource,chantier_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); 
if ($row[chantier_lvl] =="0") {
$Depense_fer_ressource = "100";
$Depense_or_ressource = "200";
$Depense_ada_ressource = "100";
}
else {
$Depense_fer_ressource = round((100 * ( bcpow( 1.9, ($row[chantier_lvl] + 1),3))),0);
$Depense_or_ressource = round((200 * ( bcpow( 1.9, ($row[chantier_lvl] + 1),3))),0);
$Depense_ada_ressource = round((100 * ( bcpow( 1.9, ($row[chantier_lvl] + 1),3))),0);
}
$New_fer_ressource = ($row[fer_ressource] + $Depense_fer_ressource) ;
$New_or_ressource = ($row[or_ressource] + $Depense_or_ressource) ;
$New_ada_ressource = ($row[ada_ressource] + $Depense_ada_ressource) ;
if ($row[chantier_evolution] != "0000-00-00 00:00:00" ) {
$sql = "UPDATE matgraph_users SET chantier_evolution=\"0000-00-00 00:00:00\", fer_ressource=$New_fer_ressource, or_ressource=$New_or_ressource, ada_ressource=$New_ada_ressource WHERE id='$planete'";
$res = db_mysql_Query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error()); }
echo '<script language="javascript" type="text/javascript">
<!--
window.location.replace("batiments.php");
-->
</script>';
?>