<?php

include('entete2.php');

$datetime = $row2[date];

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]);

$diftemps = time() - $time;
$difheure = round($diftemps / 3600,1);
// techenergie
$datetimetechenergie2 = $row2[techenergie_evolution];
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimetechenergie2, $thetime);
$timetechenergie2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);
$diftempstechenergie2 = time() - $timetechenergie2;

// techlaser
$datetimetechlaser2 = $row2[techlaser_evolution];
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimetechlaser2, $thetime);
$timetechlaser2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);
$diftempstechlaser2 = time() - $timetechlaser2;

// techions
$datetimetechions2 = $row2[techions_evolution];
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimetechions2, $thetime);
$timetechions2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);
$diftempstechions2 = time() - $timetechions2;

// techplasma
$datetimetechplasma2 = $row2[techplasma_evolution];
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimetechplasma2, $thetime);
$timetechplasma2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);
$diftempstechplasma2 = time() - $timetechplasma2;

// techordi
$datetimetechordi2 = $row2[techordi_evolution];
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimetechordi2, $thetime);
$timetechordi2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);
$diftempstechordi2 = time() - $timetechordi2;

// techcombustion
$datetimetechcombustion2 = $row2[techcombustion_evolution];
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimetechcombustion2, $thetime);
$timetechcombustion2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);
$diftempstechcombustion2 = time() - $timetechcombustion2;

// techAsgaards
$datetimetechAsgaards2 = $row2[techAsgaards_evolution];
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimetechAsgaards2, $thetime);
$timetechAsgaards2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);
$diftempstechAsgaards2 = time() - $timetechAsgaards2;

// techhyperespace
$datetimetechhyperespace2 = $row2[techhyperespace_evolution];
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimetechhyperespace2, $thetime);
$timetechhyperespace2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);
$diftempstechhyperespace2 = time() - $timetechhyperespace2;

// techhypernav
$datetimetechhypernav2 = $row2[techhypernav_evolution];
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimetechhypernav2, $thetime);
$timetechhypernav2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);
$diftempstechhypernav2 = time() - $timetechhypernav2;

// techespio1
$datetimetechespio12 = $row2[techespio1_evolution];
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimetechespio12, $thetime);
$timetechespio12 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);
$diftempstechespio12 = time() - $timetechespio12;

// techespio2
$datetimetechespio22 = $row2[techespio2_evolution];
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimetechespio22, $thetime);
$timetechespio22 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);
$diftempstechespio22 = time() - $timetechespio22;

// techArmement
$datetimetechArmement2 = $row2[techArmement_evolution];
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimetechArmement2, $thetime);
$timetechArmement2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);
$diftempstechArmement2 = time() - $timetechArmement2;

// techBouclier
$datetimetechBouclier2 = $row2[techBouclier_evolution];
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimetechBouclier2, $thetime);
$timetechBouclier2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);
$diftempstechBouclier2 = time() - $timetechBouclier2;

// techcoque
$datetimetechcoque2 = $row2[techcoque_evolution];
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimetechcoque2, $thetime);
$timetechcoque2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);
$diftempstechcoque2 = time() - $timetechcoque2;

// techproAsgaard
$datetimetechproAsgaard2 = $row2[techproAsgaard_evolution];
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimetechproAsgaard2, $thetime);
$timetechproAsgaard2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);
$diftempstechproAsgaard2 = time() - $timetechproAsgaard2;

// techproAncien
$datetimetechproAncien2 = $row2[techproAncien_evolution];
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimetechproAncien2, $thetime);
$timetechproAncien2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);
$diftempstechproAncien2 = time() - $timetechproAncien2;

// techinfra
$datetimetechinfra2 = $row2[techinfra_evolution];
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimetechinfra2, $thetime);
$timetechinfra2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);
$diftempstechinfra2 = time() - $timetechinfra2;

// technaqua
$datetimetechnaqua2 = $row2[technaqua_evolution];
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimetechnaqua2, $thetime);
$timetechnaqua2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);
$diftempstechnaqua2 = time() - $timetechnaqua2;

// techanti
$datetimetechanti2 = $row2[techanti_evolution];
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $datetimetechanti2, $thetime);
$timetechanti2 = mktime($thetime[4],$thetime[5],$thetime[6],$thetime[2],$thetime[3],$thetime[1]);
$diftempstechanti2 = time() - $timetechanti2;
///

