<?php
include ('logue.php'); 
include ('entete2.php');
include ('evolutionbats.php');
include ('siege.php');

$sql = "SELECT pts,ura_lvl,fission_lvl,ura_energie,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); 
// fission
if ($row[fission_lvl] =="0") {
$fission_lvl = "0";
}
else {
$fission_lvl = $row[fission_lvl];
}
// ura
if ($row[ura_lvl] =="0") {
$ura_lvl = "0";
}
else {
$ura_lvl = $row[ura_lvl];
}
$temps1ura = (600 / 3  * (bcpow(1.4, ($row[ura_lvl]),3)));
if ($row[robo_lvl] == "0") {
$ura_destruction = strftime("%Y-%m-%d %H:%M:%S", time()+ (round($temps1ura)));
}
else {
$ura_destruction = strftime("%Y-%m-%d %H:%M:%S", time()+ (round($temps1ura* $siege_temps_evolution * (bcpow(0.9, $row[robo_lvl],3)))));
} 

if($ura_lvl == 5) {
if($fission_lvl > 0) {
$valid = "no"; }
else {
$valid = "yes"; }}
else {
$valid = "yes"; }
if($ura_lvl > 0 AND $valid == "yes" ) {
if ($evolution < 0) {
$sql = "UPDATE matgraph_users SET ura_destruction='$ura_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>';
?>