<?php
/*********************/
/*                   */
/*  Version : 5.1.0  */
/*  Author  : RM     */
/*  Comment : 071223 */
/*                   */
/*********************/

echo "<html>\r\n<head>\r\n<script language=\"javascript\" type=\"text/javascript\" src=\"logar/funcoes.js\"></script>\r\n</head>\r\n<body leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">\r\n";
$classe = new td_class( );
$mid = $classe->checkcookie( );
$qBaus = @mssql_query( "Select NumeroBau,NomeBau From web_bau WHERE Login='".$mid."'" );
$tro = $_GET['tro'];
$del = $_GET['del'];
$alt = $_GET['alt'];
$alterar = $_POST['alterarok'];
if ( $tro )
{
    $classe->verificabauusado( $mid, $tro );
    $classe->executatrocabau( $mid, $tro, $classe->mostranomebaunumero( $mid, $tro ) );
}
if ( $del )
{
    $classe->verificasepode( $mid, $del, "1" );
    $classe->verificabauusado2( $mid, $del );
    $classe->executadeletabau( $mid, $del );
}
if ( $alterar )
{
    $novonome = $_POST['novonome'];
    $classe->checacampoembranco( $novonome, "Novo Nome" );
    $classe->checacaracteres( $novonome );
    $classe->verificasepode( $mid, $alt, "2" );
    $classe->verificabaulogin( $mid, $novonome );
    $classe->executatrocanomebau( $mid, $novonome, $classe->mostranomebaunumero( $mid, $alt ) );
}
echo "<form name=\"form1\" method=\"post\" action=\"\" target=\"_self\">\r\n<table border=\"0\" cellspacing=\"2\" cellpadding=\"0\" width=\"100%\"><tr><td>\r\n<table width=\"100%\" border=\"0\" align=\"center\" class=\"paineltitulo\"><tr><td>\r\n\r\n<tr valign=\"top\">\r\n<td colspan=\"2\">\r\n<table width=\"100%\" height=\"22\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\"> \r\n<tr>\r\n<td width=\"100%\" height=\"22\" align=\"center\" class=\"paineltitulo\">MULTIBAUS</font></td>\r\n</tr>\r\n</table>\r\n</td></tr>\r\n\r\n<tr>\r\n<td align=\"center\" colspan=\"2\" height=\"19\" class=\"paineltextoescuro\">Atualmente voc&ecirc; est&aacute; usando o Ba&uacute; : <b>";
echo $classe->mostranomebauatual( $mid );
echo "</b></td>\r\n</tr>\r\n<tr>\r\n<td align=\"center\" colspan=\"2\" height=\"19\" class=\"paineltextoescuro\">Clique no nome do Ba&uacute; para selecionar o Ba&uacute; que deseja usar:</td>\r\n</tr>\r\n<tr>\r\n<td align=\"center\" colspan=\"2\">&nbsp;</td>\r\n</tr>\r\n<tr> \r\n</tr>\r\n<tr> \r\n<td align=\"center\" colspan=\"2\" valign=\"top\"><table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\"> \r\n<tr valign=\"middle\" height=\"18\">\r\n<td width=\"20%\" align=\"center\" class=\"paineltextoescuro\">N&uacute;mero</td>\r\n<td width=\"40%\" align=\"center\" class=\"paineltextoescuro\">Nome</td>\r\n<td width=\"20%\" align=\"center\" class=\"paineltextoescuro\">Alterar</td>\r\n<td width=\"20%\" align=\"center\" class=\"paineltextoescuro\">Excluir</td>\r\n</tr>\r\n";
while ( $Baus = mssql_fetch_row( $qBaus ) )
{
    $numerobau = $Baus[0];
    echo "<tr>\r\n<td width=\"20%\" align=\"center\" class=\"painelchar\">".$Baus[0]."</td>\r\n<td width=\"40%\" align=\"center\" class=\"painelchar\"><a OnClick=\"javascript:location='?pagina=painel&acao=10&tro=".$Baus[0]."'\">".$Baus[1]."</a></td>\r\n<td width=\"20%\" align=\"center\" class=\"painelchar\"><img src=\"images/alterar.gif\" OnClick=\"javascript:location='?pagina=painel&acao=10&alt=".$Baus[0]."'\"></td>\r\n<td width=\"20%\" align=\"center\" class=\"painelchar\"><img src=\"images/excluir.gif\" OnClick='javascript:DeletarBau(".$Baus[0].",\"".$Baus[1]."\")'></a></td>\r\n</tr>";
    if ( $alt == $numerobau )
    {
        echo "<form name=\"formnome\" method=\"post\" action=\"?pagina=painel&acao=10&altera=".$alt."\">\r\n\t<tr>\r\n    <td align=\"center\" colspan=\"4\" class=\"painelchar\">\r\n    <table width=\"80%\"><tr>\r\n    <td class=\"painelchar\">Novo Nome:</td> \r\n    <td class=\"painelchar\"><input name=\"novonome\" type=\"text\" id=\"novonome\" value=\"".$classe->mostranomebaunumero( $mid, $numerobau )."\" maxlength=\"20\" size=\"40\"></td>\r\n    <td class=\"painelchar\"><input type=\"submit\" id=\"alterarok\" name=\"alterarok\"  value=\"Alterar\"></td></tr></table></td></tr></form>";
    }
}
echo "</table></td>\r\n</tr>\r\n<tr>\r\n<td align=\"center\" colspan=\"2\" height=\"19\" class=\"paineltextoescuro\"><input type=\"button\" name=\"criarok\" id=\"criarok\" value=\"Criar Ba&uacute;\" onClick=\"javascript:location='?pagina=painel&acao=11';\"></td>\r\n</tr>\r\n</table>\r\n</td>\r\n</tr>\r\n</table>\r\n</form>\r\n\r\n</body>\r\n</html>";
?>