// techenergie
if ($row2[techenergie_lvl] == "0") {
$Depense_techenergie_or = "800";
$Depense_techenergie_ada = "400";
}
else {
$Depense_techenergie_or = round((400 * ( bcpow( 2, ($row2[techenergie_lvl] + 1),3))),0);
$Depense_techenergie_ada = round((200 * ( bcpow( 2, ($row2[techenergie_lvl] + 1),3))),0);
}
if ($timetechenergie2 > 0 && $diftempstechenergie2 > 0){
$New_techenergie_lvl = $row2[techenergie_lvl] + 1 ;
$new_pts_tech= $Depense_techenergie_or + $Depense_techenergie_ada + $row2[pts_tech];
$sql = "UPDATE matgraph_users SET pts_tech=$new_pts_tech, techenergie_lvl=$New_techenergie_lvl, techenergie_evolution = \"0000-00-00 00:00:00\" WHERE id='$dataid[id]' ";
$res = db_mysql_Query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error());
$req = "SELECT id FROM matgraph_users WHERE idjoueur = $idlogin AND labo_util != 0 ORDER by id ASC";
$res = db_mysql_Query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row2 = mysql_fetch_array($res) ) {
$sql2 = "UPDATE matgraph_users SET labo_util = '0' WHERE id='$row2[id]' ";
$res2 = db_mysql_Query($sql2)or die('erreur sql<br>'.$sql2.'<br>'.mysql_error());
}}
}

// techlaser
if ($row2[techlaser_lvl] == "0") {
$Depense_techlaser_fer = "400";
$Depense_techlaser_or = "100";
}
else {
$Depense_techlaser_fer = round((200 * ( bcpow( 2, ($row2[techlaser_lvl] + 1),3))),0);
$Depense_techlaser_or = round((50 * ( bcpow( 2, ($row2[techlaser_lvl] + 1),3))),0);
}
if ($timetechlaser2 > 0 && $diftempstechlaser2 > 0){
$New_techlaser_lvl = $row2[techlaser_lvl] + 1 ;
$new_pts_tech= $Depense_techlaser_fer + $Depense_techlaser_or + $row2[pts_tech];
$sql = "UPDATE matgraph_users SET pts_tech=$new_pts_tech, techlaser_lvl=$New_techlaser_lvl, techlaser_evolution = \"0000-00-00 00:00:00\" WHERE id='$dataid[id]' ";
$res = db_mysql_Query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error());
$req = "SELECT id FROM matgraph_users WHERE idjoueur = $idlogin AND labo_util != 0 ORDER by id ASC";
$res = db_mysql_Query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row2 = mysql_fetch_array($res) ) {
$sql2 = "UPDATE matgraph_users SET labo_util = '0' WHERE id='$row2[id]' ";
$res2 = db_mysql_Query($sql2)or die('erreur sql<br>'.$sql2.'<br>'.mysql_error());
}}
}

// techions
if ($row2[techions_lvl] == "0") {
$Depense_techions_fer = "3000";
$Depense_techions_or = "900";
$Depense_techions_ada = "300";
}
else {
$Depense_techions_fer = round((1500 * ( bcpow( 2, ($row2[techions_lvl] + 1),3))),0);
$Depense_techions_or = round((450 * ( bcpow( 2, ($row2[techions_lvl] + 1),3))),0);
$Depense_techions_ada = round((150 * ( bcpow( 2, ($row2[techions_lvl] + 1),3))),0);
}
if ($timetechions2 > 0 && $diftempstechions2 > 0){
$New_techions_lvl = $row2[techions_lvl] + 1 ;
$new_pts_tech= $Depense_techions_fer + $Depense_techions_or + $Depense_techions_ada + $row2[pts_tech];
$sql = "UPDATE matgraph_users SET pts_tech=$new_pts_tech, techions_lvl=$New_techions_lvl, techions_evolution = \"0000-00-00 00:00:00\" WHERE id='$dataid[id]' ";
$res = db_mysql_Query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error());
$req = "SELECT id FROM matgraph_users WHERE idjoueur = $idlogin AND labo_util != 0 ORDER by id ASC";
$res = db_mysql_Query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row2 = mysql_fetch_array($res) ) {
$sql2 = "UPDATE matgraph_users SET labo_util = '0' WHERE id='$row2[id]' ";
$res2 = db_mysql_Query($sql2)or die('erreur sql<br>'.$sql2.'<br>'.mysql_error());
}}
}

