<?php
session_start();
include ('private/mysql.php');
include ('tmp/head.php');

if($user['voda']!=='5' and $user['voda']!=='10' and $user['voda']!=='15' and $user['voda']!=='20' and $user['voda']!=='25' and $user['voda']!=='30' and $user['voda']!=='35' and $user['voda']!=='40' and $user['voda']!=='45' and $user['voda']!=='50' and $user['voda']!=='55' and $user['voda']!=='60' and $user['voda']!=='65' and $user['voda']!=='70' and $user['voda']!=='75' and $user['voda']!=='79'){
    $cs3 = round((500+($user['voda']*1000))*2);
    $voda = "<img src='img/silver.png' width='14'> $cs3";
}else{
    if($user['voda']=='5'){$cs3=2;}
    if($user['voda']=='10'){$cs3=4;}
    if($user['voda']=='15'){$cs3=6;}
    if($user['voda']=='20'){$cs3=10;}
    if($user['voda']=='25'){$cs3=14;}
    if($user['voda']=='30'){$cs3=18;}
    if($user['voda']=='35'){$cs3=24;}
    if($user['voda']=='40'){$cs3=30;}
    if($user['voda']=='45'){$cs3=36;}
    if($user['voda']=='50'){$cs3=42;}
    if($user['voda']=='55'){$cs3=50;}
    if($user['voda']=='60'){$cs3=58;}
    if($user['voda']=='65'){$cs3=66;}
    if($user['voda']=='70'){$cs3=74;}
    if($user['voda']=='75'){$cs3=84;}
    if($user['voda']=='79'){$cs3=100;}
    $voda = "<img src='img/almaz.png' width='14'> $cs3";
}

if($user['haos']!=='5' and $user['haos']!=='10' and $user['haos']!=='15' and $user['haos']!=='20' and $user['haos']!=='25' and $user['haos']!=='30' and $user['haos']!=='35' and $user['haos']!=='40' and $user['haos']!=='45' and $user['haos']!=='50' and $user['haos']!=='55' and $user['haos']!=='60' and $user['haos']!=='65' and $user['haos']!=='70' and $user['haos']!=='75' and $user['haos']!=='79'){
    $cs2 = round((500+($user['haos']*1000))*2);
    $haos = "<img src='img/silver.png' width='14'> $cs2";
}else{
    if($user['haos']=='5'){$cs2=2;}
    if($user['haos']=='10'){$cs2=4;}
    if($user['haos']=='15'){$cs2=6;}
    if($user['haos']=='20'){$cs2=10;}
    if($user['haos']=='25'){$cs2=14;}
    if($user['haos']=='30'){$cs2=18;}
    if($user['haos']=='35'){$cs2=24;}
    if($user['haos']=='40'){$cs2=30;}
    if($user['haos']=='45'){$cs2=36;}
    if($user['haos']=='50'){$cs2=42;}
    if($user['haos']=='55'){$cs2=50;}
    if($user['haos']=='60'){$cs2=58;}
    if($user['haos']=='65'){$cs2=66;}
    if($user['haos']=='70'){$cs2=74;}
    if($user['haos']=='75'){$cs2=84;}
    if($user['haos']=='79'){$cs2=100;}
    $haos = "<img src='img/almaz.png' width='14'> $cs2";
}

if($user['fire']!=='5' and $user['fire']!=='10' and $user['fire']!=='15' and $user['fire']!=='20' and $user['fire']!=='25' and $user['fire']!=='30' and $user['fire']!=='35' and $user['fire']!=='40' and $user['fire']!=='45' and $user['fire']!=='50' and $user['fire']!=='55' and $user['fire']!=='60' and $user['fire']!=='65' and $user['fire']!=='70' and $user['fire']!=='75' and $user['fire']!=='79'){
    $cs1 = round((500+($user['fire']*1000))*2);
    $fire = "<img src='img/silver.png' width='14'> $cs1";
}else{
    if($user['fire']=='5'){$cs1=2;}
    if($user['fire']=='10'){$cs1=4;}
    if($user['fire']=='15'){$cs1=6;}
    if($user['fire']=='20'){$cs1=10;}
    if($user['fire']=='25'){$cs1=14;}
    if($user['fire']=='30'){$cs1=18;}
    if($user['fire']=='35'){$cs1=24;}
    if($user['fire']=='40'){$cs1=30;}
    if($user['fire']=='45'){$cs1=36;}
    if($user['fire']=='50'){$cs1=42;}
    if($user['fire']=='55'){$cs1=50;}
    if($user['fire']=='60'){$cs1=58;}
    if($user['fire']=='65'){$cs1=66;}
    if($user['fire']=='70'){$cs1=74;}
    if($user['fire']=='75'){$cs1=84;}
    if($user['fire']=='79'){$cs1=100;}
    $fire = "<img src='img/almaz.png' width='14'> $cs1";
}

