<?php
require'fun.php';
require'f_conectare.php';
conectare('setari trib (triburile v2)','triburile2-setari-trib');
$titlu='Setări trib - Triburile V2';
$back[1]='<a href="/triburile2">'.img('triburile.gif',1).'Triburi</a>';
require'f_sus.php';
require'triburile2_nicu1.php';
if($go=='1')
{
if($conn->query('SELECT`trib`FROM`t2_membrii`WHERE`de`="'.$de.'"')->fetch_row()[0]!='')
echo($conn->query('UPDATE`t2_membrii`SET`trib`=""WHERE`de`="'.$de.'"')?$div[6].'Nu mai faci parte din nici un trib!':$div[7].'Eroare!').$div[0];
}
if($go==2)
{
$tor=$conn->query('SELECT`nume`,`de`FROM`t2_triburi`WHERE`de`="'.$de.'"')->fetch_row();
$top=$conn->query('SELECT`trib`FROM`t2_membrii`WHERE`de`="'.$de.'"')->fetch_row();
if($top[0]!=''&&$tor[0]==$top[0])
{
if($conn->query('UPDATE`t2_membrii`SET`trib`=""WHERE`trib`="'.$tor[0].'"'))
{
$conn->query('DELETE FROM`t2_triburi`WHERE`de`="'.$de.'"');
echo$div[6].'Nu mai faci parte din nici un trib!';
}
else
echo$div[7].'Eroare!';
echo$div[0];
}
}
$tor=$conn->query('SELECT`nume`,`de`FROM`t2_triburi`WHERE`de`="'.$de.'"')->fetch_row();
$top=$conn->query('SELECT`trib`FROM`t2_membrii`WHERE`de`="'.$de.'"')->fetch_row();
if($top[0])
{
$trio=$conn->query('SELECT`trib`FROM`t2_membrii`WHERE`de`="'.$de.'"')->fetch_row();
echo$div[1].'Tribul tau: '.$trio[0].$div[0];
if($tor[0]&&$tor[0]==$top[0])
echo$div[1].'<a href="/triburile2-setari-trib/tip/2">Șterge trib</a>'.$div[0];
else
echo$div[1].'<a href="/triburile2-setari-trib/tip/1">Paraseste tribul</a>'.$div[0];
}
else
{
echo$div[1].'<a href="/triburile2-creaza-trib">Creaza trib</a>'.$div[0];
$trio=$conn->query('SELECT`id`FROM`t2_membrii`WHERE`de`="'.$de.'"')->fetch_row();
$noh=$conn->query('SELECT COUNT(*)FROM`t2_invitatii`WHERE`la`="'.$trio[0].'"')->fetch_row();
echo$div[1].'<a href="/triburile2-invitatii">Invitatii trib</a> <strong>'.number_format($noh[0]).'</strong>'.$div[0];
}
require'f_jos.php';