// techplasma
if ($row2[techplasma_lvl] == "0") {
$Depense_techplasma_fer = "2000";
$Depense_techplasma_or = "4000";
$Depense_techplasma_ada = "1000";
}
else {
$Depense_techplasma_fer = round((1000 * ( bcpow( 2, ($row2[techplasma_lvl] + 1),3))),0);
$Depense_techplasma_or = round((2000 * ( bcpow( 2, ($row2[techplasma_lvl] + 1),3))),0);
$Depense_techplasma_ada = round((500 * ( bcpow( 2, ($row2[techplasma_lvl] + 1),3))),0);
}
if ($timetechplasma2 > 0 && $diftempstechplasma2 > 0){
$New_techplasma_lvl = $row2[techplasma_lvl] + 1 ;
$new_pts_tech= $Depense_techplasma_fer + $Depense_techplasma_or + $Depense_techplasma_ada + $row2[pts_tech];
$sql = "UPDATE matgraph_users SET pts_tech=$new_pts_tech, techplasma_lvl=$New_techplasma_lvl, techplasma_evolution = \"0000-00-00 00:00:00\" WHERE id='$dataid[id]' ";
$res = db_mysql_Query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error());
$req = "SELECT id FROM matgraph_users WHERE idjoueur = $idlogin AND labo_util != 0 ORDER by id ASC";
$res = db_mysql_Query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row2 = mysql_fetch_array($res) ) {
$sql2 = "UPDATE matgraph_users SET labo_util = '0' WHERE id='$row2[id]' ";
$res2 = db_mysql_Query($sql2)or die('erreur sql<br>'.$sql2.'<br>'.mysql_error());
}}
}

// techordi
if ($row2[techordi_lvl] == "0") {
$Depense_techordi_or = "400";
$Depense_techordi_ada = "600";
}
else {
$Depense_techordi_or = round((200 * ( bcpow( 2, ($row2[techordi_lvl] + 1),3))),0);
$Depense_techordi_ada = round((300 * ( bcpow( 2, ($row2[techordi_lvl] + 1),3))),0);
}
if ($timetechordi2 > 0 && $diftempstechordi2 > 0){
$New_techordi_lvl = $row2[techordi_lvl] + 1 ;
$new_pts_tech= $Depense_techordi_or + $Depense_techordi_ada + $row2[pts_tech];
$sql = "UPDATE matgraph_users SET pts_tech=$new_pts_tech, techordi_lvl=$New_techordi_lvl, techordi_evolution = \"0000-00-00 00:00:00\" WHERE id='$dataid[id]' ";
$res = db_mysql_Query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error());
$req = "SELECT id FROM matgraph_users WHERE idjoueur = $idlogin AND labo_util != 0 ORDER by id ASC";
$res = db_mysql_Query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row2 = mysql_fetch_array($res) ) {
$sql2 = "UPDATE matgraph_users SET labo_util = '0' WHERE id='$row2[id]' ";
$res2 = db_mysql_Query($sql2)or die('erreur sql<br>'.$sql2.'<br>'.mysql_error());
}}
}

// techcombustion
if ($row2[techcombustion_lvl] == "0") {
$Depense_techcombustion_fer = "2400";
$Depense_techcombustion_ada = "3600";
}
else {
$Depense_techcombustion_fer = round((1200 * ( bcpow( 2, ($row2[techcombustion_lvl] + 1),3))),0);
$Depense_techcombustion_ada = round((1800 * ( bcpow( 2, ($row2[techcombustion_lvl] + 1),3))),0);
}
if ($timetechcombustion2 > 0 && $diftempstechcombustion2 > 0){
$New_techcombustion_lvl = $row2[techcombustion_lvl] + 1 ;
$new_pts_tech= $Depense_techcombustion_fer + $Depense_techcombustion_ada + $row2[pts_tech];
$sql = "UPDATE matgraph_users SET pts_tech=$new_pts_tech, techcombustion_lvl=$New_techcombustion_lvl, techcombustion_evolution = \"0000-00-00 00:00:00\" WHERE id='$dataid[id]' ";
$res = db_mysql_Query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error());
$req = "SELECT id FROM matgraph_users WHERE idjoueur = $idlogin AND labo_util != 0 ORDER by id ASC";
$res = db_mysql_Query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row2 = mysql_fetch_array($res) ) {
$sql2 = "UPDATE matgraph_users SET labo_util = '0' WHERE id='$row2[id]' ";
$res2 = db_mysql_Query($sql2)or die('erreur sql<br>'.$sql2.'<br>'.mysql_error());
}}
}

