<?php

$sql = "SELECT date FROM matgraph_users WHERE id='$planete' ";
$req = db_mysql_Query($sql);
$datetime = mysql_result($req,0);

ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetime, $thetime);
$time = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);

$diftempsdestruction = time() - $time;
$difheure = round($diftempsdestruction / 3600,1);

$sql = "
	SELECT fer_destruction, exfer_destruction, or_destruction, exor_destruction, ada_destruction,
	ura_destruction, labo_destruction, robo_destruction, siege_destruction, chantier_destruction,
	hangarfer_destruction, hangaror_destruction, hangarada_destruction, hangarura_destruction,
	silo_destruction, defense_destruction, mili_destruction
	FROM matgraph_users
	WHERE id='$planete' ";

$req = db_mysql_Query($sql);
$res = mysql_fetch_array($req);

// fer
//$sql = "SELECT fer_destruction FROM matgraph_users WHERE id='$planete' ";
//$req = db_mysql_Query($sql);
$datetimefer2 = $res['fer_destruction'];//mysql_result($req,0);

ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimefer2, $thetime);
$timefer2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);

$diftempsdestructionfer2 = time() - $timefer2;
$diftempsdestructionfer3 = $timefer2 - $time;
// exfer
//$sql = "SELECT exfer_destruction FROM matgraph_users WHERE id='$planete' ";
//$req = db_mysql_Query($sql);
$datetimeexfer2 = $res['exfer_destruction'];//mysql_result($req,0);

ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimeexfer2, $thetime);
$timeexfer2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);

$diftempsdestructionexfer2 = time() - $timeexfer2;
$diftempsdestructionexfer3 = $timeexfer2 - $time;
// or
//$sql = "SELECT or_destruction FROM matgraph_users WHERE id='$planete' ";
//$req = db_mysql_Query($sql);
$datetimeor2 = $res['or_destruction'];//mysql_result($req,0);

ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimeor2, $thetime);
$timeor2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);

$diftempsdestructionor2 = time() - $timeor2;
$diftempsdestructionor3 = $timeor2 - $time;
// exor
//$sql = "SELECT exor_destruction FROM matgraph_users WHERE id='$planete' ";
//$req = db_mysql_Query($sql);
$datetimeexor2 = $res['exor_destruction'];//mysql_result($req,0);

ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimeexor2, $thetime);
$timeexor2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);

$diftempsdestructionexor2 = time() - $timeexor2;
$diftempsdestructionexor3 = $timeexor2 - $time;
// ada
//$sql = "SELECT ada_destruction FROM matgraph_users WHERE id='$planete' ";
//$req = db_mysql_Query($sql);
$datetimeada2 = $res['ada_destruction'];//mysql_result($req,0);

ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimeada2, $thetime);
$timeada2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);

$diftempsdestructionada2 = time() - $timeada2;
$diftempsdestructionada3 = $timeada2 - $time;

//ura

//$sql = "SELECT ura_destruction FROM matgraph_users WHERE id='$planete' ";
//$req = db_mysql_Query($sql);
$datetimeura2 = $res['ura_destruction'];//mysql_result($req,0);

ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimeura2, $thetime);
$timeura2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);

$diftempsdestructionura2 = time() - $timeura2;
$diftempsdestructionura3 = $timeura2 - $time;

//labo

//$sql = "SELECT labo_destruction FROM matgraph_users WHERE id='$planete' ";
//$req = db_mysql_Query($sql);
$datetimelabo2 = $res['labo_destruction'];//mysql_result($req,0);
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimelabo2, $thetime);
$timelabo2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);
$diftempsdestructionlabo2 = time() - $timelabo2;
$diftempsdestructionlabo3 = $timelabo2 - $time;

//robo

//$sql = "SELECT robo_destruction FROM matgraph_users WHERE id='$planete' ";
//$req = db_mysql_Query($sql);
$datetimerobo2 = $res['robo_destruction'];//mysql_result($req,0);
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimerobo2, $thetime);
$timerobo2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);
$diftempsdestructionrobo2 = time() - $timerobo2;
$diftempsdestructionrobo3 = $timerobo2 - $time;

