<?php
include ('logue.php'); 
include ('entete2.php');
include ('evolutionbats.php');
include ('siege.php');
$sql = "SELECT defense_lvl,robo_lvl,fer_ressource,or_ressource,ada_ressource 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); 

$temps1defense = (650 / 3  * (bcpow(1.35, ($row[defense_lvl]),3)));
if ($row[robo_lvl] == "0") {
$defense_destruction =  strftime("%Y-%m-%d %H:%M:%S", time()+ (round($temps1defense)));
}
else {
$defense_destruction =  strftime("%Y-%m-%d %H:%M:%S", time()+ (round($temps1defense* $siege_temps_evolution * (bcpow(0.9, $row[robo_lvl],3)))));
} 
if($row['defense_lvl'] >0){
if ($evolution < 0) {
$sql = "UPDATE matgraph_users SET defense_destruction='$defense_destruction' 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>';
?>