// techAsgaards
if ($row2[techAsgaards_lvl] == "0") {
$Depense_techAsgaards_fer = "1000";
$Depense_techAsgaards_or = "2000";
$Depense_techAsgaards_ada = "300";
}
else {
$Depense_techAsgaards_fer = round((500 * ( bcpow( 2, ($row2[techAsgaards_lvl] + 1),3))),0);
$Depense_techAsgaards_or = round((1000 * ( bcpow( 2, ($row2[techAsgaards_lvl] + 1),3))),0);
$Depense_techAsgaards_ada = round((150 * ( bcpow( 2, ($row2[techAsgaards_lvl] + 1),3))),0);
}
if ($timetechAsgaards2 > 0 && $diftempstechAsgaards2 > 0){
$New_techAsgaards_lvl = $row2[techAsgaards_lvl] + 1 ;
$new_pts_tech= $Depense_techAsgaards_fer + $Depense_techAsgaards_or + $Depense_techAsgaards_ada + $row2[pts_tech];
$sql = "UPDATE matgraph_users SET pts_tech=$new_pts_tech, techAsgaards_lvl=$New_techAsgaards_lvl, techAsgaards_evolution = \"0000-00-00 00:00:00\" WHERE id='$dataid[id]' ";
$res = db_mysql_Query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error());
$req = "SELECT id FROM matgraph_users WHERE idjoueur = $idlogin AND labo_util != 0 ORDER by id ASC";
$res = db_mysql_Query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row2 = mysql_fetch_array($res) ) {
$sql2 = "UPDATE matgraph_users SET labo_util = '0' WHERE id='$row2[id]' ";
$res2 = db_mysql_Query($sql2)or die('erreur sql<br>'.$sql2.'<br>'.mysql_error());
}}
}

// techhyperespace
if ($row2[techhyperespace_lvl] == "0") {
$Depense_techhyperespace_or = "40000";
$Depense_techhyperespace_ada = "20000";
}
else {
$Depense_techhyperespace_or = round((20000 * ( bcpow( 2, ($row2[techhyperespace_lvl] + 1),3))),0);
$Depense_techhyperespace_ada = round((10000 * ( bcpow( 2, ($row2[techhyperespace_lvl] + 1),3))),0);
}
if ($timetechhyperespace2 > 0 && $diftempstechhyperespace2 > 0){
$New_techhyperespace_lvl = $row2[techhyperespace_lvl] + 1 ;
$new_pts_tech= $Depense_techhyperespace_or + $Depense_techhyperespace_ada + $row2[pts_tech];
$sql = "UPDATE matgraph_users SET pts_tech=$new_pts_tech, techhyperespace_lvl=$New_techhyperespace_lvl, techhyperespace_evolution = \"0000-00-00 00:00:00\" WHERE id='$dataid[id]' ";
$res = db_mysql_Query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error());
$req = "SELECT id FROM matgraph_users WHERE idjoueur = $idlogin AND labo_util != 0 ORDER by id ASC";
$res = db_mysql_Query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row2 = mysql_fetch_array($res) ) {
$sql2 = "UPDATE matgraph_users SET labo_util = '0' WHERE id='$row2[id]' ";
$res2 = db_mysql_Query($sql2)or die('erreur sql<br>'.$sql2.'<br>'.mysql_error());
}}
}
// techhypernav
if ($row2[techhypernav_lvl] == "0") {
	$Depense_techhypernav_fer = "100000";
	$Depense_techhypernav_or = "50000";
	$Depense_techhypernav_ada = "50000";
	$Depense_techhypernav_ura = "40000";
}else{
	$Depense_techhypernav_fer = round((50000 * ( bcpow( 2, ($row2[techhypernav_lvl] + 1),3))),0);
	$Depense_techhypernav_or = round((25000 * ( bcpow( 2, ($row2[techhypernav_lvl] + 1),3))),0);
	$Depense_techhypernav_ada = round((25000 * ( bcpow( 2, ($row2[techhypernav_lvl] + 1),3))),0);
	$Depense_techhypernav_ura = round((20000 * ( bcpow( 2, ($row2[techhypernav_lvl] + 1),3))),0);
}
if ($timetechhypernav2 > 0 && $diftempstechhypernav2 > 0){
	$New_techhypernav_lvl = $row2[techhypernav_lvl] + 1 ;
	$new_pts_tech= $Depense_techhypernav_fer + $Depense_techhypernav_or + $Depense_techhypernav_ada+ $Depense_techhypernav_ura + $row2[pts_tech];
	$sql = "UPDATE matgraph_users SET pts_tech=$new_pts_tech, techhypernav_lvl=$New_techhypernav_lvl, techhypernav_evolution = \"0000-00-00 00:00:00\" WHERE id='$dataid[id]' ";
	$res = db_mysql_Query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error());
	$req = "SELECT id FROM matgraph_users WHERE idjoueur = $idlogin AND labo_util != 0 ORDER by id ASC";
	$res = db_mysql_Query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
	$num = mysql_num_rows($res);
	if ( $num > 0 ) {
  		while ( $row2 = mysql_fetch_array($res) ) {
			$sql2 = "UPDATE matgraph_users SET labo_util = '0' WHERE id='$row2[id]' ";
			$res2 = db_mysql_Query($sql2)or die('erreur sql<br>'.$sql2.'<br>'.mysql_error());
		}
	}
}