switch($sd){
default:
echo "</div>";

echo "<div class='elem'><small><span style='float:left'><img src='img/fire.png' width='50'></span>&nbsp; Стихия Огная<br>&nbsp;<font color=grey> + $user[fire]% к Магии Огня</font><br>&nbsp;<a class='mybutt_off' href='?sd=fire'>Увеличить $fire</a><br></small>";
$fir = ($user['fire']/80)*100;

echo '<span style="float:left">0</span><span style="float:right">80</span><br><div style="background:#666666;height:2px;width:100%;padding:0;margin:4px 0;">
<div style="background:red; height:2px; width:'.$fir.'%;"></div></div></div>';


echo "<div class='elem'><small><span style='float:left'><img src='img/haos.png' width='50'></span>&nbsp; Стихия Хаоса<br>&nbsp;<font color=grey> + $user[haos]% к Магии Хаоса</font><br>&nbsp;<a class='mybutt_off' href='?sd=haos'>Увеличить $haos</a><br></small>";
$hao = ($user['haos']/80)*100;

echo '<span style="float:left">0</span><span style="float:right">80</span><br><div style="background:#666666;height:2px;width:100%;padding:0;margin:4px 0;">
<div style="background:#A117C4; height:2px; width:'.$hao.'%;"></div></div></div>';

echo "<div class='elem'><small><span style='float:left'><img src='img/voda.png' width='50'></span>&nbsp; Стихия Воды<br>&nbsp;<font color=grey> + $user[voda]% к Магии Воды</font><br>&nbsp;<a class='mybutt_off' href='?sd=voda'>Увеличить $voda</a><br></small>";
$vod = ($user['voda']/80)*100;

echo '<span style="float:left">0</span><span style="float:right">80</span><br><div style="background:#666666;height:2px;width:100%;padding:0;margin:4px 0;">
<div style="background:#2663BF; height:2px; width:'.$vod.'%;"></div></div></div>';

echo "<div class='main'>";
break;

case 'voda':
if($user['voda']!=='5' and $user['voda']!=='10' and $user['voda']!=='15' and $user['voda']!=='20' and $user['voda']!=='25' and $user['voda']!=='30' and $user['voda']!=='35' and $user['voda']!=='40' and $user['voda']!=='45' and $user['voda']!=='50' and $user['voda']!=='55' and $user['voda']!=='60' and $user['voda']!=='65' and $user['voda']!=='70' and $user['voda']!=='75' and $user['voda']!=='79'){
    if($user['silver']<$cs3){
        header('Location: elements.php');
        exit;
    }
    mysql_query("UPDATE `users` SET `silver`=`silver`-'$cs3',`voda`=`voda`+'1' WHERE `id`='$uid'");
}else{
    if($user['almaz']<$cs3){
        header('Location: elements.php');
        exit;
    }
    mysql_query("UPDATE `users` SET `almaz`=`almaz`-'$cs3',`voda`=`voda`+'1' WHERE `id`='$uid'");
}

header('Location: elements.php');
exit;

break;

case 'haos':
if($user['haos']!=='5' and $user['haos']!=='10' and $user['haos']!=='15' and $user['haos']!=='20' and $user['haos']!=='25' and $user['haos']!=='30' and $user['haos']!=='35' and $user['haos']!=='40' and $user['haos']!=='45' and $user['haos']!=='50' and $user['haos']!=='55' and $user['haos']!=='60' and $user['haos']!=='65' and $user['haos']!=='70' and $user['haos']!=='75' and $user['haos']!=='79'){
    if($user['silver']<$cs2){
        header('Location: elements.php');
        exit;
    }
    mysql_query("UPDATE `users` SET `silver`=`silver`-'$cs2',`haos`=`haos`+'1' WHERE `id`='$uid'");
}else{
    if($user['almaz']<$cs2){
        header('Location: elements.php');
        exit;
    }
    mysql_query("UPDATE `users` SET `almaz`=`almaz`-'$cs2',`haos`=`haos`+'1' WHERE `id`='$uid'");
}

header('Location: elements.php');
exit;

break;

case 'fire':
if($user['fire']!=='5' and $user['fire']!=='10' and $user['fire']!=='15' and $user['fire']!=='20' and $user['fire']!=='25' and $user['fire']!=='30' and $user['fire']!=='35' and $user['fire']!=='40' and $user['fire']!=='45' and $user['fire']!=='50' and $user['fire']!=='55' and $user['fire']!=='60' and $user['fire']!=='65' and $user['fire']!=='70' and $user['fire']!=='75' and $user['fire']!=='79'){
    if($user['silver']<$cs1){
        header('Location: elements.php');
        exit;
    }
    mysql_query("UPDATE `users` SET `silver`=`silver`-'$cs1',`fire`=`fire`+'1' WHERE `id`='$uid'");
}else{
    if($user['almaz']<$cs1){
        header('Location: elements.php');
        exit;
    }
    mysql_query("UPDATE `users` SET `almaz`=`almaz`-'$cs1',`fire`=`fire`+'1' WHERE `id`='$uid'");
}

header('Location: elements.php');
exit;

break;

}
include ('tmp/foot.php');
?>