//siege

//$sql = "SELECT siege_destruction FROM matgraph_users WHERE id='$planete' ";
//$req = db_mysql_Query($sql);
$datetimesiege2 = $res['siege_destruction'];//mysql_result($req,0);
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimesiege2, $thetime);
$timesiege2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);
$diftempsdestructionsiege2 = time() - $timesiege2;
$diftempsdestructionsiege3 = $timesiege2 - $time;

//chantier

//$sql = "SELECT chantier_destruction FROM matgraph_users WHERE id='$planete' ";
//$req = db_mysql_Query($sql);
$datetimechantier2 = $res['chantier_destruction'];//mysql_result($req,0);
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimechantier2, $thetime);
$timechantier2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);
$diftempsdestructionchantier2 = time() - $timechantier2;
$diftempsdestructionchantier3 = $timechantier2 - $time;

//hangarfer

//$sql = "SELECT hangarfer_destruction FROM matgraph_users WHERE id='$planete' ";
//$req = db_mysql_Query($sql);
$datetimehangarfer2 = $res['hangarfer_destruction'];//mysql_result($req,0);
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimehangarfer2, $thetime);
$timehangarfer2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);
$diftempsdestructionhangarfer2 = time() - $timehangarfer2;
$diftempsdestructionhangarfer3 = $timehangarfer2 - $time;

//hangaror

//$sql = "SELECT hangaror_destruction FROM matgraph_users WHERE id='$planete' ";
//$req = db_mysql_Query($sql);
$datetimehangaror2 = $res['hangaror_destruction'];//mysql_result($req,0);
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimehangaror2, $thetime);
$timehangaror2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);
$diftempsdestructionhangaror2 = time() - $timehangaror2;
$diftempsdestructionhangaror3 = $timehangaror2 - $time;

//hangarada

//$sql = "SELECT hangarada_destruction FROM matgraph_users WHERE id='$planete' ";
//$req = db_mysql_Query($sql);
$datetimehangarada2 = $res['hangarada_destruction'];//mysql_result($req,0);
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimehangarada2, $thetime);
$timehangarada2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);
$diftempsdestructionhangarada2 = time() - $timehangarada2;
$diftempsdestructionhangarada3 = $timehangarada2 - $time;

//hangarura

//$sql = "SELECT hangarura_destruction FROM matgraph_users WHERE id='$planete' ";
//$req = db_mysql_Query($sql);
$datetimehangarura2 = $res['hangarura_destruction'];//mysql_result($req,0);
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimehangarura2, $thetime);
$timehangarura2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);
$diftempsdestructionhangarura2 = time() - $timehangarura2;
$diftempsdestructionhangarura3 = $timehangarura2 - $time;

//silo

//$sql = "SELECT silo_destruction FROM matgraph_users WHERE id='$planete' ";
//$req = db_mysql_Query($sql);
$datetimesilo2 = $res['silo_destruction'];//mysql_result($req,0);
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimesilo2, $thetime);
$timesilo2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);
$diftempsdestructionsilo2 = time() - $timesilo2;
$diftempsdestructionsilo3 = $timesilo2 - $time;

// defense
//$sql = "SELECT defense_destruction FROM matgraph_users WHERE id='$planete' ";
//$req = db_mysql_Query($sql);
$datetimedefense2 = $res['defense_destruction'];//mysql_result($req,0);
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimedefense2, $thetime);
$timedefense2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);
$diftempsdestructiondefense2 = time() - $timedefense2;
$diftempsdestructiondefense3 = $timedefense2 - $time;

// mili
//$sql = "SELECT mili_destruction FROM matgraph_users WHERE id='$planete' ";
//$req = db_mysql_Query($sql);
$datetimemili2 = $res['mili_destruction'];//mysql_result($req,0);
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimemili2, $thetime);
$timemili2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);
$diftempsdestructionmili2 = time() - $timemili2;
$diftempsdestructionmili3 = $timemili2 - $time;


?>