// techespio1
if ($row2[techespio1_lvl] == "0") {
$Depense_techespio1_fer = "100";
$Depense_techespio1_or = "1000";
$Depense_techespio1_ada = "200";
}
else {
$Depense_techespio1_fer = round((50 * ( bcpow( 2, ($row2[techespio1_lvl] + 1),3))),0);
$Depense_techespio1_or = round((500 * ( bcpow( 2, ($row2[techespio1_lvl] + 1),3))),0);
$Depense_techespio1_ada = round((100 * ( bcpow( 2, ($row2[techespio1_lvl] + 1),3))),0);
}
if ($timetechespio12 > 0 && $diftempstechespio12 > 0){
$New_techespio1_lvl = $row2[techespio1_lvl] + 1 ;
$new_pts_tech= $Depense_techespio1_fer + $Depense_techespio1_or + $Depense_techespio1_ada + $row2[pts_tech];
$sql = "UPDATE matgraph_users SET pts_tech=$new_pts_tech, techespio1_lvl=$New_techespio1_lvl, techespio1_evolution = \"0000-00-00 00:00:00\" WHERE id='$dataid[id]' ";
$res = db_mysql_Query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error());
$req = "SELECT id FROM matgraph_users WHERE idjoueur = $idlogin AND labo_util != 0 ORDER by id ASC";
$res = db_mysql_Query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row2 = mysql_fetch_array($res) ) {
$sql2 = "UPDATE matgraph_users SET labo_util = '0' WHERE id='$row2[id]' ";
$res2 = db_mysql_Query($sql2)or die('erreur sql<br>'.$sql2.'<br>'.mysql_error());
}}
}

// techespio2
if ($row2[techespio2_lvl] == "0") {
$Depense_techespio2_fer = "400";
$Depense_techespio2_or = "2000";
$Depense_techespio2_ada = "500";
}
else {
$Depense_techespio2_fer = round((200 * ( bcpow( 2, ($row2[techespio1_lvl] + 1),3))),0);
$Depense_techespio2_or = round((1000 * ( bcpow( 2, ($row2[techespio2_lvl] + 1),3))),0);
$Depense_techespio2_ada = round((250 * ( bcpow( 2, ($row2[techespio2_lvl] + 1),3))),0);
}
if ($timetechespio22 > 0 && $diftempstechespio22 > 0){
$New_techespio2_lvl = $row2[techespio2_lvl] + 1 ;
$new_pts_tech= $Depense_techespio2_fer + $Depense_techespio2_or + $Depense_techespio2_ada + $row2[pts_tech];
$sql = "UPDATE matgraph_users SET pts_tech=$new_pts_tech, techespio2_lvl=$New_techespio2_lvl, techespio2_evolution = \"0000-00-00 00:00:00\" WHERE id='$dataid[id]' ";
$res = db_mysql_Query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error());
$req = "SELECT id FROM matgraph_users WHERE idjoueur = $idlogin AND labo_util != 0 ORDER by id ASC";
$res = db_mysql_Query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row2 = mysql_fetch_array($res) ) {
$sql2 = "UPDATE matgraph_users SET labo_util = '0' WHERE id='$row2[id]' ";
$res2 = db_mysql_Query($sql2)or die('erreur sql<br>'.$sql2.'<br>'.mysql_error());
}}
}

