<?php
include ('logue.php'); 
include ('entete2.php');
$sql = "SELECT pts,exfer_lvl,exfer_energie,exfer_evolution,robo_lvl,fer_ressource,or_ressource,ada_ressource,exfer_evolution FROM matgraph_users WHERE id='$planete' ";
$res = mysql_query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error());
$row = mysql_fetch_array($res); 
if ($row[exfer_lvl] =="0") {
$Depense_fer_ressource = "35000";
$Depense_or_ressource = "15000";
$Depense_ada_ressource = "1000";
}
else {
$Depense_fer_ressource = round((30000 * ( bcpow( 1.2, ($row[exfer_lvl] + 1),3))),0);
$Depense_or_ressource = round((20000 * ( bcpow( 1.2, ($row[exfer_lvl] + 1)))),0);
$Depense_ada_ressource = round((1000 * ( bcpow( 1.2, ($row[exfer_lvl] + 1)))),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[exfer_evolution] != "0000-00-00 00:00:00" ) {
$sql = "UPDATE matgraph_users SET exfer_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 = 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>';
?>