<td width="50%" style="border: solid 0px green;">
    <fieldset>
        <legend>Edi&ccedil;&atilde;o de Usu&aacute;rio</legend>
        <table width="100%" border="0" valign="top" style="" align="center">
            <?php
            if (isset($_GET["chngusername"]) and $_GET["chngusername"] == "true") {
                print("<font color=\"#347C2C\">Login alterado com sucesso.</font><br><br>");
            }
            if (isset($erro) && count($erro) > 0) {
                echo '<div class="alert alert-danger">';
                foreach ($erro as $e) {
                    echo "<p>" . $e . "</p>";
                }
                echo "</div>";
            }
            ?>
            <form id="edituser" name="edituser" method="post">



                <?php
                $conn = @mysql_connect($dbhost, $dbuser, $dbpass) or sqlerror();
                mysql_select_db($dbname, $conn);
                $sql = mysql_query("SELECT * FROM cmum_udb WHERE id='" . $uid . "'");
                //exit("SELECT * FROM cmum_udb WHERE id='".$uid."'");
                $line = mysql_fetch_array($sql);
                //var_dump($line);
                mysql_close($conn);
                ?>
                <input type="hidden" name="uid" value="<?php print($line["id"]); ?>">
                <input type="hidden" name="username" value="<?php print($line["name"]); ?>">
                <input type="hidden" name="username" size="20" tabindex="1" value="<?php print($line["name"]); ?>">
                <input name="usrgroup" type="hidden" id="usrgroup" tabindex="4" value="<?php print($line["usrgroup"]); ?>" size="20" readonly="true">
                <input name="url_ref" type="hidden" value="<?php echo $_SERVER['HTTP_REFERER'] ?>"/>
                <!--<input type="hidden" name="maxconnections" size="1" tabindex="8" value="<?php print($line["maxconnections"]); ?>"/>-->
                <tr>
                    <td width="50%">
                        Ativo:<br>
                        <div style="width: 30%">
                            <select name="enabled" tabindex="10" class="form-control" <?php if ($_SESSION['adminlevel'] != "0" && (empty($opc_log) || array_search('5', $opc_log) === false)): ?>readonly="true"<?php endif; ?>>

                                <option value="true" <?php
                                if ($line["enabled"] == "true") {
                                    print("selected=\"selected\"");
                                }
                                ?>>Sim</option>
                                <option value="false" <?php
                                if ($line["enabled"] == "false") {
                                    print("selected=\"selected\"");
                                }
                                ?>>Nao</option>
                            </select>
                        </div>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        Valor Cobrado<br/>
                        <div class="" style="width: 30%">
                            <input type="text" name="valor_cob" id="valor_cob" class="form-control numeros" value="<?php print($line["valor_cob"]); ?>"/>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        Login:<br>
                        <input type="text" name="showuser" size="20" tabindex="1" class="form-control" value="<?php print($line["name"]); ?>" disabled="disabled"> 
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        Senha:<br>
                        <input type="text" name="password" size="20" tabindex="2" class="form-control" value="<?php echo isset($line['password']) ? (isset($_POST['password']) ? $_POST['password'] : $line['password']) : ""; ?>" <?php if ($_SESSION['adminlevel'] != "0" && (empty($opc_log) || array_search('2', $opc_log) === false)): ?>readonly="true"<?php endif; ?>/>
                    </td>
                </tr>
                <tr>
                    <td>
                        Nome:<br>
                        <input type="text" name="displayname" size="20" tabindex="3" class="form-control" value="<?php echo isset($line['displayname']) ? (isset($_POST['displayname']) ? $_POST['displayname'] : $line['displayname']) : ""; ?>" <?php if ($_SESSION['adminlevel'] != "0" && (empty($opc_log) || array_search('7', $opc_log) === false)): ?>readonly="true"<?php endif; ?>/>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        Email:<br>
                        <input type="text" name="email" size="20" tabindex="5" class="form-control" value="<?php echo isset($line['email']) ? (isset($_POST['email']) ? $_POST['email'] : $line['email']) : ""; ?>" <?php if ($_SESSION['adminlevel'] != "0" && (empty($opc_log) || array_search('3', $opc_log) === false)): ?>readonly="true"<?php endif; ?>>
                    </td>
                </tr>
                <tr>
                    <td>Cadastrado em:<br/>
                        <input id="startdate" type="text" name="startdate" size="20" tabindex="7" class="form-control" value="<?php print(date('d/m/Y', strtotime($line["startdate"]))); ?>" readonly="true">
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        Vencimento:<br>
                        <input id="expiredate" type="text" name="expiredate" size="20" tabindex="14" class="form-control" value="<?php print(date('d/m/Y H:i:s', strtotime($line["expiredate"]))); ?>" <?php if ($_SESSION['adminlevel'] != "0" && (empty($opc_log) || array_search('4', $opc_log) === false)): ?>readonly="true"<?php endif; ?>> 
                    </td>
                </tr> 
                <tr> 
                    <td>
                        <table>
                            <tr>                                
                                <td width="20%">DD:<br/>

                                    <input class="form-control numeros" maxlength="2" name="dd" value="<?php echo isset($line['dd']) ? (isset($_POST['dd']) ? $_POST['dd'] : $line['dd']) : ""; ?>" />

                                </td>
                                <td>
                                    Telefone:<br/>                                    
                                    <input class="form-control numeros" maxlength="9" name="telefone" value="<?php echo isset($line['telefone']) ? (isset($_POST['telefone']) ? $_POST['telefone'] : $line['telefone']) : ""; ?>" />
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td> 
                        &nbsp;

                    </td>
                    <td>
                        <table>
                            <tr>                                
                                <td width="20%">DD:<br/>

                                    <input class="form-control numeros" maxlength="2" name="dd_cel" value="<?php echo isset($line['dd_cel']) ? (isset($_POST['dd_cel']) ? $_POST['dd_cel'] : $line['dd_cel']) : ""; ?>"/>

                                </td>
                                <td>
                                    Celular:<br/>
                                    <input class="form-control numeros" maxlength="9" name="celular" value="<?php echo isset($line['celular']) ? (isset($_POST['celular']) ? $_POST['celular'] : $line['celular']) : ""; ?>"/>
                                </td>
                            </tr>
                        </table>
                    </td>

                </tr>
                <tr>  
                    <td style="vertical-align: top">
                        Maximo de Conexões<br/>
                        <input type="text" name="maxconnections" id="maxconnections" size="1" tabindex="8" class="form-control" value="<?php echo $line["maxconnections"] ?>" <?php if ($_SESSION['adminlevel'] != "0" && (empty($opc_log) || array_search('8', $opc_log) === false)): ?>readonly="true"<?php endif; ?>/>
                    </td>
                    <td>&nbsp;</td>
                    <td colspan="">Observções do Login:<br/>
                        <textarea class="form-control" name="obs_user" ><?php echo $line['obs_user'] ?></textarea>
                    </td>
                </tr>

        </table>
        <fieldset>
            <legend class="addedit">Perfis:</legend>
            <table width="100%" valign="top" cellpadding="0" cellspacing="0">
                <?php
                //Opçoes Mult Profis
                $con = mysql_connect($dbhost, $dbuser, $dbpass) or sqlerror();
                mysql_select_db($dbname, $con);
                $SQL = "SELECT mult_perf FROM cmum_settings WHERE id = '1'";
                $rs = mysql_query($SQL);
                if (is_resource($rs)) {
                    $mp = mysql_fetch_assoc($rs);
                    $tipo_campo = "checkbox";
                    if ($mp['mult_perf'] == '0') {
                        $tipo_campo = "radio";
                    }
                } else {
                    exit('Erro ao buscar informaçoes multi perifs.');
                }

                $lr = "0";
                $conn2 = @mysql_connect($dbhost, $dbuser, $dbpass) or sqlerror();
                mysql_select_db($dbname, $conn2);
                $SQL = "SELECT * FROM cmum_profiles";
                //Listando somente perfis definidos
                if ($_SESSION['adminlevel'] != "0") {
                    $ids_pf = implode(',', $pf_pm);
                    $SQL .= " WHERE id IN({$ids_pf})";
                }
                $rs = mysql_query($SQL) or sqlerror();




                while ($line2 = mysql_fetch_array($rs)) {
                    if ($lr == "0") {
                        $dbprof = unserialize($line["profiles"]);

                        if ($dbprof <> "") {
                            $checked = "";
                            foreach ($dbprof as $printprof) {
                                if ($printprof == $line2["id"] || isset($_POST['profiles']) && array_search($line2["id"], $_POST['profiles']) !== false) {
                                    $checked = "checked=\"checked\"";
                                }
                            }
                        } else {
                            $checked = "";
                        }
                        //adicionado 25/09
                        if ($printprof == $line2["id"] || $line2["bloqueado"] == "0") {
                            print("<tr width=\"100%\" valign=\"top\"><td width=\"50%\" valign=\"top\">"
                                    . "<input type=\"{$tipo_campo}\" name=\"profiles[]\" tabindex=\"15\" value=\"" . $line2["id"] . "\" " . $checked . "/>" . $line2["name"] . ""
                                    . "</td>");
                            $lr = "1";
                        }
                    } else {
                        $dbprof = unserialize($line["profiles"]);
                        if ($dbprof <> "") {
                            $checked = "";
                            foreach ($dbprof as $printprof) {
                                if ($printprof == $line2["id"] || isset($_POST['profiles']) && array_search($line2["id"], $_POST['profiles']) !== false) {
                                    $checked = "checked=\"checked\"";
                                }
                            }
                        } else {
                            $checked = "";
                        }
                        //adicionado 25/09
                        if ($printprof == $line2["id"] || $line2["bloqueado"] == "0") {
                            print("<td width=\"50%\" valign=\"top\"><input type=\"{$tipo_campo}\" name=\"profiles[]\" tabindex=\"15\" value=\"" . $line2["id"] . "\" " . $checked . "/>" . $line2["name"] . "</td></tr>");
                            $lr = "0";
                        }
                    }
                }
                mysql_close($conn2);
                ?>
            </table>            
            <?php if ($mp['mult_perf'] != "0"): ?>
                <br/>
                <input type="checkbox" name="allprof" onClick="checkedAll(this)"/>Selecionar Todos
            <?php endif; ?>
        </fieldset><br>

    <!--<input type="submit" name="bedituser" value="Save" tabindex="18" id="submit" accesskey="s" title="(ALT+S)">
    
    <input type="submit" name="bedituser" value="Change username" tabindex="19" id="submit" accesskey="u" title="(ALT+U)">
    <input type="submit" name="bedituser" value="Cancel" tabindex="20" id="submit" accesskey="q" title="(ALT+Q)">
    </form>
    <form name="deluser" action="deluser.php?id=<?php print($line["id"]); ?>" method="post">
    <input type="submit" name="bdeluser" value="Delete user" tabindex="21" id="submit" accesskey="d" title="(ALT+D)" />-->
        <button name="bedituser" type="submit" value="Save" alt="Salvar" title="Salvar" class="btn btn-success">
            Salvar &<br/> Sair
        </button>
        <button name="bedituser" type="submit" value="Change username" alt="Modificar Login" title="Modificar Login" class="btn btn-warning">
            Alterar<br/> Login
        </button>
    </form>
    <!--<form name="deluser" action="deluser.php?id=<?php print($line["id"]); ?>" method="post">
        <button name="bdeluser" type="submit" value="Delete user" alt="Deletar Usuario" title="Deletar Usuario" class="btn btn-default">
            <img src="images/usdel.png"  width="32px" alt="Deletar Usuario" title="Deletar Usuario" />
        </button>
    </form>-->
</td>
<!--<td width="280" height="20" valign="top">&nbsp;</td>
<td width="102" height="20" valign="top">&nbsp;</td>-->
</fieldset>
</td>