// techArmement
if ($row2[techArmement_lvl] == "0") {
$Depense_techArmement_fer = "400";
$Depense_techArmement_or = "200";
}
else {
$Depense_techArmement_fer = round((200 * ( bcpow( 2, ($row2[techArmement_lvl] + 1),3))),0);
$Depense_techArmement_or = round((100 * ( bcpow( 2, ($row2[techArmement_lvl] + 1),3))),0);
}
if ($timetechArmement2 > 0 && $diftempstechArmement2 > 0){
$New_techArmement_lvl = $row2[techArmement_lvl] + 1 ;
$new_pts_tech= $Depense_techArmement_fer + $Depense_techArmement_or + $row2[pts_tech];
$sql = "UPDATE matgraph_users SET pts_tech=$new_pts_tech, techArmement_lvl=$New_techArmement_lvl, techArmement_evolution = \"0000-00-00 00:00:00\" WHERE id='$dataid[id]' ";
$res = db_mysql_Query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error());
$req = "SELECT id FROM matgraph_users WHERE idjoueur = $idlogin AND labo_util != 0 ORDER by id ASC";
$res = db_mysql_Query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row2 = mysql_fetch_array($res) ) {
$sql2 = "UPDATE matgraph_users SET labo_util = '0' WHERE id='$row2[id]' ";
$res2 = db_mysql_Query($sql2)or die('erreur sql<br>'.$sql2.'<br>'.mysql_error());
}}
}

// techBouclier
if ($row2[techBouclier_lvl] == "0") {
$Depense_techBouclier_fer = "400";
$Depense_techBouclier_or = "300";
$Depense_techBouclier_ada = "75";
}
else {
$Depense_techBouclier_fer = round((200 * ( bcpow( 2, ($row2[techBouclier_lvl] + 1),3))),0);
$Depense_techBouclier_or = round((150 * ( bcpow( 2, ($row2[techBouclier_lvl] + 1),3))),0);
$Depense_techBouclier_ada = round((37.5 * ( bcpow( 2, ($row2[techBouclier_lvl] + 1),3))),0);
}
if ($timetechBouclier2 > 0 && $diftempstechBouclier2 > 0){
$New_techBouclier_lvl = $row2[techBouclier_lvl] + 1 ;
$new_pts_tech= $Depense_techBouclier_fer + $Depense_techBouclier_or + $Depense_techBouclier_ada + $row2[pts_tech];
$sql = "UPDATE matgraph_users SET pts_tech=$new_pts_tech, techBouclier_lvl=$New_techBouclier_lvl, techBouclier_evolution = \"0000-00-00 00:00:00\" WHERE id='$dataid[id]' ";
$res = db_mysql_Query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error());
$req = "SELECT id FROM matgraph_users WHERE idjoueur = $idlogin AND labo_util != 0 ORDER by id ASC";
$res = db_mysql_Query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row2 = mysql_fetch_array($res) ) {
$sql2 = "UPDATE matgraph_users SET labo_util = '0' WHERE id='$row2[id]' ";
$res2 = db_mysql_Query($sql2)or die('erreur sql<br>'.$sql2.'<br>'.mysql_error());
}}
}

// techcoque
if ($row2[techcoque_lvl] == "0") {
$Depense_techcoque_fer = "800";
}
else {
$Depense_techcoque_fer = round((400 * ( bcpow( 2, ($row2[techcoque_lvl] + 1),3))),0);
}
if ($timetechcoque2 > 0 && $diftempstechcoque2 > 0){
$New_techcoque_lvl = $row2[techcoque_lvl] + 1 ;
$new_pts_tech= $Depense_techcoque_fer + $row2[pts_tech];
$sql = "UPDATE matgraph_users SET pts_tech=$new_pts_tech, techcoque_lvl=$New_techcoque_lvl, techcoque_evolution = \"0000-00-00 00:00:00\" WHERE id='$dataid[id]' ";
$res = db_mysql_Query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error());
$req = "SELECT id FROM matgraph_users WHERE idjoueur = $idlogin AND labo_util != 0 ORDER by id ASC";
$res = db_mysql_Query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row2 = mysql_fetch_array($res) ) {
$sql2 = "UPDATE matgraph_users SET labo_util = '0' WHERE id='$row2[id]' ";
$res2 = db_mysql_Query($sql2)or die('erreur sql<br>'.$sql2.'<br>'.mysql_error());
}}
}

// techproAsgaard
if ($row2[techproAsgaard_lvl] == "0") {
$Depense_techproAsgaard_fer = "200";
$Depense_techproAsgaard_or = "200";
$Depense_techproAsgaard_ada = "200";
$Depense_techproAsgaard_ura = "10";
}
else {
$Depense_techproAsgaard_fer = round((100 * ( bcpow( 2, ($row2[techproAsgaard_lvl] + 1),3))),0);
$Depense_techproAsgaard_or = round((100 * ( bcpow( 2, ($row2[techproAsgaard_lvl] + 1),3))),0);
$Depense_techproAsgaard_ada = round((100 * ( bcpow( 2, ($row2[techproAsgaard_lvl] + 1),3))),0);
$Depense_techproAsgaard_ura = round((5 * ( bcpow( 2, ($row2[techproAsgaard_lvl] + 1),3))),0);
}
if ($timetechproAsgaard2 > 0 && $diftempstechproAsgaard2 > 0){
$New_techproAsgaard_lvl = $row2[techproAsgaard_lvl] + 1 ;
$new_pts_tech= $Depense_techproAsgaard_fer + $row2[pts_tech];
$sql = "UPDATE matgraph_users SET pts_tech=$new_pts_tech, techproAsgaard_lvl=$New_techproAsgaard_lvl, techproAsgaard_evolution = \"0000-00-00 00:00:00\" WHERE id='$dataid[id]' ";
$res = db_mysql_Query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error());
$req = "SELECT id FROM matgraph_users WHERE idjoueur = $idlogin AND labo_util != 0 ORDER by id ASC";
$res = db_mysql_Query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row2 = mysql_fetch_array($res) ) {
$sql2 = "UPDATE matgraph_users SET labo_util = '0' WHERE id='$row2[id]' ";
$res2 = db_mysql_Query($sql2)or die('erreur sql<br>'.$sql2.'<br>'.mysql_error());
}}
}

// techproAncien
if ($row2[techproAncien_lvl] == "0") {
$Depense_techproAncien_fer = "8000";
$Depense_techproAncien_ada = "8000";
}
else {
$Depense_techproAncien_fer = round((4000 * ( bcpow( 2, ($row2[techproAncien_lvl] + 1),3))),0);
$Depense_techproAncien_ada = round((4000 * ( bcpow( 2, ($row2[techproAncien_lvl] + 1),3))),0);
}
if ($timetechproAncien2 > 0 && $diftempstechproAncien2 > 0){
$New_techproAncien_lvl = $row2[techproAncien_lvl] + 1 ;
$new_pts_tech= $Depense_techproAncien_fer + $Depense_techproAncien_ada + $row2[pts_tech];
$sql = "UPDATE matgraph_users SET pts_tech=$new_pts_tech, techproAncien_lvl=$New_techproAncien_lvl, techproAncien_evolution = \"0000-00-00 00:00:00\" WHERE id='$dataid[id]' ";
$res = db_mysql_Query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error());
$req = "SELECT id FROM matgraph_users WHERE idjoueur = $idlogin AND labo_util != 0 ORDER by id ASC";
$res = db_mysql_Query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row2 = mysql_fetch_array($res) ) {
$sql2 = "UPDATE matgraph_users SET labo_util = '0' WHERE id='$row2[id]' ";
$res2 = db_mysql_Query($sql2)or die('erreur sql<br>'.$sql2.'<br>'.mysql_error());
}}
}

// techinfra
if ($row2[techinfra_lvl] == "0") {
$Depense_techinfra_fer = "560";
$Depense_techinfra_or = "225";
$Depense_techinfra_ada = "60";
}
else {
$Depense_techinfra_fer = round((280 * ( bcpow( 2, ($row2[techinfra_lvl] + 1),3))),0);
$Depense_techinfra_or = round((112.5 * ( bcpow( 2, ($row2[techinfra_lvl] + 1),3))),0);
$Depense_techinfra_ada = round((30 * ( bcpow( 2, ($row2[techinfra_lvl] + 1),3))),0);
}
if ($timetechinfra2 > 0 && $diftempstechinfra2 > 0){
$New_techinfra_lvl = $row2[techinfra_lvl] + 1 ;
$new_pts_tech= $Depense_techinfra_fer + $Depense_techinfra_or + $Depense_techinfra_ada + $row2[pts_tech];
$sql = "UPDATE matgraph_users SET pts_tech=$new_pts_tech, techinfra_lvl=$New_techinfra_lvl, techinfra_evolution = \"0000-00-00 00:00:00\" WHERE id='$dataid[id]' ";
$res = db_mysql_Query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error());
$req = "SELECT id FROM matgraph_users WHERE idjoueur = $idlogin AND labo_util != 0 ORDER by id ASC";
$res = db_mysql_Query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row2 = mysql_fetch_array($res) ) {
$sql2 = "UPDATE matgraph_users SET labo_util = '0' WHERE id='$row2[id]' ";
$res2 = db_mysql_Query($sql2)or die('erreur sql<br>'.$sql2.'<br>'.mysql_error());
}}
}

// technaqua
if ($row2[technaqua_lvl] == "0") {
$Depense_technaqua_fer = "4000";
$Depense_technaqua_ura = "2500";
}
else {
$Depense_technaqua_fer = round((2000 * ( bcpow( 2, ($row2[technaqua_lvl] + 1),3))),0);
$Depense_technaqua_ura = round((1250 * ( bcpow( 2, ($row2[technaqua_lvl] + 1),3))),0);
}
if ($timetechnaqua2 > 0 && $diftempstechnaqua2 > 0){
$New_technaqua_lvl = $row2[technaqua_lvl] + 1 ;
$new_pts_tech= $Depense_technaqua_fer + $Depense_technaqua_ura + $row2[pts_tech];
$sql = "UPDATE matgraph_users SET pts_tech=$new_pts_tech, technaqua_lvl=$New_technaqua_lvl, technaqua_evolution = \"0000-00-00 00:00:00\" WHERE id='$dataid[id]' ";
$res = db_mysql_Query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error());
$req = "SELECT id FROM matgraph_users WHERE idjoueur = $idlogin AND labo_util != 0 ORDER by id ASC";
$res = db_mysql_Query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row2 = mysql_fetch_array($res) ) {
$sql2 = "UPDATE matgraph_users SET labo_util = '0' WHERE id='$row2[id]' ";
$res2 = db_mysql_Query($sql2)or die('erreur sql<br>'.$sql2.'<br>'.mysql_error());
}}
}
// techanti
if ($row2[techanti_lvl] == "0") {
$Depense_techanti_fer = 1000;
$Depense_techanti_ada = 500;
$Depense_techanti_ura = 200;
}
else {
$Depense_techanti_fer = round((500 * ( bcpow( 2, ($row2[techanti_lvl] + 1),3))),0);
$Depense_techanti_ada = round((250 * ( bcpow( 2, ($row2[techanti_lvl] + 1),3))),0);
$Depense_techanti_ura = round((100 * ( bcpow( 2, ($row2[techanti_lvl] + 1),3))),0);
}
if ($timetechanti2 > 0 && $diftempstechanti2 > 0){
$New_techanti_lvl = $row2[techanti_lvl] + 1 ;
$new_pts_tech= $Depense_techanti_fer + $Depense_techanti_ada + $Depense_techanti_ura + $row2[pts_tech];
$sql = "UPDATE matgraph_users SET pts_tech=$new_pts_tech, techanti_lvl=$New_techanti_lvl, techanti_evolution = \"0000-00-00 00:00:00\" WHERE id='$dataid[id]' ";
$res = db_mysql_Query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error());
$req = "SELECT id FROM matgraph_users WHERE idjoueur = $idlogin AND labo_util != 0 ORDER by id ASC";
$res = db_mysql_Query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row2 = mysql_fetch_array($res) ) {
$sql2 = "UPDATE matgraph_users SET labo_util = '0' WHERE id='$row2[id]' ";
$res2 = db_mysql_Query($sql2)or die('erreur sql<br>'.$sql2.'<br>'.mysql_error());
}}
}
?>